I'm apparently doing something wrong. I'm trying to append some content
directly to the page's existing content-stream (it's already formatted
with the correct operators & operands, because I removed it previously).
Not only is the updated content not being written, but my simple removal
of one docInfo property is also ineffective. However, a PDF [copy] is
being written, and no exceptions are being thrown.
Here's a snippet of the java method:
if (docinfo.containsKey("IP_Text")) {
String ipText = docinfo.get("IP_Text");
docinfo.remove("IP_Text");
PdfDictionary page = reader.getPageN(1);
PRStream stream =
(PRStream)page.getAsStream(PdfName.CONTENTS);
byte[] contentBytes = PdfReader.getStreamBytes(stream);
baos = new
ByteArrayOutputStream(contentBytes.length + ipText.length());
baos.write(contentBytes);
baos.write(ipText.getBytes());
baos.flush();
baos.close(); //unnecessary?
stream.setData(baos.toByteArray());
copy = new PdfStamper(reader, new
FileOutputStream(copyFilename));
copy.setMoreInfo(docinfo);
...
copy.close();
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
iText-questions mailing list
[email protected]
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