I tried the following code. 
The metadata gets added correctly but i noticed the follg:

1) The contents of the file are now gone. The PDF still has the same # of pages but 
pages are all empty.
2) The size of the PDF is about the same. 
3) When i opened the PDF in Notepad, I found that the modified PDF has readable 
characters (ascii) while the original PDF contained non-printable
characters. Is it possible that I might have missed setting some Encoding while 
writing the PDF back with the PdfStamper ?

Thanks in advance. Any help will be greatly appreciated.

Kishore

-----Original Message-----
From: Paulo Soares [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 19, 2003 2:53 AM
To: 'Kishore Subramanian'; '[EMAIL PROTECTED]'
Subject: RE: [iText-questions] Modifying Metadata


Matt's thread was about the xml metadata not the metadata that goes into the
Info dictionary. Use something like this:

PdfReader reader = new PdfReader("my original.pdf");
HashMap meta = reader.getInfo(); // the original metadata
PdfStamper stp = new PdfStamper(reader, new FileOutputStream("my
modification.pdf"));
// change meta to suit your needs.
stp.setMoreInfo(meta); // check the javadoc! It's not a replacement.
stp.close();


Best Regards,
Paulo Soares


> -----Original Message-----
> From: Kishore Subramanian [SMTP:[EMAIL PROTECTED]
> Sent: Wednesday, March 19, 2003 1:55
> To:   '[EMAIL PROTECTED]'
> Subject:      [iText-questions] Modifying Metadata
> 
> Hi,
>  
> Iam facing a problem where I need to modify the metadata (for instance,
> the "Keywords") of an existing PDF file without making any other
> modifications to this PDF file. I need to do this in Java. 
>  
> I found the iText API very intuitive to set the meta data on a new PDF
> file. But I was not able to find a way to perform the same on an existing
> PDF file. I saw a thread in this mailing list (from Matt).
>  
> Can someone pls explain how I can do this with iText (.97 version) ? Any
> help (sample code) will be greatly appreciated.
> 
> Thanks, 
> 
> Kishore Subramanian 
> Agile Software 
> 
>  


-------------------------------------------------------
This SF.net email is sponsored by: Does your code think in ink? 
You could win a Tablet PC. Get a free Tablet PC hat just for playing. 
What are you waiting for?
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr5043en
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to