Joel Morris wrote:
> We have thousands of PDF documents that we need to update the title on.
> Is this something we could use iText for? Basically, we are looking for
> a tool that could simply edit the title on an existing pdf document and
> save the document with the updated title.
Yes, no problem.
You need something like this:
PdfReader reader = new PdfReader(oldFile);
PdfStamper stamper = new PdfStamper(reader,
new FileOutputStream(newFile));
HashMap info = reader.getInfo();
info.put("Title", "The title was " + (String)info.get("Title"));
stamper.setMoreInfo(info);
stamper.close();
Write a loop, decide what you pass as oldFile
(a path to a file, a byte[], RandomAccessFileOrArray,...)
and choose your OutputStream (it doesn't have to be a
FileOutputStream).
br,
Bruno
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/