Print preview is not working.

1,480 views
Skip to first unread message

Jitesh Golecha

unread,
Jul 30, 2014, 3:11:08 PM7/30/14
to phpde...@googlegroups.com
Heya!

Print preview in php desktop chrome is not working on the PC/Laptop which has printer configured. I've tried it with many PC. Instead of print preview the system print dialog appears.

Any solution for this issue??

Regards,
Jitesh Golecha.

Czarek Tomczak

unread,
Jul 30, 2014, 4:36:46 PM7/30/14
to
Print preview is not yet supported by CEF [1]. Google Chrome has open sourced its PDF rendering engine and it got into Chromium recently, so print preview should appear in CEF soon.

Sreenadh OG

unread,
Nov 1, 2014, 1:09:17 AM11/1/14
to phpde...@googlegroups.com
Hi Czarek,
   The window.print() javascript  call is not functioning as expected in PHPDesktop. In chrome browser the same provides us with the print preview where we can select (page setup kind of ) things such as Paper size (Legal, A4, A3 Letter etc), Adjust margins, Adjust Orientation (Landscape, Portrait), Whether to print header and footer, whether to print background image etc. But when the window.print() is called in PHPDesktop  //Instead of print preview the system print dialog appears.// This is a real problem since now I cannot select -
1) The paper size (legal, A4 etc) [Required and is a must in my current project]
2) Adjust paper orientation (Landscape, Portrait)
3) Choose whether to print header/footer
4) Adjust margins
4) Choose whether to print background image or not. [Required and is a must in my current project]
  This is a major problem! Is there any work around, till the same gets implemented in CEF?
Thanks and regards,
Sreenadh

Czarek Tomczak

unread,
Nov 1, 2014, 2:18:24 AM11/1/14
to phpde...@googlegroups.com
When system print dialog appears click "Preferences" to change various options such as paper size, orientation, margins. System print dialog uses Internet Explorer engine I believe (it's a html file saved in some temp directory and an OS call is made to print it), so to make sure any HTML/CSS prints properly test printing it in Internext Explorer first. Latest releases of CEF/Chromium include PDFium engine for printing that will give us in the future similar experiences to Google Chrome.

--
You received this message because you are subscribed to the Google Groups "PHP Desktop" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phpdesktop+...@googlegroups.com.
Visit this group at http://groups.google.com/group/phpdesktop.
For more options, visit https://groups.google.com/d/optout.

Sreenadh OG

unread,
Nov 1, 2014, 3:36:43 AM11/1/14
to phpde...@googlegroups.com
Hi Czarek,
  //When system print dialog appears click "Preferences" to change various options such as paper size, orientation, margins. System print dialog uses Internet Explorer engine I believe//
  OK. I got it. PHPDesktop calls system Print Dialog box (which is the same as the Print Dialongbox of Internet explorer) when window.print() is called. That means the result of window.print() call would be different in Chrome and CEF. Understood. Thanks for the clarification. Now I understand that I can set/change many of my requirements such as Orientation, Paper size etc in Printer Preferences. But still that does not solve one of my problems listed above -
 //4) Choose whether to print background image or not.//
   I couldn't find this anywhere in any Printer Preferences (which varies from printer to printer), and so does not know how to print the text along with Background Image from within PHPDesktop.
   For example, in my application, in some printed pages, my header, background watermark, and the footer are actually integrated in my background image (based on whether the user set his default form printing option as legal, A4 etc). But when I am printing from within PHPDesktop  I am not getting the desired result. But when I print from within Chrome after selecting 'Background Colors and Images" checkbox I am getting the desired output. In Internet Explorer in PageSetup there is an option "Print Background Colors and Images" on checking which I get the desired output. So my requirement is just to get the background images also in Print, which I am not getting from within PHPDesktop. Any work around or solution? Or is there a way to call 'System Page Setup' (Same as the Internet Explorer Page Setup) from within PHPDesktop?
//Latest releases of CEF/Chromium include PDFium engine for printing that will give us in the future similar experiences to Google Chrome.//
  That would be great! When can we expect a PHPDesktop release that includes the above mentioned CEF/Chromium?
Thanks and regards,
Sreenadh

Czarek Tomczak

unread,
Nov 1, 2014, 4:31:41 AM11/1/14
to phpde...@googlegroups.com
According to this (http://www.magpcss.org/ceforum/viewtopic.php?f=6&t=11624) CEF branch 2078 supports printing with background colors/images. That branch seem to be using PDFium rendering engine for printing that I mentioned earlier. To test newer CEF release, see: https://code.google.com/p/phpdesktop/wiki/KnowledgeBase#Feature_X_works_in_Google_Chrome,_but_doesn't_work_in_PHP_D

Czarek Tomczak

unread,
Nov 1, 2014, 4:43:54 AM11/1/14
to phpde...@googlegroups.com
Maybe this will help: 
"The "Allow the printing of background colors and images" Group Policy setting does not take effect on a computer that has Internet Explorer 8 installed" http://support.microsoft.com/kb/980077

Sreenadh OG

unread,
Nov 1, 2014, 6:46:54 AM11/1/14
to phpde...@googlegroups.com
Hi Czarek,
   I am using PHPDesktop 31.6 as of now. Using the following code, helped me in printing with Background color and images -
====================
body {
    -webkit-print-color-adjust: exact;
}

====================
But still the background watermark image was losing it clarity and continuity. So for Footer etc I have used the background image (where it won't get disturbed by the text on top) and for watermark I have decided to us the watermark printing feature provided by the Printer Settings itself.  Yes, this does solves my problem for now! Thanks a lot for the help and guidance provided.
But I am eagarly waiting for the PHPDesktop version that includes //Latest releases of CEF/Chromium include PDFium engine for printing that will give us in the future similar experiences to Google Chrome.// :)
Thanks and regards,
Sreenadh

Sreenadh OG

unread,
Nov 7, 2014, 1:00:36 AM11/7/14
to phpde...@googlegroups.com
Hi Czarek,
  I do have problems with the above solution too. In A4 pages I am getting the desired output, but when the paper size is legal or so it is printing all black background in printed pages and pdf even though on screen it looks correct! :( 
  An alternate solution available for Footer printing (in every printed page) is the following code.
=============================

If you take the element that you want to be the footer and set it to be position:fixed and bottom:0, when the page prints it will repeat that element at the bottom of each printed page. The same would work for a header element, just set top:0 instead.

For example:

<div class="divFooter">UNCLASSIFIED</div>

CSS:

<style type="text/css">
    @media screen {
        div.divFooter {
            display: none;
        }
    }
    @media print {
        div.divFooter {
            position: fixed;
            bottom: 0;
        }
    }
</style>

=============================
  But unfortunately this solution does not seem to work on webkit browsers (like Chrome and Chromium) even though works great in Firefox. So I am unable to use this  solution from within PHPDesktop too, since it does not work well here. Do you have a solution or work arount to suggest?
Thanks and regards,
Sreenadh

Sreenadh OG

unread,
Nov 7, 2014, 4:16:50 AM11/7/14
to phpde...@googlegroups.com
Hi Czarek,
  //I do have problems with the above solution too. In A4 pages I am getting the desired output, but when the paper size is legal or so it is printing all black background in printed pages and pdf even though on screen it looks correct! //
  Using  //-webkit-print-color-adjust: exact;// for body and using a background image for a Legal sized div (since legal size printing was my requirement) with a background image whose opacity is set to 0.95 became the work around. And I still don't know why it worked! Anyway seems to be only a temporarily solution that may not work everywhere, not a generalized solution. Probably a // PHPDesktop version that includes latest releases of CEF/Chromium include PDFium engine for printing that will give us in the future similar experiences to Google Chrome.// is the better and right solution. Hope to see the same soon.
Thanks and regards,
Sreenadh

Sreenadh OG

unread,
Nov 19, 2014, 11:58:41 PM11/19/14
to phpde...@googlegroups.com
Hi Czarek,
 // PHPDesktop version that includes latest releases of CEF/Chromium include PDFium engine for printing that will give us in the future similar experiences to Google Chrome.//
  Is it possible to get this feature implemented at the earliest on priority please... Because without this background image printing is always a problem, and every printer setting may not have an option to print water mark etc (where as having a general background image printing option available Chrome PDFium-engine can be a life saver)
Thanks and regards,
Sreenadh


k.l...@gmail.com

unread,
May 10, 2017, 9:28:29 AM5/10/17
to PHP Desktop
Any update about this problem?
I have tried with Chrome 47.5 and 57.0 version and I can't find the right flag to activate the print preview.

Czarek Tomczak

unread,
May 10, 2017, 9:47:46 AM5/10/17
to PHP Desktop
Print preview is currently not supported by upstream CEF. You can however print to PDF which can act as a preview before printing.
Reply all
Reply to author
Forward
0 new messages