HTML2PDF -> Convert is failing with no errors or output available

I have attached my VERY BASIC sample code to this message. I have verified the HTML is fine but so debugging sake I have reduced it to the VERY simple string below. When I run this code, I get the following error :

Fatal error: PDFNet: An error occurred during linearization: The document contains no pages. in [FULL_PATH_REDACTED]/pdfnet/PDFNetPHP.php on line 15469

I know this is not complex or even reliable, I am just trying to get a Proof of Concept working. Is there a log I can look at or any other kind of output to understand what is happening?


$doc = new PDFDoc();
$converter = new HTML2PDF();

$html = “




// Add html data
$converter->InsertFromHtmlString( $html );
// Note, InsertFromHtmlString can be mixed with the other Insert methods.
$converter->Convert( $doc );

$this->log( 'REPORTS :: Convert - ’ . $converter->GetHTTPErrorCode() , LOG_DEBUG );

$doc->Save($output_path.’/’.$filename, SDFDoc::e_linearized);



Hi Todd.

Which OS are you running? Is it 64bit?

Also, you can call $converter->GetLog() after calling $converter->Convert(). Also Convert() returns false on failure.

Hi, I’m facing the same problem.

I’m testing the PHP Sample in the wrapers repository.

My code:

$html_sample = "<html><body><h1>Heading</h1><p>Paragraph.</p></body></html>";

$doc = new \PDFDoc();

$converter = new \HTML2PDF();



echo $converter->GetLog();

$doc->Save($output_path, \SDFDoc::e_linearized);




  An error occurred during linearization: Exception:
         Message: The document contains no pages.
         Conditional expression: itr != end
         Version      : 9.1.0-f7d9a24
         Platform     : Linux
         Architecture : AMD64
         Filename     : Linearization.cpp
         Function     : LinearizeObjects
         Linenumber   : 1316