RubyPDF Blog iText,Java,PDF How to run iText on Google App Engine

How to run iText on Google App Engine

Important update:

The last version itext-gae hosts at GitHub now, with many changes,

  • update to iText 4.2.0
  • fixs many bugs
  • supports Graphics2D now

Have applied Google App Engine (aka GAE) for a long time, recently I thought maybe I can build some PDF manipulation services on GAE, and I am familiar with iText, so I decide to try iText on GAE.

after some search, I got the following solution,

iText has dependencies on certain Java classes (java.awt.Color, java.nio.MappedByteBuffer etc.) which are ** not ** allowed by the Google
App Engine runtime .
Google App Engine throws an exception e.g “java.lang.NoClassDefFoundError: java.nio.MappedByteBuffer is a restricted class. Please see the Google App
Engine developer’s guide for more details.” is thrown for the unsupported class(es).
– Would it be possible to remove the dependency by iText on these Java classes, so as to enable the library to work within Google AppEngine?
See attached (very rough) Subversion patch file, for how I quickly removed some of the dependencies, so as to get iText to process a PDF form within
Google App Engine.

You can download the patch here,iText patch for GoogleAppEngine support.

And if you are very lazy, you can try directly download the modified version iText-2.1.7 (both jar and source)from here,

notice, iText-2.1.7-gae.jar forgot cmap_info.txt and glyphlist.txt, so if you directly use iText-2.1.7-gae.jar, you need add cmap_info.txt and glyphlist.txt to it first.

I have write two little demos and deployed them on my GAE home page, feel free to have a look here,
http://rubypdf.appspot.com(does not work now)

reference,
http://code.google.com/appengine/docs/java/jrewhitelist.html
iTextをGoogle App Engineから利用できるiText-gaeを公開しました
http://1t3xt.info/examples/browse/index.php

P.S.
Dec 21,2009, Release my first Google App Engine Application,Remove PDF Password Online, for introduce, please visit here.

7 thoughts on “How to run iText on Google App Engine”

  1. Hello

    I have a desktop java application that uses Itext to generate new PDF reports… I have a couple of questions for you-

    (1) can you share with me how you were able to create a new pdf (into which data was output from application)? Is it a file that is directly stored on end user’s computer? If you can share your code with me that would be great:)

    (2) I have some graphs in the report generated using JFREECHART… But that is not supported by Google App Engine. Can you create a workaround for JFREECHART, (similar to the one you have created for itext)? I am willing to create a commercial project for this as well (although I cant pay as well as an American or a European )…

    Regards,
    Arvind.

  2. Hello

    I see your post and i’m really interesting. I work in a project that use app engine and i need to encrypt pdf. I’m new in this world so if you can help me a little.
    How i can add cmap and glyphlist to the jar? I can encrypt pdf with modified version? thank you!

    Regards,

  3. Hello, really thanks for your fast response but i can’t work with the project. I don’t know how work with this, its a library? where i can encrypt pdf? i don’t understand. Thank you for help me!

    Reagards

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.