使用 PHP 创建 PDF [英] Creating PDF's using PHP

查看:40
本文介绍了使用 PHP 创建 PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要做的是理想地从 HTML 代码创建 PDF.我找到了一个名为 dompdf 的课程,但我遇到了字体和分页符的问题.

What I am wanting to do is create a PDF ideally from HTML code. I found a class called dompdf but I'm having issues with font and page breaks.

有谁知道另一种脚本或什至更好的生成 PDF 文件的方法吗?

Does anyone know of another script or even a better way in general to generate PDF files?

我将 HTML 转换为 PDF 的原因是因为我希望有人使用 WYSIWYG 编辑器来创建内容并单击保存以生成他们的 PDF 文件...

The reason why I am converting HTML to PDF is because I want someone to use a WYSIWYG editor to create the contents and click save to generate their PDF file...

任何输入都将不胜感激

推荐答案

由于 PDF 和 HTML 的不同性质,您在尝试将 HTML 转换为 PDF 时总是必须做出一些妥协.

Due to the different nature of PDF and HTML you'll always have to make a few comprimises when trying to convert HTML into PDF.

如果这不会太打扰您,我会开始使用 TCPD.它易于使用,并且对颜色、大小和其他一些与样式相关的 HTML 属性有很好的掌握.

If this doesn't bother you too much, I'd get started with TCPDF. Its easy to use and has a fairly good grasp of colors, sizes and some other style related HTML attributes.

这篇关于使用 PHP 创建 PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆