开发者

DOMPDF PDF file fails to open in Adobe when using basic HTML tags

开发者 https://www.devze.com 2023-02-09 08:18 出处:网络
I am trying to generate some VERY simple PDFs based on some simple HTML output. My basic structure of expected output is:

I am trying to generate some VERY simple PDFs based on some simple HTML output. My basic structure of expected output is:

Category Name 1
 [Product Image 1] Product Name 1
 [Product Im开发者_如何转开发age 2] Product Name 2
Category Name 2
 [Product Image 3] Product Name 3

I can generate some very basic PDFs fine (I'm using DOMPDF 0.5) from my HTML. For example, a PDF with the content 'test' exports fine.

However, as soon as I try to insert even the slightest HTML markup, the PDF exports but no longer opens in Adobe Acrobat, instead giving the error:

'Adobe Reader could not open filename.pdf because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded).

Has anyone had a similar problem? It seems sometimes I can get the file to open with tags like <h1>test</h1> but generating a file with <p>pargaraph</p> would fail. Is there any solution or are there any better alternatives to using DOMPDF (provided the solution can be used on a shared hosting environment).

Cheers


Problem is with your PHP version. It doesn't support "set_magic_quotes_runtime", and your PDFs are basically being overwritten with php error.

You can either suppress PHP error or put "@" in front of calls to set_magic_quotes_runtime in lib/class.pdf.php

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号