On 21/02/2012 18:14, AJ Weber wrote: > I'm apparently doing something wrong.
Your code is very strange. An outsider seeing the code out of context has no idea what you're trying to achieve. > 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). What makes you think this will result in valid PDF syntax? > Not only is the updated content not being written, Maybe it is written, but not visible when you open the file in Adobe Reader. > but my simple removal > of one docInfo property is also ineffective. What is the docInfo property? > 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"); What is docinfo? Is it a dictionary? What is "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()); What is ipText? Is it valid PDF syntax? Isn't it extremely dangerous to append a snippet of PDF syntax like this? What are you trying to achieve? > copy = new PdfStamper(reader, new > FileOutputStream(copyFilename)); > copy.setMoreInfo(docinfo); > ... > copy.close(); Aha, docinfo is a dictionary. More specifically: metadata. You're using a method to add more metadata in an attempt to remove metadata... Also: you are adding some existing metadata to the content stream of a page. I have no clue about what you're trying to achieve. I only have an opinion: what you're doing is dangerous. I wouldn't do it. ------------------------------------------------------------------------------ Virtualization & Cloud Management Using Capacity Planning Cloud computing makes use of virtualization - but cloud computing also focuses on allowing computing to be delivered as a service. http://www.accelacomm.com/jaw/sfnl/114/51521223/ _______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net 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