How to disable auto opening of print dialog upon opening PDF

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

How to disable auto opening of print dialog upon opening PDF

Postby SolidMercury » Sun Dec 20, 2020 11:56 pm

PDF supports embedding JS. When this.Print() is called in that, opening PDF causes the print dialog to appear automatically. Is there a way to disable this print dialog? I am fine with patching chromium code too to disable this. Have already tried patching PDFium at https://pdfium.googlesource.com/pdfium. ... nt.cpp#511 to not to call JS_docprint but no luck with that? Any inputs on this would be appreciated.

Thanks.
SolidMercury
Newbie
 
Posts: 3
Joined: Sun Dec 13, 2020 11:47 pm

Re: How to disable auto opening of print dialog upon opening

Postby Peter » Mon Jan 25, 2021 8:01 am

Perhaps related - is there any way to intercept the .print() on C++ side? in my project here we want to provide out own print dialog...

I see that in Linux version of the CefClient there is a "print handler" that is being called, so it is possible to just cancel printing from there, but on Windows CEF seems to be opening the system print dialog directly.
Peter
Techie
 
Posts: 38
Joined: Thu Mar 05, 2020 9:41 am

Re: How to disable auto opening of print dialog upon opening

Postby ndesktop » Mon Jan 25, 2021 8:39 am

Maybe setting bSilent to true (and I think this controls the dwOptions & XFA_PRINTOPT_ShowDialog, which should map on the bUI of Doc_print definition, but I am not sure).

I did not tried this myself, but that would be a route to try.
ndesktop
Master
 
Posts: 756
Joined: Thu Dec 03, 2015 10:10 am


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 73 guests