开发者

PHP to edit PDF

I have some random PDF tha开发者_高级运维t I need to edit. And by edit, to replace an image and some text.

All of the PHP PDF libraries that I saw, create a PDF from scratch.

Is there a way to edit a page of the PDF by replacing images and text ?


There was another recent discussion on this: PHP PDF template library with PDF output? - There is no ready-made library for that.

While technically it's doable (PDF is actually a simple text based registry format, looked through specification once); the internal structure and encoding of text make it awfully difficult to locate and replace text. If you hardcode the object ids, and just create a new 25 1 obj revision for example, then a simple programmatic update might work. But neither FPDF nor TCPDF can do that AFAIK. (Look into FPDI import however.) And if you say you have some "random pdf" it's even less likely.

Try one of the format conversion methods (openoffice to pdf). You could manually convert PDF to OpenDraw probably, and after PHP-based editing convert it back. I'm very unsure if it brings usable results though.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜