mkl-public / testarea-pdfbox2

Test area for public PDFBox v2 issues on stackoverflow etc

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to modify form object stream?

zhongguogu opened this issue · comments

https://github.com/mkl-public/testarea-pdfbox2/blob/master/src/test/java/mkl/testarea/pdfbox2/content/RemoveText.java#L49
`
public void processForm(PDFormXObject form) throws IOException {

    final PDStream formContentStream = form.getContentStream();
    final PDResources resources = form.getResources();
    formReplacementStream=formContentStream.createOutputStream(COSName.FLATE_DECODE);
    formReplacement = new ContentStreamWriter(formReplacementStream);
    super.showForm(form);

}

`
how to update the PDFormXObjects' stream?

"Indeed, I would create a new form XObject and replace the reference to the old one in the page resources by a reference to the new one"

commented

Please share an example PDF for testing that.

commented

Closing due to missing response