tonchik-tm / pdf-to-html

This PHP class can convert your pdf files to html using poppler-utils.
MIT License
54 stars 30 forks source link

Single page issue #8

Closed brunogoossens closed 7 years ago

brunogoossens commented 7 years ago

When you enable single page, the output of the html filename is different.

Now, you assume that the name is going to be filename-1.html, filename-2.html but if you set singlePage to true, you get filename-html.html

The following code returns an error. https://github.com/tonchik-tm/pdf-to-html/blob/886a2f87c5080ef6c933136b1ed9c3bb8d4b995a/src/Pdf.php#L150

brunogoossens commented 7 years ago

The commit didn't fix my issue. These are my settings:

        $settings = [
            'pdftohtml_path' => 'pdftohtml -nodrm',
            'pdfinfo_path' => 'pdfinfo',

            'generate' => [
                'singlePage' => true, // <-- this is important
                'imageJpeg' => false, 
                'ignoreImages' => false,
                'zoom' => 1,
                'noFrames' => true,
            ],

            'clearAfter' => true,
            'removeOutputDir' => true,
            'outputDir' => '/vagrant/test',

            'html' => [
                'inlineCss' => true,
                'inlineImages' => true,
                'onlyContent' => true,
            ]
        ];

        $pdf = new \TonchikTm\PdfToHtml\Pdf($file_path, $settings);
        $html = $pdf->getHtml()->getPage(1);