PHPDesktop and mPDF, print forces to save instead of showing print dialog

995 views
Skip to first unread message

Shobhit Gupta

unread,
Jul 18, 2018, 12:03:36 PM7/18/18
to PHP Desktop
I have written code for printing report using mdf library in PHP as below:

include("..\mpdf\mpdf.php");
$mpdf=new mPDF('','A4');
$mpdf->WriteHTML($a);
$mpdf->SetJS('this.print();');
$mpdf->Output();
exit;

When I use this applicaiton, things go fine. I directly get print dialog box and there are no PHP warnings too. But when the same application is executed under PHPDesktop, it shows pdf save dialog instead of showing print dialog

I want to open the print dialog box in PHPDesktop also. Please provide some solution.

I have downloaded phpdesktop-chrome-57.0-rc-php-7.1.3 from Github. Also, I have downloaded php_printer.dll from Github. Version is php_printer-php5.6.30 I have placed the dll in every possible folder and also have added it as an extension to the php.ini file of PHPDesktop project directory. Now, it tries to show the preview but says: "Failed to load PDF document"

Czarek Tomczak

unread,
Jul 18, 2018, 12:25:26 PM7/18/18
to PHP Desktop
You can replace PHP version in PHP Desktop with one that works with your extension (5.6.30). See:
https://github.com/cztomczak/phpdesktop/wiki/Knowledge-Base#php-interpreter--extensions

Shobhit Gupta

unread,
Jul 18, 2018, 1:04:00 PM7/18/18
to PHP Desktop
HI, thnx for your response.
Actually, first I downloaded: phpdesktop-chrome-31.8-php-5.6.1
In this version, it creates the pdf successfully, but the issue is that it asks to save the pdf instead of opening the print dialog box.
Then after going through various articles, I downloaded phpdesktop-chrome-57.0-rc-php-7.1.3
This time, it tries to show a preview but days "Failed to load PDF document"
I also tries to change and apply the extension of php_printer from php-master, but nothing works.
image.png

Shobhit Gupta

unread,
Jul 18, 2018, 1:42:21 PM7/18/18
to PHP Desktop
I am not able to figure out the perfect combination.
Please note, in normal web browsers, my project works fine with XAMPP having 5.6.x verion of PHP.

Can you please suggest the right versions of:

PHPDesktop
PHP
php_printer.dll
mPDF

such that when i click on print button,  i get a print dialogue box where I can just select a print and click print button or cancel button.

please help.

Paolo

unread,
Jul 19, 2018, 9:54:45 AM7/19/18
to PHP Desktop
Hi.
I have similar error but i don't have the message "Failed to load PDF document"...i have a white screen.
Is there a chromium plugin/dll for pdf viewing?

Czarek Tomczak

unread,
Jul 19, 2018, 10:23:58 AM7/19/18
to PHP Desktop
PHP Desktop v57 supports PDF viewing.

Shobhit Gupta

unread,
Jul 19, 2018, 2:28:42 PM7/19/18
to PHP Desktop
Hi,
If it supports PDF Viewing then why I am getting an error. When things are working fine in Chrome Web Browser, then why there is an error in PHPDesktop?

Czarek Tomczak

unread,
Jul 19, 2018, 3:17:52 PM7/19/18
to PHP Desktop
Your issue is with an extension that is incompatible with the php version in phpdesktop.

Shobhit Gupta

unread,
Jul 21, 2018, 4:43:54 AM7/21/18
to PHP Desktop
I understand, but ease suggest me the right versioning for my scenario

Shobhit Gupta

unread,
Jul 21, 2018, 7:08:29 AM7/21/18
to PHP Desktop
Here are the log details:

- 16:27:23.188 DEBUG: OnLoadingStateChange: loading=0, url=http://127.0.0.1:58283/Reception/Reprint_Reciept.php
[0721/162723.501:INFO:CONSOLE(0)] "Unchecked runtime.lastError while running tabs.get: Not implemented
    at promises.push.Promise.then.streamInfo.tabUrl (chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/browser_api.js:181:21)
    at chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/browser_api.js:180:21", source: chrome-extension://mhjfbmdgcfjbbpaeojofohoefgiehjai/index.html (0)
- 16:27:23.000 DEBUG: Command line string for the ppapi process: "C:\Users\Shobhit Gupta\Downloads\phpdesktop-chrome-57.0-rc-php-7.1.3\phpdesktop-chrome.exe" --type=ppapi --no-sandbox --ppapi-flash-args --lang=en-US --device-scale-factor=1.25 --ppapi-antialiased-text-enabled=1 --ppapi-subpixel-rendering-setting=1 --lang=en-US --log-file="C:\Users\Shobhit Gupta\Downloads\phpdesktop-chrome-57.0-rc-php-7.1.3\debug.log" --service-request-channel-token=E213CDEA61742EF52D893FC21CFDF764 --mojo-platform-channel-handle=3392 /prefetch:3

Czarek Tomczak

unread,
Jul 21, 2018, 8:17:29 AM7/21/18
to PHP Desktop
You have a problem with the extension, thus your problem is not suitable for this forum. Unless you can provide information that this is an issue with phpdesktop.
Message has been deleted
Message has been deleted

Shobhit Gupta

unread,
Jul 23, 2018, 12:09:12 AM7/23/18
to PHP Desktop
Hi, finally I got it working. Updating mPDF and minor changes in code made things work but now I have another issue, on creating setup with innodbwith the steps suggested on PHPOcean, when I run the application after installing it, I see only white screen and error says file not found. While things worked fine in php-desktop

Czarek Tomczak

unread,
Jul 23, 2018, 12:56:45 AM7/23/18
to PHP Desktop
Compare your phpdesktop directory with the program files installation directory and see which files/directories are missing. Probably you have not configured inno setup properly to include all necessary files.

enrico.m...@gmail.com

unread,
Sep 9, 2018, 11:06:20 AM9/9/18
to PHP Desktop
for the "file not found" issue:

in my installation I have to add

extension=php_mbstring.dll

in my php.ini inside PhpDesktop folder /php/
(only tested in phpdesktop-chrome-57.0-rc-php-7.1.3 + mPDF 7.1.1 )

hope this help.

bunt...@gmail.com

unread,
May 11, 2020, 10:17:53 AM5/11/20
to PHP Desktop
my php also sir pdf error pls send ur mail id
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages