|
I've created a PDF using iText itextpdf-5.1.3 and added an annotation by way of PdfAnnotation.createInk.
The annotation shows up fine on a windows/acrobat machine and also on EZPDF reader on Android. The annotation DOES NOT display on 2 different versions of Ubuntu. Can someone please confirm that they can see annotations on Ubuntu(or other Linux distros) made with the createInk method? Thanks |
|
What viewer on Ubuntu? Adobe Reader? Xpdf? Poppler? Other?
-----Original Message----- From: Rob [mailto:[hidden email]] Sent: Friday, January 13, 2012 10:56 AM To: [hidden email] Subject: [iText-questions] createInk not displaying in PDF on Ubuntu Linux I've created a PDF using iText itextpdf-5.1.3 and added an annotation by way of PdfAnnotation.createInk. The annotation shows up fine on a windows/acrobat machine and also on EZPDF reader on Android. The annotation DOES NOT display on 2 different versions of Ubuntu. Can someone please confirm that they can see annotations on Ubuntu(or other Linux distros) made with the createInk method? Thanks -- View this message in context: http://itext-general.2136553.n4.nabble.com/createInk-not-displaying-in-PDF-on-Ubuntu-Linux-tp4292565p4292565.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ RSA(R) Conference 2012 Mar 27 - Feb 2 Save $400 by Jan. 27 Register now! http://p.sf.net/sfu/rsa-sfdev2dev2 _______________________________________________ iText-questions mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php ------------------------------------------------------------------------------ RSA(R) Conference 2012 Mar 27 - Feb 2 Save $400 by Jan. 27 Register now! http://p.sf.net/sfu/rsa-sfdev2dev2 _______________________________________________ iText-questions mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php |
|
Ubuntu 9.04 64bit / Document Viewer(Evince) 2.26.1 using poppler 0.10.5 (cairo)
Ubuntu 9.04 64bit / Open Office 3.0.1 Ubuntu 9.04 64bit / Xournal 0.4.2.1 Ubuntu 10.04 32bit / Document Viewer 2.30.3 using poppler/cairo (0.12.4) |
|
I would assume that those viewers don't support that annotation type.
-----Original Message----- From: Rob [mailto:[hidden email]] Sent: Friday, January 13, 2012 11:17 AM To: [hidden email] Subject: Re: [iText-questions] createInk not displaying in PDF on Ubuntu Linux Ubuntu 9.04 64bit / Document Viewer(Evince) 2.26.1 using poppler 0.10.5 (cairo) Ubuntu 9.04 64bit / Open Office 3.0.1 Ubuntu 9.04 64bit / Xournal 0.4.2.1 Ubuntu 10.04 32bit / Document Viewer 2.30.3 using poppler/cairo (0.12.4) -- View this message in context: http://itext-general.2136553.n4.nabble.com/createInk-not-displaying-in-PDF-on-Ubuntu-Linux-tp4292565p4292649.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ RSA(R) Conference 2012 Mar 27 - Feb 2 Save $400 by Jan. 27 Register now! http://p.sf.net/sfu/rsa-sfdev2dev2 _______________________________________________ iText-questions mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php ------------------------------------------------------------------------------ RSA(R) Conference 2012 Mar 27 - Feb 2 Save $400 by Jan. 27 Register now! http://p.sf.net/sfu/rsa-sfdev2dev2 _______________________________________________ iText-questions mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php |
|
They do indeed support that type.
I have found that if I open the pdf in EZPDF reader on my android device and then save it. It 'fixes' the pdf and the annotations display in all the said Ubuntu viewers. On closer inspection, by exporting xfdf files and comparing, it would seem that the ink tag written by iText is missing subject, createddate and date attributes. These are added by EZPDF when I open and then resave. Might this be the reason the annotations are ignored and if so, is there a way to add these properties via iText? |
|
Except that all those are optional attributes.
-----Original Message----- From: Rob [mailto:[hidden email]] Sent: Friday, January 13, 2012 3:17 PM To: [hidden email] Subject: Re: [iText-questions] createInk not displaying in PDF on Ubuntu Linux They do indeed support that type. I have found that if I open the pdf in EZPDF reader on my android device and then save it. It 'fixes' the pdf and the annotations display in all the said Ubuntu viewers. On closer inspection, by exporting xfdf files and comparing, it would seem that the ink tag written by iText is missing subject, createddate and date attributes. These are added by EZPDF when I open and then resave. Might this be the reason the annotations are ignored and if so, is there a way to add these properties via iText? -- View this message in context: http://itext-general.2136553.n4.nabble.com/createInk-not-displaying-in-PDF-on-Ubuntu-Linux-tp4292565p4293265.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ RSA(R) Conference 2012 Mar 27 - Feb 2 Save $400 by Jan. 27 Register now! http://p.sf.net/sfu/rsa-sfdev2dev2 _______________________________________________ iText-questions mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php ------------------------------------------------------------------------------ RSA(R) Conference 2012 Mar 27 - Feb 2 Save $400 by Jan. 27 Register now! http://p.sf.net/sfu/rsa-sfdev2dev2 _______________________________________________ iText-questions mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php |
|
It may be that these attributes are not related to the problem, but id like to rule them out if possible.
Is iText capable of adding any of these optional attributes? |
|
It now appears that other annotation types are also not displaying in Ubuntu viewers.
Here's some code I've written that creates a file called pdf.test. It writes 'TEST' in capitals and then adds a large diagonal line (PdfAnnotation.createLine) next to it. Ubuntu viewers are displaying only the text. Can someone please confirm whether they see both the text (TEST) and the diagonal line on Ubuntu or other Linux Distro. Thanks. import java.io.*; import com.itextpdf.text.pdf.*; import com.itextpdf.text.*; public class test { public static void main(String arg[])throws Exception { Document document=new Document(); PdfWriter writer = PdfWriter.getInstance(document,new FileOutputStream("test.pdf")); document.open(); document.add(new Paragraph("TEST")); Rectangle rect = new Rectangle(119.0f,579.0f,354.0f,778.0f); PdfAnnotation annotation = PdfAnnotation.createLine(writer, rect, "", 120.0f, 580.0f, 353.0f, 777.0f); writer.addAnnotation(annotation); document.close(); } } |
|
It may be that those viewers can't create the
appearance as Acrobat does. You may create it with iText but you'll have to do
it yourself.
Paulo
------------------------------------------------------------------------------ RSA(R) Conference 2012 Mar 27 - Feb 2 Save $400 by Jan. 27 Register now! http://p.sf.net/sfu/rsa-sfdev2dev2 _______________________________________________ iText-questions mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php |
|
It's strange that after resaving the file in something like ezpdf/android or pdf-exchange-viewer/windows the Ubuntu viewers display everything as intended. The only difference I can see from exporting an xfdf file is that the ink tag has been given a 'date' attribute which the initial iText save doesn;t add.
Can you please elaborate on what you mean by an 'appearance'. Is this something I can control manually via iText methods? |
|
It probably also has a /A key. It would be helpful
to post both PDFs.
Paulo
------------------------------------------------------------------------------ RSA(R) Conference 2012 Mar 27 - Feb 2 Save $400 by Jan. 27 Register now! http://p.sf.net/sfu/rsa-sfdev2dev2 _______________________________________________ iText-questions mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php |
Attached test.pdf test-resaved.pdf |
|
It's missing the appearance (the /AP key). Create
the annotation in Acrobat, look at the PDF generated and reproduce it with
iText. I found out long ago that this is the only reliable way to have them
work.
Paulo
------------------------------------------------------------------------------ RSA(R) Conference 2012 Mar 27 - Feb 2 Save $400 by Jan. 27 Register now! http://p.sf.net/sfu/rsa-sfdev2dev2 _______________________________________________ iText-questions mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php |
That's great news! I see that the AP key in test-resaved.pdf is /AP<</N 10 0 R>> Looking at the available PdfAnnotation methods I can see that setAppearance is available. How would one recreate the above AP key with this method? |
|
Let's take the Line annotation. The annotation
parameters describe the line. You'll have to create a PdfTemplate with the
actual graphic representation of the line using moveTo(), lineTo() and
others.
Paulo
------------------------------------------------------------------------------ RSA(R) Conference 2012 Mar 27 - Feb 2 Save $400 by Jan. 27 Register now! http://p.sf.net/sfu/rsa-sfdev2dev2 _______________________________________________ iText-questions mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php |
I have limited experience with appearances in PDF. Initially I thought that the AP key was the only thing needed to make an annotation display in this instance. I've since been reading and am getting an idea that the AP key mentioned is just a pointer to a different section in the pdf referred to as an appearance which is a graphical representation of the original annotation. This is used in place of the annotation when a reader cannot render annotations from the basic vector info provided. Is this correct? If so, I am wondering whether I will be able to employ this solution as I'm still a little confused whether I can build this graphical representation from the original vector information or whether I need to manually create a pdf with AP included which I need to read from? (manual intervention would make attempts to script this process pointless). Considering another way forward, is iText capable of completely flattening the annotation so that it all becomes a rendered part of the main layer? I assume I would lose any separate annotation data but this is acceptable if it will create a document that displays as intended on the Ubuntu viewers. |
|
Do you really need an annotation or just something drawn on top of the content?
Paulo -----Original Message----- From: Rob [mailto:[hidden email]] Sent: Monday, January 16, 2012 2:03 PM To: [hidden email] Subject: Re: [iText-questions] createInk not displaying in PDF on UbuntuLinux Paulo Soares-3 wrote > > Let's take the Line annotation. The annotation parameters describe the > line. You'll have to create a PdfTemplate with the actual graphic > representation of the line using moveTo(), lineTo() and others. > I have limited experience with appearances in PDF. Initially I thought that the AP key was the only thing needed to make an annotation display in this instance. I've since been reading and am getting an idea that the AP key mentioned is just a pointer to a different section in the pdf referred to as an appearance which is a graphical representation of the original annotation. This is used in place of the annotation when a reader cannot render annotations from the basic vector info provided. Is this correct? If so, I am wondering whether I will be able to employ this solution as I'm still a little confused whether I can build this graphical representation from the original vector information or whether I need to manually create a pdf with AP included which I need to read from? (manual intervention would make attempts to script this process pointless). Considering another way forward, is iText capable of completely flattening the annotation so that it all becomes a rendered part of the main layer? I assume I would lose any separate annotation data but this is acceptable if it will create a document that displays as intended on the Ubuntu viewers. -- View this message in context: http://itext-general.2136553.n4.nabble.com/createInk-not-displaying-in-PDF-on-Ubuntu-Linux-tp4292565p4299563.html Sent from the iText - General mailing list archive at Nabble.com. ------------------------------------------------------------------------------ RSA(R) Conference 2012 Mar 27 - Feb 2 Save $400 by Jan. 27 Register now! http://p.sf.net/sfu/rsa-sfdev2dev2 _______________________________________________ iText-questions mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php ------------------------------------------------------------------------------ RSA(R) Conference 2012 Mar 27 - Feb 2 Save $400 by Jan. 27 Register now! http://p.sf.net/sfu/rsa-sfdev2dev2 _______________________________________________ iText-questions mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php |
|
In reply to this post by Rob
All of the pieces you need are in iText - they are just LOW LEVEL pieces
that you will need put together to make this work. You'll need to start by reading and understanding the PDF standard (ISO 32000-1:2008) about exactly what an appearance stream is, how it is used, etc. Then you can use the pieces in iText to create one, connect it up, and voila. NOT trivial - but certainly well defined and doable. Leonard On 1/16/12 6:02 AM, "Rob" <[hidden email]> wrote: > >Paulo Soares-3 wrote >> >> Let's take the Line annotation. The annotation parameters describe the >> line. You'll have to create a PdfTemplate with the actual graphic >> representation of the line using moveTo(), lineTo() and others. >> > >I have limited experience with appearances in PDF. Initially I thought >that >the AP key was the only thing needed to make an annotation display in this >instance. > >I've since been reading and am getting an idea that the AP key mentioned >is >just a pointer to a different section in the pdf referred to as an >appearance which is a graphical representation of the original annotation. >This is used in place of the annotation when a reader cannot render >annotations from the basic vector info provided. Is this correct? > >If so, I am wondering whether I will be able to employ this solution as >I'm >still a little confused whether I can build this graphical representation >from the original vector information or whether I need to manually create >a >pdf with AP included which I need to read from? (manual intervention would >make attempts to script this process pointless). > >Considering another way forward, is iText capable of completely flattening >the annotation so that it all becomes a rendered part of the main layer? I >assume I would lose any separate annotation data but this is acceptable if >it will create a document that displays as intended on the Ubuntu viewers. > >-- >View this message in context: >http://itext-general.2136553.n4.nabble.com/createInk-not-displaying-in-PDF >-on-Ubuntu-Linux-tp4292565p4299563.html >Sent from the iText - General mailing list archive at Nabble.com. > >-------------------------------------------------------------------------- >---- >RSA(R) Conference 2012 >Mar 27 - Feb 2 >Save $400 by Jan. 27 >Register now! >http://p.sf.net/sfu/rsa-sfdev2dev2 >_______________________________________________ >iText-questions mailing list >[hidden email] >https://lists.sourceforge.net/lists/listinfo/itext-questions > >iText(R) is a registered trademark of 1T3XT BVBA. >Many questions posted to this list can (and will) be answered with a >reference to the iText book: http://www.itextpdf.com/book/ >Please check the keywords list before you ask for examples: >http://itextpdf.com/themes/keywords.php ------------------------------------------------------------------------------ RSA(R) Conference 2012 Mar 27 - Feb 2 Save $400 by Jan. 27 Register now! http://p.sf.net/sfu/rsa-sfdev2dev2 _______________________________________________ iText-questions mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/itext-questions iText(R) is a registered trademark of 1T3XT BVBA. Many questions posted to this list can (and will) be answered with a reference to the iText book: http://www.itextpdf.com/book/ Please check the keywords list before you ask for examples: http://itextpdf.com/themes/keywords.php |
|
In reply to this post by Paulo Soares-3
If it's less involved, something drawn on top of the content would be fine. |
|
In reply to this post by Paulo Soares-3
Thanks Paulo, your reply made me focus on redrawing using PdfContentByte.moveTo and lineTo and I now have the vectors written directly on the document. I would have preferred annotations but this is an acceptable solution. An issue I am now trying to overcome is that the original annotations where fluid gestures using ink tags. Although the new drawings are x/y point accurate. There are hard edge due to the nature of lineTo. Is there a way to match the original smoothness of the inklist/gestures? |
| Powered by Nabble | Edit this page |
