Hi, On Friday I attached a patch file to the JIRA issue (and I just uploaded an updated patch).
There are still some attributes (required and optional both) that are not supported by the various PDAnnotation implementations, but I think that is another issue. Kind regards, Johanneke Lamberink Op 17/4/15 12:40 schreef Maruan Sahyoun <[email protected]>: >Hi, >> Am 17.04.2015 um 12:14 schrieb Johanneke Lamberink >><[email protected]>: >> >> Hi, >> >> >> Op 17/4/15 11:43 schreef Maruan Sahyoun <[email protected]>: >> >>> Hi, >>> >>>> Am 16.04.2015 um 14:29 schrieb Johanneke Lamberink >>>> <[email protected]>: >>>> >>>> Hi >>>> >>>> Thank you. In the meantime, I have some code that would probably be >>>> helpful. What would be the best way to get my code in the API? >>>> >>> >>> still looking for your code :-) >> >> I haven’t had time to create a patch from my code, had to finish some >>work >> first. Hopefully I can do that today or this weekend :-) > >NP - just wanted to make sure that we don't do the same work twice. > >>> >>> with the latest changes to the current trunk you can now do >>> >>> PDDocument doc = PDDocument.load(new File("example-pdf.pdf")); >>> FDFDocument fdf = FDFDocument.loadXFDF(new >>> File("example-xfdf.xml")); >>> >>> List<FDFAnnotation> fdfAnnots = >>> fdf.getCatalog().getFDF().getAnnotations(); >>> >>> for (FDFAnnotation fdfAnnot : fdfAnnots) >>> { >>> PDPage page = doc.getPage(fdfAnnot.getPage()); >>> List<PDAnnotation> pageAnnots = page.getAnnotations(); >>> >>> >>>pageAnnots.add(PDAnnotation.createAnnotation(fdfAnnot.getCOSDictionary() >>>)) >>> ; >>> } >>> >>> >>> So that gives you at least some basic support. >> >> Thank you! > >You're welcome. Please be aware that importing FDF/XFDF many of the >attributes for specific annotation types are lost. So there is still some >work to do. In addition viewing the imported annotations might vary as >the appearance generation (the visual style when viewed) needs >enhancements too. > >BR >Maruan > >> >> Kind regards, >> >> Johanneke Lamberink >>> >>> BR >>> Maruan >>> >>> >>>> Kind regards, >>>> >>>> Johanneke Lamberink >>>> >>>> >>>> >>>> Op 16/4/15 14:15 schreef Maruan Sahyoun <[email protected]>: >>>> >>>>> Hi, >>>>> >>>>> I've created https://issues.apache.org/jira/browse/PDFBOX-2758 for >>>>>that >>>>> >>>>> BR >>>>> Maruan >>>>> >>>>> >>>>>> Am 15.04.2015 um 17:37 schrieb Johanneke Lamberink >>>>>> <[email protected]>: >>>>>> >>>>>> Hi, >>>>>> >>>>>> >>>>>> Op 15/4/15 11:45 schreef Maruan Sahyoun <[email protected]>: >>>>>> >>>>>>> Hi, >>>>>>> >>>>>>>> Am 15.04.2015 um 10:44 schrieb Johanneke Lamberink >>>>>>>> <[email protected]>: >>>>>>>> >>>>>>>> Hi, >>>>>>>> >>>>>>>> >>>>>>>> Thank you for replying. >>>>>>>> >>>>>>>> I did try using ImportXFDF. Unfortunately, this will only load the >>>>>>>> ³text² >>>>>>>> annotation and throws an IOException when any other annotation is >>>>>>>> encountered. >>>>>>>> >>>>>>> >>>>>>> could you upload a sample pdf and xfdf to a public location to >>>>>>>take a >>>>>>> look? >>>>>> >>>>>> I’ve made a .zip with 4 files, which you can download here: >>>>>> >>>>>> >>>>>> >>>>>>https://onior-my.sharepoint.com/personal/johanneke_lamberink_onior_co >>>>>>m/ >>>>>> _l >>>>>> ay >>>>>> >>>>>> >>>>>> >>>>>>outs/15/guestaccess.aspx?guestaccesstoken=9nNR9UdnjlmoU%2fHn9qhqXbT%2 >>>>>>b2 >>>>>> uW >>>>>> MR >>>>>> 5ar4CkFZjTb%2bbk%3d&docid=0f88504e606374b2fa948af871a8fb107 >>>>>> >>>>>> The files are a PDF file (example-pdf.pdf), an XFDF file >>>>>> (example-xfdf.xml), a screenshot of the annotations that I made >>>>>> (example.jpg) and a screenshot of the code used and the resulting >>>>>> output >>>>>> (example-output.png). >>>>>> >>>>>> Please let me know if you need more information :) >>>>>> >>>>>> Kind regards, >>>>>> >>>>>> Johanneke Lamberink >>>>>> >>>>>>> >>>>>>> BR >>>>>>> Maruan >>>>>>> >>>>>>>> >>>>>>>> Having had a look at the current trunk, I¹m not sure what the >>>>>>>> improvements >>>>>>>> should be. In the code regarding FDF/XFDF I don¹t see any >>>>>>>> significant >>>>>>>> changes. >>>>>>>> >>>>>>>> >>>>>>>> Kind regards, >>>>>>>> >>>>>>>> Johanneke Lamberink >>>>>>>> >>>>>>>> Op 14/4/15 18:15 schreef Andreas Lehmkuehler <[email protected]>: >>>>>>>> >>>>>>>>> Hi, >>>>>>>>> >>>>>>>>> Am 14.04.2015 um 15:06 schrieb Johanneke Lamberink: >>>>>>>>>> Hi, >>>>>>>>>> >>>>>>>>>> As part of a bigger application, I am trying to use PDFBox to >>>>>>>>>> combine >>>>>>>>>> a >>>>>>>>>> separate XFDF file containing annotations with a PDF document. >>>>>>>>>>The >>>>>>>>>> result should be a PDF document with annotations. >>>>>>>>>> >>>>>>>>>> Unless I'm mistaken, PDFBox has no support for parsing XFDF >>>>>>>>>> annotations >>>>>>>>>> at this time. Are there any plans to implement this? >>>>>>>>>> In an attempt to implement it myself, I have been parsing the >>>>>>>>>>XFDF >>>>>>>>>> file >>>>>>>>>> to create FDFAnnotation objects and then using those >>>>>>>>>>FDFAnnotation >>>>>>>>>> objects to create PDAnnotation objects. So far so good. However, >>>>>>>>>> the >>>>>>>>>> FDFAnnotation class and it's various subclasses for different >>>>>>>>>> annotations do not support the attributes that are required for >>>>>>>>>> specific >>>>>>>>>> annotations. >>>>>>>>>> A result of this is that I have to parse String input to PDFont >>>>>>>>>> and >>>>>>>>>> PDColorspace objects (for example), and I can't discover how to >>>>>>>>>>do >>>>>>>>>> this. >>>>>>>>>> >>>>>>>>>> For now, I have 3 questions: >>>>>>>>>> >>>>>>>>>> * how do I create a PDFont object from (for example) >>>>>>>>>>"/Helvetica >>>>>>>>>> 18 Tf" >>>>>>>>>> * how do I create a PDColorSpace object from (for example) >>>>>>>>>> "0.000 >>>>>>>>>> 0.000 0.000 rg" >>>>>>>>>> * What are your suggestions for continuing with my project. >>>>>>>>>> Continue working on my own solution, or implement support for >>>>>>>>>>XFDF >>>>>>>>>> annotations in PDFBox? Is anyone already working on this? >>>>>>>>>> >>>>>>>>>> Any help is greatly appreciated :) >>>>>>>>> I'm not a XFDF expert, but did you ever give >>>>>>>>> org.apache.pdfbox.tools.ImportXFDF >>>>>>>>> a try? Maybe that's the missing piece you are looking for ... >>>>>>>>> >>>>>>>>> P.S.: You should use the current trunk due to some recent >>>>>>>>> improvements >>>>>>>>> trageting >>>>>>>>> that specific area. >>>>>>>>> >>>>>>>>>> Johanneke Lamberink >>>>>>>>> >>>>>>>>> >>>>>>>>> BR >>>>>>>>> Andreas Lehmkühler >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>------------------------------------------------------------------ >>>>>>>>>-- >>>>>>>>> - >>>>>>>>> To unsubscribe, e-mail: [email protected] >>>>>>>>> For additional commands, e-mail: [email protected] >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>------------------------------------------------------------------- >>>>>>>>-- >>>>>>>> To unsubscribe, e-mail: [email protected] >>>>>>>> For additional commands, e-mail: [email protected] >>>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>>-------------------------------------------------------------------- >>>>>>>- >>>>>>> To unsubscribe, e-mail: [email protected] >>>>>>> For additional commands, e-mail: [email protected] >>>>>>> >>>>>> >>>>>> >>>>>> >>>>>>--------------------------------------------------------------------- >>>>>> To unsubscribe, e-mail: [email protected] >>>>>> For additional commands, e-mail: [email protected] >>>>>> >>>>> >>>>> >>>>> --------------------------------------------------------------------- >>>>> To unsubscribe, e-mail: [email protected] >>>>> For additional commands, e-mail: [email protected] >>>>> >>>> >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: [email protected] >>>> For additional commands, e-mail: [email protected] >>>> >>> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [email protected] >For additional commands, e-mail: [email protected] > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]

