Question on implementing the print preview dialog in CEF

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.

Re: Question on implementing the print preview dialog in CEF

Postby ivdone » Tue Aug 22, 2017 1:03 pm

emerick wrote:OK, sounds good. Does that mean you're close to having this working then? That would be wonderful! :)


Unfortunately No.

Right now I am having a issue displaying the print preview web ui in constrained window.

The new window is created but nothing was inside of it. I tried enormous amount of debugging but sadly cannot find out why. :cry:

Image
ivdone
Newbie
 
Posts: 9
Joined: Wed May 17, 2017 12:55 pm

Re: Question on implementing the print preview dialog in CEF

Postby ivdone » Mon Sep 25, 2017 3:56 pm

emerick wrote:OK, sounds good. Does that mean you're close to having this working then? That would be wonderful! :)

Hi Emerick,

Luckily I got a working version recently. The only missing part is that when selecting printer, 'save to pdf' will cause a crash. Working on debugging that.
ivdone
Newbie
 
Posts: 9
Joined: Wed May 17, 2017 12:55 pm

Re: Question on implementing the print preview dialog in CEF

Postby emerick » Mon Sep 25, 2017 5:44 pm

Oh, that's really great news! Sounds like you're really close then!
emerick
Expert
 
Posts: 154
Joined: Sun Feb 21, 2010 7:57 pm
Location: Belmont, MA

Re: Question on implementing the print preview dialog in CEF

Postby ivdone » Fri Oct 20, 2017 4:31 pm

Please find the patch in the attachment.

Here are some reasoning about the changes I made, I hope this could help you navigate through the changes.
1. print preview will be initiated by PrintViewManager instead of CefPrintViewManager because PrintPreviewHandler will try to retrieve a PrintViewManager. One solution is to create a Cef version of those classes, but that will involve a lot of files so I didn't do that.
2. The 'path' related patch are used for enable the download manager. Which will be used by 'print to pdf' in print preview.
3. I have changed the way how browserInfoManager is destroying browserInfos. Because the printpreview dialog will not have a browserHost, thus I will create a PopupBrowserInfo
manually in CefPrintPreviewMessageHandler. And BrowserInfoManager will be responsible to destroy those browserInfo. I think this is not a good way to implement it but I cannot seem to find a easy way around. Do you have any sugguestions?

It is still experiencing an flaw after resizing. When the host window is resized, the print preview will not resize accordingly. Do you guys have any sugguestions on how to do that?
Any help will be appreciated!

Thanks,
Attachments
print_preview_patch_cef.txt
(38.83 KiB) Downloaded 1077 times
ivdone
Newbie
 
Posts: 9
Joined: Wed May 17, 2017 12:55 pm

Previous

Return to Support Forum

Who is online

Users browsing this forum: No registered users and 35 guests

cron