Using iText to create PDF and Annotations can be hard at first. I learned it the hard way since it was my first time to take a crack into doing it. While this post does not provide the source code on how to do it (sorry, I am not giving it away for free but you can buy it from me), here are some tips to help get you started.

1) The coordinate system in PDF is different
I created an annotation layer in PDF.JS so I could create annotations on top of PDF pages. Naturally, I stored the annotation coordinates to keep track of its location. When I used the annotation data to create a PDF embedded with them, I was surprised that the positions were incorrect. It turned out the y-coordinate is actually from bottom to top instead of top to bottom. No worries though, you can create a function that will return the bottom-to-top y-coordinate based on your top-to-bottom y-coordinate. Bruno Lowagie actually provided a function for that in some StackOverflow forum post.

2) No SVG library for C# that iText can use to use as images
I created both a Java and C# implementation for this and I could not find a C# library that could let me use an SVG image in iText. Java has a 3rd party library for that though.

3) Do not get confused with Adobe Acrobat and Adobe Acrobat Pro’s comment window
Yes, I have to admit I got confused at first when I set all my comments to locked and read-only I thought that it did not work because the look and feel in Acrobat and Acrobat Pro looks different. If you have Acrobat Pro or Acrobat X, better use that to see your output PDF generated by iText as it gives a better presentation on how you set your annotations’ properties like locked and read-only.

4) If you used PDF.JS to save annotations and export them using iText, the page dimensions are different.
I created annotations using PDF.JS and its page dimensions at scale 100% are different in an actual PDF page when viewed in Acrobat. In order to position them correctly in a physical PDF file, create a function that will return the x and y coordinate of a physical PDF page’s dimension based from the PDF.JS annotation position and its page dimension. Sounds confusing? Here is a sample pseudo function with parameters.

5) Search in Google on how to create annotations using iText
Most annotation types (rectangle, circle, line, arrow, free text, free hand drawing, text underline, text strike-through, text highlight, stamp, icons) that my web application featured have samples provided by Bruno Lowagie in his iText documentation website and StackOverflow forum.

6) Converting to Java, C# or vice-versa is not hard
Once you implemented code using Java or C#, it is not hard to do considering most if not all of the classes are the same. It is just a matter of renaming some naming conventions on properties and methods

I was disappointed when I tried to view my house plan using Adobe PDF Reader in my Android phone because now all details were displayed. There were lines on the side that were hidden. Considering that Adobe made the PDF format quite famous, one would think there would be no problems loading them.

In the iOS, it is ok but in Android it does not. So I had to look for other alternatives. ezPDF Reader while not free actually displayed every detail of the PDF file that I wanted to look into. So now, this is my official PDF reader app for my Android device.

If you think Adobe’s PDF Reader app displays some of your PDF files, you will come to a point where one of your PDF files does not get displayed correctly. There is a reason why some apps are paid and that is because they offer more powerful features than what a free app can give.

I give ezPDF Reader a thumbs up.

Oh boy. And I thought that Apple will be supporting Flash in the next o.s. update. I am sure that I read an article about that. If so, then what is up with Microsoft meeting up with Adobe executives to discuss how the two companies might work together to take on Apple in the mobile industry, as well as a possible acquisition of Adobe by Microsoft.

One source indicates that representatives of the two companies discussed Apple’s refusal to support the viewing of Flash content on its mobile devices and how a partnership between the companies might offer them additional leverage against Apple’s gains in the sector.

A second source reveals that executives revisited the possibility of an acquisition of Adobe by Microsoft, a proposal that happened several years ago but got junked because it brought possible antitrust issues. But with Apple and Google’s growth in the mobile industry, the two companies think this may be the best time to do it.

And as usual, with that rumor floating around, Adobe’s stock did rise up. Nice work ;).

Related Posts Plugin for WordPress, Blogger...