PHP HTML to PDF conversion proportionally [closed]

北战南征 提交于 2019-12-01 14:51:41
halfer

How to do this? There are several approaches, but you must be willing to do your own research. You can paint PDFs in a variety of ways:

  • using graphics primitives in PHP libraries such as FPDF and TCPDF
  • using reporting software with document templates, such as JasperReports (requires server root access)
  • by converting from HTML, say via wkhtmltopdf (free) or Prince (expensive)
  • by manipulating SVG and rendering it to PDF, say in Inkscape (I've not seen other people taking this approach, but I have a working demo - see here. Only recommended if you are comfortable manipulating XML programmatically)

Remember that to get hi-res output (300-600pdi) on paper, you need to use proper fonts or vector graphics. These render at the resolution required, and won't pixellate if you use them properly. Failing this, use bitmaps at the correct resolution, so if you have a 1200px square image, and you wish to print at 600pdi, then the image cannot be larger than 2 inches either side.

In general it is best not to rely on third-party conversion services unless you have a contract with them - since they can take their site down or deny access at any time, and your work would be wasted.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!