Editing PDF with XPDF (or with something else)

I would like to ask if it is possible to edit PDF files using the xpdf library , and if so, how? I suppose this is possible, but I could not find a tutorial or documentation for xpdf, so I have no idea :( I am also open to using another library if anyone has support for editing pdf . My only requirement for such the library is that it must be C ++ or at least C and must be cross-platform (Windows and Linux)

I only need basic editing of the pdf file, for example:

"this is the text in the pdf document" will be changed to "this is the text in pdf format "with a different text color.

Thanks for all your answers!

+3
source share
4 answers

That is why you understand what you are going into, “basic editing” of PDF content is almost always non-trivial.

The content of the page in PDF is represented by short RPN programs that are drawn on the page. This is a small language similar to PostScript in semantics, but without looping structures or function definitions (so there is no problem with stopping). In a normal world, your text on a page will be presented as follows:

BT /F1 12 Tf 72 720 Td (this is a text in a pdf document) Tj ET

which when translated into something more familiar:

BeginText();
SetFont(F1, 12.0);  // Font 1, 12.0 pt
TextMoveTo(72, 720);
ShowText("this is a text in a pdf document");
EndText();

So, in this case, you need to convert this to something like this:

BeginText();
SetFont(F1, 12.0);  // Font 1, 12.0 pt
TextMoveTo(72, 720);
ShowText("this is a ");
SetFont(F2, 12);
ShowText("text");
SetFont(F1, 12);
ShowText(" in a pdf document");
EndText();

which will be as follows:

BT /F1 12 Tf 72 720 Td (this is a ) Tj /F2 12 Tf (text) Tj /F1 12 Tf
( in a pdf document) Tj ET

in equivalent pdf. The problem is multiple:

  • ().
  • , ( ), ,
  • , .

3 - , , , , , , 70% . , , . PDF ( , troff), , , . , . , , , TJ, . ( ), . , (, )? , - ?

, Acrobat 1.0, , . - .

- - xpdf, , PDF PDF. PdfLib, , -, PDF-, , , , .

, , , . Atalasoft, , , PDF (, ). , , PDF . , - ( - ), PDF . PDF-, , 8 () 9 (), , .

+12

xpdf - PDF. PDF .

+2

Itext/ISHarp PDF ?

0

, Pdfedit . QT. PodoFo, , . PdfHummus.

, PDF, , , , . , - @plinth - , , .

0

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


All Articles