PDF Export issue after Puppetter

PDF Export issue after Puppetter

Pdfexport fails after after upgrading to Puppetter from Phantom; We have had several customer tickets with an exception trace "Error in Exporting Data" and serverout log traces with:

Quote
java.lang.Exception: {"error":{"message":"An `executablePath` or `channel` must be specified for `puppeteer-core`","stack":"Error: An `executablePath` or `channel` must be specified for `puppeteer-core`\n    at assert (C:\\snapshot\\node_fies\\node_modules\\puppeteer-core\\lib\\cjs\\puppeteer\\util\\assert.js:18:15)\n    at ChromeLauncher.computeLaunchArguments (C:\\snapshot\\node_fies\\node_modules\\puppeteer-core\\lib\\cjs\\puppeteer\\node\\ChromeLauncher.js:102:36)\n    at async ChromeLauncher.launch (C:\\snapshot\\node_fies\\node_modules\\puppeteer-core\\lib\\cjs\\puppeteer\\node\\ProductLauncher.js:69:28)\n    at async C:\\snapshot\\node_fies\\index.js:150:25","statuscode":200}}


For this, there are several reasons, 

1.Server doesn't have an Internet connection to download chromium.

2. Server blocks below two URLs:

 a. https://storage.googleapis.com/ 

 b. https://npmmirror.com/


Steps to Resolve:


Step 1 : Download the appropriate pdfexport executable files from this link and extract the file contents in /ServiceDesk/custom/pdffolder/. Make sure to replace all existing files.

Step 2 :  Navigate to the /ServiceDesk/custom/pdffolder directory and run the executable with the following commands:


For Windows

Quote
pdfexport-win.exe "{\"options\":{\"init\":true,\"revision\":\"1370400\"}}"

For builds 15150/7750 and above (Windows):

Info
echo {"options":{"init":true,"manual":true,"revision":"1370400"}} | pdfexport-win.exe 
For Linux

Quote
./pdfexport-linux   "{\"options\":{\"init\":true,\"revision\":\"1370449\"}}" 

For builds 15150/7750 and above (Linux):

Info
echo '{"options":{"init":true,"manual":true,"revision":"1370449"}}' | ./pdfexport-linux 


You should receive a success message that includes the new Chromium executable path and a .pcr_stats.json file

Test PDF Export: After following the above steps, try exporting the reports again to see if the issue is resolved.


Note: 

Kindly check the alias URL in Admin> Advanced Portal Settings " Alias URL " this should be accessible from the server.  


Troubleshooting Guide – PDF Export Issues  

LINUX OS  

1. Permission Denied Error  

Error:

java.io.IOException: Cannot run program ".../custom/pdffolder/pdfexport-linux": error=13, Permission denied

Cause:
The pdfexport-linux file does not have the required execute/read/write permissions.

Solution:
Grant the necessary permissions using:

chmod -R +rwx /servicedesk/custom/pdffolder/

After updating permissions, follow the steps mentioned in the help article again.


2. Chromium Launch Failure  

Error:

Unable to launch the Chromium browser

Cause:
This issue usually occurs when:

  • Required system libraries are missing, or

  • Antivirus/security tools are blocking execution

Steps to Diagnose:

  1. Identify missing libraries:

ldd $CHROMIUM_EXECUTABLE_PATH | grep "not found"

  1. Retrieve the Chromium executable path from:

cat /opt/manageengine/servicedesk/custom/pdffolder/.pcr-stats.json

  1. Install missing dependencies:

sudo apt install <package_name>

(Use the appropriate package manager based on your OS)


WINDOWS OS  

1. Incorrect PDF Export Setup  

Error:

java.io.IOException: Cannot run program ".../custom/pdffolder/pdfexport-win.exe": error=13, Permission denied

Issue:
pdfexport-win.zip is extracted as a folder instead of replacing its contents.

Symptoms:

Solution:

  • Extract the contents of pdfexport-win.zip

  • Copy and replace the files directly into:

  • /servicedesk/custom/pdffolder

  • Ensure there is no nested pdfexport-win folder

  • The final folder structure should contain the files directly, not inside another folder

 

2. Chromium Launch Failure  

Error:

Unable to launch the Chromium browser

Issue:
pdfexport-win.exe  does not have read , write permission or blocked antivirus

Solution:

  • Check if antivirus is blocking the pdfexport-win.exe and try to unblock it

  • provide read,write,executable permission for pdfexport-win.exe