Page 2 of 2
Re: Best approach for a server-side HTML to image/pdf converter ?
Posted: Tue Dec 15, 2020 7:57 am
by Eric
I have some pages where TCEFBrowserThread.WebpagePostProcessing is firing multiple times, for instance
https://www.delphitools.info/
I suspect this is because the isLoading from cef_load_handler_on_loading_state_change is fired once per loading iframe, and it's likely webpages with dynamically refreshed portions could triggered the loading state changes "forever".
I have worked around it by using a timer to trigger the snapshot rather than a sleep, the first WebpagePostProcessing call triggers the timer, and the timer then triggers the snapshot only once (cf.
https://github.com/EricGrange/cefHtmlSn ... a9f0822737)
Re: Best approach for a server-side HTML to image/pdf converter ?
Posted: Thu Dec 17, 2020 6:52 am
by Eric
Is there a way to force a full repaint by Chromium ?
I am seeing some incorrect painting in areas where an animation occurs, see below the artefacts on the background. This is where the cookie law banner stands before being deleted, and it disappears with an animation.
If a full repaint is possible, then it may result in a cleaner render for the purpose of snapshots, where incremental paints are not required (and the incremental paint updates before the full repaint could just be ignored)

Re: Best approach for a server-side HTML to image/pdf converter ?
Posted: Thu Dec 17, 2020 8:42 am
by salvadordf
Eric wrote: Thu Dec 17, 2020 6:52 am
Is there a way to force a full repaint by Chromium ?
Call
TChromium.Invalidate(PET_VIEW) to repaint everything asynchronously.
Re: Best approach for a server-side HTML to image/pdf converter ?
Posted: Fri Dec 18, 2020 10:21 am
by Eric
Thanks, the issue is still present though the Invalidate works as expected, I will report with upstream.
I have also been filing false positive reports for each of my cef builds, according to VirusTotal, SecureAge is the only one firing on basically any Delphi + CEF4Delphi build, I do not know if they have processed my report.
Hopefully if enough Delphi devs report false positive, this problem will be history!
Re: Best approach for a server-side HTML to image/pdf converter ?
Posted: Fri Dec 18, 2020 1:45 pm
by salvadordf
Eric wrote: Fri Dec 18, 2020 10:21 am
Thanks, the issue is still present though the Invalidate works as expected, I will report with upstream.
I tried loading
https://delphitools.info/ in the
SimpleOSRBrowser demo and it looks ok. The
WebpageSnapshot demo, which uses the same TCEFBrowserThread, also looks ok.
Eric wrote: Fri Dec 18, 2020 10:21 am
I have also been filing false positive reports for each of my cef builds, according to VirusTotal, SecureAge is the only one firing on basically any Delphi + CEF4Delphi build, I do not know if they have processed my report.
Hopefully if enough Delphi devs report false positive, this problem will be history!
As far as I know, virustotal only shows the information given by the different antivirus programs. You should send a message to the company that created each antivirus software.
I also have some false positives with BriskBard from time to time and they are usually gone the next month. Sometimes they need a message to the antivirus company and sometimes it just disappears.
Re: Best approach for a server-side HTML to image/pdf converter ?
Posted: Fri Dec 18, 2020 2:46 pm
by Eric
I tried loading
https://delphitools.info/ in the SimpleOSRBrowser demo and it looks ok. The WebpageSnapshot demo, which uses the same TCEFBrowserThread, also looks ok
With a simple snapshot at 1024x768 resolution I only have an issue on the edges, the issue at the top happens when running the script at
https://github.com/EricGrange/cefHtmlSn ... -buster.js which removed the cookie banner, which results in a slight scrolling of the page.
As far as I know, virustotal only shows the information given by the different antivirus programs. You should send a message to the company that created each antivirus software.
Yes, that is what I've been doing. I am feeding them the intermediate builds with false positives as well.