Welcome Guest Search | Active Topics | Sign In | Register

Can not print to PDF device. Please use EO.Pdf to render HTML page to PDF Options
Emad Khalil
Posted: Monday, October 1, 2018 10:41:48 AM
Rank: Newbie
Groups: Member

Joined: 10/1/2018
Posts: 1
Hi

I'm using EO.Pdf to programatically produce pdf from html, then print it..

Code: C#
SavePDF(PDFFilePath, TempFolderPath);
PdfDocument PDFDoc = new PdfDocument(PDFFilePath);

PrinterSettings settings = WebView.GetDefaultPrinterSettings();
// set the settings from a custom print dialog
settings.PrinterName = printDialog.SelectedPrinter;
settings.DefaultPageSettings.PaperSize = new PaperSize();
settings.DefaultPageSettings.PaperSize.RawKind = printDialog.SelectedPaperSize;
settings.DefaultPageSettings.Landscape = printDialog.SelectedPaperOrientation.IsLandscape;
settings.PrintToFile = true;

PDFDoc.Print(settings, null);


It works fine when i print from a normal printer or "XPS document writer", but when i choose "Microsoft Print to PDF" it gives the following crash:


Code: C#
Exception:
System.Exception: Can not print to PDF device. Please use EO.Pdf to render HTML page to PDF.
   at EO.WebBrowser.WebView.a(PrinterSettings A_0, PageSettings A_1)
   at EO.Internal.y9.a(PrinterSettings A_0, PageSettings A_1)
   at EO.WinForm.PdfViewer.Print(PrinterSettings printerSettings, PageSettings pageSettings)
   at EO.Pdf.PdfDocument.d.a()
   at EO.Base.WaitableTask.a.a(WaitableTask A_0)
   at EO.Base.WaitableTask.i()
   at EO.Internal.y9.a(Boolean A_0)
   at EO.Internal.y9.e.a()
   at EO.WebBrowser.WebView.w()
   at EO.WebBrowser.WebView.o.a(IntPtr A_0, Int32 A_1, IntPtr A_2, IntPtr A_3, Boolean& A_4)
   at EO.Internal.x.l.a(IntPtr A_0, Int32 A_1, IntPtr A_2, IntPtr A_3, IntPtr A_4, IntPtr A_5)
   at EO.Internal.x.b(c& A_0)
   at EO.Internal.x.a(c& A_0)
   at EO.Internal.x.a(Int32 A_0)
   at EO.Base.ThreadRunnerBase.c(Boolean A_0)
   at EO.Base.ThreadRunnerBase.b(Boolean A_0)



The error happened on Windows 10, EO.pdf version is 18.1.91.0

Thanks
eo_support
Posted: Monday, October 1, 2018 10:56:01 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,221
Hi,

You can not print a PDF file to another PDF file. The purpose of the print feature is to print to a real printer.

Thanks!
Fabien
Posted: Tuesday, October 2, 2018 3:35:17 AM
Rank: Advanced Member
Groups: Member

Joined: 7/21/2014
Posts: 130
Hi,

Some of our customers ask us to print in PDF with their printer as they do with any program on Windows 10. Could you consider "unlocking" this feature.

Thank you.
eo_support
Posted: Tuesday, October 2, 2018 9:14:09 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,221
Wouldn't it be easier if you just give the PDF file directly to your customer instead of having to go through another printer device to get another PDF file? What's the purpose of trying to print a PDF file through a PDF printer in order to get another PDF file?
Fabien
Posted: Monday, October 8, 2018 3:04:43 AM
Rank: Advanced Member
Groups: Member

Joined: 7/21/2014
Posts: 130
Hi,

For my part, I was talking about EO.WebBrowser in which you put the same restriction on the use of a virtual printer.

We can't create a PDF edition of all the screens in your app just because you lock a Windows 10 feature... some of our customers just want to save in pdf what they see on their screen but they can't.

Thanks
eo_support
Posted: Monday, October 8, 2018 8:35:02 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,221
You will need a license for EO.Pdf to convert any web page to PDF. What we can do is to enable this feature on EO.WebBrowser if you also also have an EO.Pdf license. In your case, since you have been an EO.WebBrowser license for a long time, we can upgrade your EO.WebBrowser license to EO.Total just for the price difference (the current subscription expiration date will stay the same after the upgrade). Please let us know if this works for you.
Fabien
Posted: Thursday, December 6, 2018 11:03:46 AM
Rank: Advanced Member
Groups: Member

Joined: 7/21/2014
Posts: 130
Hi,

When we use ".PrintToFile = true" feature the directory path set in .PrintFileName is not used.

Code: Visual Basic.NET
Dim printToPDFSettings As Printing.PrinterSettings = New Printing.PrinterSettings() With {
                .PrintToFile = True,
                .PrinterName = "Microsoft Print to PDF",
                .PrintFileName = "D:\sandbox\test.pdf"
            }

            webView.Print(printToPDFSettings)


The Save As dialog is opening but not in the directory set in .PrintFileName

Thanks.
eo_support
Posted: Thursday, December 6, 2018 11:12:50 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,221
Hi,

I do not believe this is supported yet. We will look into the browser engine's code to see if we can add this in our 2019 release.

Thanks!
Fabien
Posted: Thursday, December 6, 2018 11:15:24 AM
Rank: Advanced Member
Groups: Member

Joined: 7/21/2014
Posts: 130
Ok thanks.

Hope you could add this because we've taken an EO.PDF licence only for that...
eo_support
Posted: Thursday, December 6, 2018 1:44:25 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,221
Yes. We understand that.
sebaot
Posted: Thursday, January 3, 2019 2:38:33 AM
Rank: Newbie
Groups: Member

Joined: 9/16/2015
Posts: 6
Not exactly the same topic, maybe, but I get the occasional users that print the WinForms WebBrowser's HTML page to PDF Creator - because that's what they do in all apps and PDF Creator is the selected corporate tool for that job - and it'll print the page resized to sometimes 1/4 of the page and sometimes 1/2 of the page and so on. It happens on their Windows 10 tablets only with our app. Everyday programs work fine with printing to PDF Creator. I think it might be related to their size of icons and text settings, where it's enlarged, I'm not sure. I've not had the pleasure of looking at any of the affected computers since the cases are few and far between and these guys are constantly out in the field. I've also not managed to reproduce it myself, but I've seen their results. There, we recommend them to use the built-in "Save as PDF"-function but it'd of course be fantastic to not get e-mails about the issue. Although understandable if impossible to reproduce something off of the sparse and random crumbs for clues I've gotten over the years. As mentioned, I failed myself at reproducing it, so I was getting ready to blame the tablets, but then remembered the print to PDF Creator works for all other apps.
eo_support
Posted: Thursday, January 3, 2019 8:24:56 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,221
sebaot wrote:
Not exactly the same topic, maybe, but I get the occasional users that print the WinForms WebBrowser's HTML page to PDF Creator - because that's what they do in all apps and PDF Creator is the selected corporate tool for that job - and it'll print the page resized to sometimes 1/4 of the page and sometimes 1/2 of the page and so on. It happens on their Windows 10 tablets only with our app. Everyday programs work fine with printing to PDF Creator. I think it might be related to their size of icons and text settings, where it's enlarged, I'm not sure. I've not had the pleasure of looking at any of the affected computers since the cases are few and far between and these guys are constantly out in the field. I've also not managed to reproduce it myself, but I've seen their results. There, we recommend them to use the built-in "Save as PDF"-function but it'd of course be fantastic to not get e-mails about the issue. Although understandable if impossible to reproduce something off of the sparse and random crumbs for clues I've gotten over the years. As mentioned, I failed myself at reproducing it, so I was getting ready to blame the tablets, but then remembered the print to PDF Creator works for all other apps.


Thanks for the information. As you might be able to imagine, there isn't much we can do without being able to reproduce it first. So if you have found a way to reproduce it please let us know, and if we stubble on something that may resolve this issue, we will reply here too.
eo_support
Posted: Monday, February 18, 2019 11:25:20 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,221
Fabien wrote:
Ok thanks.

Hope you could add this because we've taken an EO.PDF licence only for that...


Hi,

We have posted our 2019 release and this release officially support print to file name. You can download the new build from our download page. Please take a look and let us know how it goes.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.