HTML to PDF Action - NodeJS & PHP [Open Source]

Hi Sid,
I think the extensions folder is enough to copy it under my project?
Is that correct?

Yes.

1 Like

I still can not export or create any pdf file. I tried lots of things like;

  • composer reinstall
  • vendor check
  • mpdf reinstall
  • tried different hmtl pages
  • tried different output paths
  • server restart
  • temp folder path change
  • tried to get pdf output (/html-to-pdf-php-master/index.php) - > generate PDF (canā€™t get any response)

I started to think that, my composer is not workingā€¦

Could you please tell me What else can I recheck?

Are you not seeing any errors being returned or any errors in PHP log file?

You could also try setting a ā€œdieā€ statement in the HTML to PDF PHP file at the topā€¦ to check if the file is even being called or not.
Then, start moving the die statement lower in the code to identify at which line the execution stops, before die is executed. I use such methods when logs donā€™t give complete error details.

Im very interested in trying out this module. Iā€™ve downloaded the module files. Do I simply upload the /extensions directory or are there other files which also need to be in the upload. Iā€™m concerned that those files will interfere with the most current versions of the files for Wappler 4.6x

Also not sure how to install composer and the mpdf files. Do I install composer locally or do I have to install this on the web server?

Thanks,
Rick

Yes. You need to install composer locally, and then install mpdf from terminal/cmd while on the project root folder. Once that is done, your project folder will have all files necessary to work on remote. So just make sure to upload the vendor folder along with other new files/folder.
You donā€™t have to install composer on web server.

Just the extensions folder and composer files/folder that get generated.

when I try to install composer locally it is asking me for the directory where my php.exe file is located. I only use php through Wappler so have no idea where that is. Is it in the Wappler installation files? Sorry for the dumb question. Iā€™m on a windows pc machine.

Thanks,
Rick

Do you not have WAMP or XAMP setup on your Windows machine to run/test the app locally?

If not, you will have to download PHP separately and then give that path to Composer.

Not at all. I had to learn it all as well.

Failed to load resource: the server responded with a status of 500 ()

-I tried reinstallation of composer.
-I tried installing composer inside and outside of the public_html and project folder.
-It work on my local.
-At remote side not works. seems like can not access vendor folder.

You just need to install composer on your local machine. Composer gets installed on the system, not for a particular project or folder.

Once you do that, go to the project root folder and run mdpf installation command. A few files & folders related to composer will get created in the project root folder.

In remote server, you just need to upload those files/folder.

I did everthing, no way.
As you said copied everything from local to remoteā€¦ still getting internal server error.

Error handling response: TypeError: self.processResponse is not a function
at chrome-extension://cmkdbmfndkfgebldhnkbfhlneefdaaip/js/notification.js:154:10
/dmxConnect/api/GeneratePDF.php:1 Failed to load resource: the server responded with a status of 500 (Internal Server Error)

Where are you seeing this error?

This says that your SA itself did not even execute. It failed at the very first line.

1 Like

I did reinsltall everything rom scratch, now working very fine.
I have an idea that, maybe we can develop a new module integrated to htmltopdf action like (report designer visual in future).
Thank you for your support.

I do not follow what you are proposing here. Can you please explain?

After reading docs, and a bit of trail and error I think I am almost there in order to get this action working.

Getting the following error and just not finding what is needed to fix:

{"status":"500","message":"Could not find expected browser (chrome) locally. Run npm installto download the correct Chromium revision (1036745).","stack":"Error: Could not find expected browser (chrome) locally. Runnpm install to download the correct Chromium revision (1036745).\n at ChromeLauncher.launch (/opt/node_app/node_modules/puppeteer/lib/cjs/puppeteer/node/ChromeLauncher.js:70:23)\n at async App.exports.ConvertToPDF (/opt/node_app/extensions/server_connect/modules/HtmlToPDF.js:72:21)\n at async App._exec (/opt/node_app/lib/core/app.js:491:30)\n at async App._exec (/opt/node_app/lib/core/app.js:458:17)\n at async App.exec (/opt/node_app/lib/core/app.js:427:9)\n at async App.exec (/opt/node_app/lib/modules/core.js:228:13)\n at async App._exec (/opt/node_app/lib/core/app.js:491:30)\n at async App.exec (/opt/node_app/lib/core/app.js:427:9)\n at async App.define (/opt/node_app/lib/core/app.js:417:9)"}

Donā€™t think you have installed puppeteer via npm correctly.
Try running the command in terminal. Also, hereā€™s a reference to running it in Docker.

thanks for feedback. My install for docker was done as per your post. did reinstall now and updated packages. same error unfortunately.

Just to confirm my point:

I think you are checking your local installation. With Docker, you need to SSH into the docker container, and check there.
Also, did you do a deploy after making changes to the dockerfile?

I have used this with docker numerous times, without any issues.
Maybe it could be an M1 issue: https://github.com/puppeteer/puppeteer/issues/8960

Did deploy.

Also added for M1:

ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true

I am at my wits end :sleepy: