December 24th, 2009
Nick Johnson said,
Currently, API calls are limited to 1MB, but requests and responses are limited to 10M. If you want to permit larger files, you could split them up into chunks and store them in the datastore. The 30 second request limit applies only to the time your code spends processing the request, not time sent receiving the request or sending the response.
A large file API is on our roadmap, which will make handling large files from users much easier.
I offer the UrlFetch function in my PDF Password Remover Online application, but I do not want to let it only manipulate no more 1M PDF, after some study, I got the solution, let UrlFetch API download no more 1M data each time, but repeat many times until all data downloaded, of course, there still a limit, 30 second request limit.
public static byte[] download(String url) throws IOException, InterruptedException {
ArrayList al=new ArrayList();
HttpURLConnection httpConn = null;
int seg=1024*1000;
int startPosition=0;
try {
URL u = new URL(url);
for(;;)
{
int endPosition=startPosition+seg;
httpConn = (HttpURLConnection) u.openConnection();
httpConn.setRequestMethod("GET");
httpConn.setRequestProperty("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14");
httpConn.setRequestProperty("Range", "bytes=" + startPosition + "-"+endPosition);
httpConn.connect();
InputStream in = httpConn.getInputStream();
byte[] b=Util.toByteArray(in);//IOUtils.toByteArray(in);
al.add(b);
startPosition+=b.length;
if(b.length
break;
}
ArrayList temp = new ArrayList();
for(byte[] b : al)
{
for (int i = 0; i
temp.add(b[i]);
}
}
return Util.saveBytesArrayListTobytesArray(temp);
} finally {
httpConn.disconnect();
}
}
Posted in tutorial | 1 Comment »
December 22nd, 2009
After made iText worked on Google App Engine, I built Another application, Remove PDF Password Online. It bases on iText 2.1.7 but with many modification.
the main features of pdfdecrypt online are,
- remove restrictions on any secured PDF document (you should have the right to do it, for example, if you forgot the password). Any Acrobat version up to 9 is supported, even with 128-bit AES or 128-bit RC4 encryption. PDF restrictions removal is an instant process. Unlocked file can be opened in any PDF viewer without any restrictions so you may edit/copy/print it.
- remove the PDF open password. Decryption of the file with password for opening is guaranteed for PDF files Any Acrobat version up to 9 is supported, even with 128-bit AES or 128-bit RC4 encryption,but you must know the password first.
It supports upload PDF documents from your disk and give a PDF url.
If you like it, just have a try now, it is free.
Posted in My Software, PDF, iText, iText in Action | 4 Comments »
December 17th, 2009
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
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.
Posted in Java, PDF, iText | 1 Comment »