Programmatically find and replace PDF text

I am trying to create a web script that will allow me to modify downloaded PDF templates and re-render them. I already tried Zend, which allows me to write to PDF, but that means I need to leave the PDF blank in a specific space, which is primitive for what I need. PDFFlip was no better.

We need to implement functionality so that we can remove content from a PDF, as well as delete and replace. I looked at CAM :: PDF and changepagestring.pl, but I'm not sure before work. It was hard for me to find real use cases, and Perl is not the language I used before.

This is for a web project, but I am flexible about the language we use, ideally PHP or ASP.NET C # would be great. It is advisable not Java if there is no other way.

I should also note that I looked through the FoxitReader SDK without any luck. I never tried to implement this, but I did not find any mention of finding and replacing similar functions.

+4
source share
2 answers

You can draw using PDF text, but it's not easy to find and replace. The text is designed as the format of the final file, which is not intended for simple editing. I wrote a blog post explaining some issues at http://pdf.jpedal.org/java-pdf-blog/bid/12670/PDF-text

+2
source

Maybe it’s a better way to hold and fill out templates in a convenient format for editing? For instance. You can save your templates as Microsoft Word templates and then export them to PDF after filling. This thread may be useful along the way.

The PDF file format is not suitable for editing.

Another way could be to create your templates as PDF files containing form fields. In this case, filling out the form fields is a common and well-known task, and there are many pdf components for this.

+2
source

Source: https://habr.com/ru/post/1313713/


All Articles