Hi all.
I’m running pdf2htmlEX on a server, calling it from a PHP script using the Symfony Process module. The code looks like this:
$setLibPath = 'export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH';
$destDir = '/some/path;
$pdfFileName = '/some/path/file.pdf';
$outputFileName = 'file.html';
$runPdf2html = "pdf2htmlEX --fit-width 720 --dest-dir '$destDir' '$pdfFileName' '$outputFileName'";
$proc = new Process("$setLibPath; $runPdf2html");
$proc->setTimeout(600);
$proc->mustRun();
The $setLibPath command is necessary as I didn’t add it to the web server user’s path.
In any case, this script works fine for small files, but when running this command on a PDF file with a lot of images, the output HTML file becomes truncated. The HTML file ends abruptly in the middle of the final page content, with no closing tags or anything; obviously this renders the document unusable.
There seems to be no output from pdf2htmlEX indicating an error. Running the same command from the command-line on the server creates a fully-formed HTML file with no issues. It seems there’s some problem running it as a subprocess from PHP, but I have no idea where to look.
When I run pdf2htmlEX with --debug 1, I see this output:
temporary dir: /tmp/pdf2htmlEX-czhqIE
Preprocessing: 4/4
Add new temporary file: /tmp/pdf2htmlEX-czhqIE/__css
Add new temporary file: /tmp/pdf2htmlEX-czhqIE/__outline
Add new temporary file: /tmp/pdf2htmlEX-czhqIE/__pages
Add new temporary file: /tmp/pdf2htmlEX-czhqIE/bg1.png
Add new temporary file: /tmp/pdf2htmlEX-czhqIE/bg2.png
Add new temporary file: /tmp/pdf2htmlEX-czhqIE/bg3.png
Add new temporary file: /tmp/pdf2htmlEX-czhqIE/bg4.png
Working: 4/4
Remove temporary file: /tmp/pdf2htmlEX-czhqIE/__css
Remove temporary file: /tmp/pdf2htmlEX-czhqIE/__outline
Remove temporary file: /tmp/pdf2htmlEX-czhqIE/__pages
Remove temporary file: /tmp/pdf2htmlEX-czhqIE/bg1.png
Remove temporary file: /tmp/pdf2htmlEX-czhqIE/bg2.png
Remove temporary file: /tmp/pdf2htmlEX-czhqIE/bg3.png
Remove temporary file: /tmp/pdf2htmlEX-czhqIE/bg4.png
Remove temporary directory: /tmp/pdf2htmlEX-czhqIE
Any advice would be much appreciated. I’d appreciate knowing if there’s somewhere I should be looking, or debugging steps to take that I’m not. I can also provide a sample document and standalone script if anyone wants to try to reproduce this.
Cheers,
Daniel