How to edit a PDF using iText - java

I need to delete a text in several PDF files, which is always at the same position. How to achieve this with iText?
I've tried to use the PdfStamper and draw a white filled rectangle over this. This was ok, but the text wasn't really deleted and each PDF Reader (Acrobta, Foxit, etc.) were able to mark the content (ctrl+a), copy and paste it.

Related

Move existing text PDF using pdfbox

I am new in PDFBOX, and I am trying to move text from a coordinate into another coordinate. is it possible to move an existing text?
here is my pdf screenshot.
enter image description here
I want to move B.

<xdr:absoluteAnchor> shape moves with DOCX4J in excel

I used docx4j for excel implementation.
By using code I drew text frame , then a table and then again a text frame.
I used xdr:absoluteAnchor instead of xdr:twoCellAnchor.
But i noticed that my last (3rd) text frame is moved slightly down.
Is there any way to avoid such shape auto re-placement(auto movement) ?
You should create a text frame in Excel which behaves as you wish, then create corresponding Java code, which you can do by feeding your sample xlsx into http://webapp.docx4java.org/OnlineDemo/PartsList.html
For more help, you'll need to add the XML to your question.

Itext PDF: adding image after text of dynamic length

I am using Itext pdf java library to generate pdf document.
Need to add an image to pdf page after some text snippet. As per current design, the first text will be added to pdf and later on based on the PdfPageEventHelper images will be added.
Now the problem is text snippet can be of any length. So while adding the image I need to provide x and y coordinates. How can I calculate that based on the length of text snippet on that page so that text and image don't overlap?

Extracting Images with PDFBox - Images being split into strips

I'm using PDFBox to extract the images out of a PDF. My code is based on the example provided by PDFBox, here.
However, some images are being extracted as a number of horizontal 'strips', i.e. a single image in the PDF is extracted as 5 (for example) images that need stitching back together to form the whole image.
Why is this happening, and how do I stop it happening so I can extract the full single image?

Add text and an alligned image to a ColumnText Itext

I am writing text from right to left.
how can i add an image at the end of the text (alligned nicely)?
The question isn't entirely clear.
The order of objects added to a Document is always respected, except in the case of Image objects. If an Image object doesn't fit the page, it can be forwarded to the next page, and other content can be added first. If you want to avoid this, use writer.setStrictImageSequence(true);
However: you're writing from Right to Left (probably in Hebrew), so the above doesn't apply, not the previous answer by Anshu. You can only use RTL in ColumnText and PdfPTable.
It's not clear what you want to do.
Do you want to add an Image at the bottom of the text? That's easy: just add the text first, then add the Image. Do you want to add an Image inline? In that case, you can wrap the Image in a Chunk as is done in this example: http://itextpdf.com/examples/iia.php?id=54
My interpretation is: you want to add the image at the bottom left, and you want the text to be added next to the image. That's more difficult to achieve. You'd need to add the Image and the text separately. Add the Image at an absolute position and add the text using 'irregular columns'. That is: ColumnText in text mode (as opposed to composite mode). For an example showing how to use irregular columns, see http://itextpdf.com/examples/iia.php?id=67

Categories

Resources