Search code examples
javablockxsl-foapache-fop

Searching for fo:block in PDF generated by Apache FOP 0.95


Is it possible to be found a fo:block id="id_1" in PDF generated by Apache FOP 0.95? The problem is that some data still missing during the preparation of *.fo. These data must somehow later be inserted into the generated PDF file.


Solution

  • Based on your comments, your question actually has no relation to XSL FO.

    I mean If it is posible to parse the pdf file and to replace the text of that block, programming in java

    You are asking can you replace text in an existing PDF with different text.

    The answer is almost definitely no. PDF is not a Word Processing format. It is a binary format that has byte offsets throughout. You cannot hope to do such a thing unless you have statically placed PDF Acroform fields and want to change the field values or you have PDF XFA Forms and wish to modify the XML that is inside.

    Only Adobe Reader supports even viewing XFA forms and many PDF viewers do not even support Acroforms.

    Some XSL FO tools support creating Acroforms. Nothing other than Adobe software supports creating XFA forms. Many Java libraries support manipulating these.

    However your question was:

    The problem is that some data still missing during the preparation of *.fo. The problem is that some data still missing during the preparation of *.fo. These data must somehow later be inserted into the generated PDF file.

    Certainly you can. Modify the *.fo file which is merely XML and insert the data you require inside it before processing to PDF. Why would you process an FO to PDF missing some data and then hope to insert data later, insert it before you process the FO. Or if you are using FO to create a static form and wish to stamp data into exact positions later on top of it, you can do that using FO. Just use the first PDF as a background for the second process where you stamp the data.