I tried the same with an FDF file. This time it was read successfully, but the annotations were not added:
Jun 22, 2017 5:08:46 PM org.apache.pdfbox.pdmodel.fdf.FDFAnnotation create WARNING: Unknown or unsupported annotation type 'Redact' Jun 22, 2017 5:08:46 PM org.apache.pdfbox.pdmodel.fdf.FDFAnnotation create WARNING: Unknown or unsupported annotation type 'Popup' On Thu, Jun 22, 2017 at 4:51 PM, Gilad Denneboom <gilad.denneb...@gmail.com> wrote: > I've encountered my first stumble-block... When I try to import my > Acrobat-generated XFDF file I get this exception: > > Exception in thread "main" java.io.IOException: Error: Header doesn't > contain versioninfo > at org.apache.pdfbox.pdfparser.FDFParser.parse(FDFParser.java:160) > at org.apache.pdfbox.pdmodel.fdf.FDFDocument.load(FDFDocument.j > ava:184) > at RedactClip.main(RedactClip.java:15) > > Any ideas? > > PS. I'm using PDFBox 2.0.6 > > > On Thu, Jun 22, 2017 at 3:02 PM, Gilad Denneboom < > gilad.denneb...@gmail.com> wrote: > >> Certainly! I'll give it a try and will post any updates here... Thanks >> for your help so far. >> >> On Thu, Jun 22, 2017 at 2:39 PM, Stoll, Matthias <matthias.st...@dxc.com> >> wrote: >> >>> Hi Gilad, >>> >>> Exactly - and there is a small code sample already from which you can >>> start (XFDFStamper.java) >>> >>> PDFBox team has improved their support of XFDF after that call and we >>> will try to contribute a bit in the future as there are still some smaller >>> issues/ restrictions. But we can already use it quite good. >>> >>> Is this code sample good enough for you to start with? >>> >>> Kind regards, >>> Matthias >>> >>> -----Original Message----- >>> From: Gilad Denneboom [mailto:gilad.denneb...@gmail.com] >>> Sent: Donnerstag, 22. Juni 2017 12:04 >>> To: users@pdfbox.apache.org >>> Subject: Re: Adding a Redaction annotation (without applying it) >>> >>> Yes, I'll be very happy to get some sample code... Is it related to this >>> issue? https://issues.apache.org/jira/browse/PDFBOX-3164 >>> >>> Thanks in advance! >>> >>> On Thu, Jun 22, 2017 at 11:52 AM, Stoll, Matthias < >>> matthias.st...@dxc.com> >>> wrote: >>> >>> > Hi Gilad, >>> > >>> > Yes - by "stamping" I mean applying the redactions (i.e. texts, boxes, >>> > arrows - everything that XFDF allows) onto the PDF and then exporting >>> > a new one. >>> > We do this as part of a rendering component for electronic files. >>> > Therefore we take 2 file: >>> > 1) the original PDF (unmodified) >>> > 2) the annotation file as XFDF >>> > Then we merge them together on the fly and give it to the viewing >>> > component as a readonly new temporary PDF document. >>> > >>> > XFDF is supported by Adobe and other viewers, i.e. Qoppa viewer and >>> > the Foxit Web Viewer also directly deal with XFDF as separate files. >>> > You give them both files and they merge it for display on the fly. >>> > When using PDF.js as a viewer or another component which natively does >>> > not support XFDF annotations, you might go the same way as we do - >>> > render on the fly. >>> > >>> > If you need some sample code ("XFDF stamping") to start with, we might >>> > be happy to help. >>> > Tilman and the PDFBox team were so kind to help us initially here, so >>> > we might help you now and give some knowhow back. >>> > >>> > Kind regards, >>> > Matthias >>> > >>> > -----Original Message----- >>> > From: Gilad Denneboom [mailto:gilad.denneb...@gmail.com] >>> > Sent: Donnerstag, 22. Juni 2017 10:53 >>> > To: users@pdfbox.apache.org >>> > Subject: Re: Adding a Redaction annotation (without applying it) >>> > >>> > Hi Matthias, >>> > >>> > Thanks for the info. >>> > What do you mean exactly by "stamping" the XFDF file, though? Do you >>> > mean just import it? Does that actually apply the redactions? >>> > >>> > Gilad >>> > >>> > On Thu, Jun 22, 2017 at 10:01 AM, Stoll, Matthias >>> > <matthias.st...@dxc.com> >>> > wrote: >>> > >>> > > Hi Gilad, >>> > > >>> > > One approach to do this is by forming redactions based on XFDF. If >>> > > you want to apply the XFDF based redactions permanently, you can >>> "stamp" >>> > > it later into the PDF. >>> > > Both is possible by using PDFBox. >>> > > >>> > > Kind regards, >>> > > Matthias >>> > > >>> > > -----Original Message----- >>> > > From: Gilad Denneboom [mailto:gilad.denneb...@gmail.com] >>> > > Sent: Donnerstag, 22. Juni 2017 09:47 >>> > > To: users@pdfbox.apache.org >>> > > Subject: Adding a Redaction annotation (without applying it) >>> > > >>> > > Hi all, >>> > > >>> > > Does anyone know if PDFBox supports adding Redaction annotations? If >>> > > so, is it a documented feature? Are there any code samples I could >>> use? >>> > > I'm not talking about applying them (actually redaction the >>> > > underlying contents), just creating them... Hopefully it's possible. >>> > > >>> > > Regards, Gilad. >>> > > >>> > >>> >> >> >