Hi to everyone,
I have a problem with the PdfDictionary, I insert in a PdfDictionary a value
using this class that I have found on internet
public class DocumentPieceInfo
{
static PdfName PIECE_INFO = new PdfName("PieceInfo");
static PdfName LAST_MODIFIED = new PdfName("LastModified");
static PdfName PRIVATE = new PdfName("Private");
void addPieceInfo(FileOutputStream os, PdfReader reader, PdfName app,
PdfName name, PdfObject value) throws IOException
{
PdfDictionary catalog = reader.getCatalog();
PdfDictionary pieceInfo = catalog.getAsDict(PIECE_INFO);
if (pieceInfo == null)
{
pieceInfo = new PdfDictionary();
catalog.put(PIECE_INFO, pieceInfo);
}
PdfDictionary appData = pieceInfo.getAsDict(app);
if (appData == null)
{
appData = new PdfDictionary();
pieceInfo.put(app, appData);
}
PdfDictionary privateData = appData.getAsDict(PRIVATE);
if (privateData == null)
{
privateData = new PdfDictionary();
appData.put(PRIVATE, privateData);
}
appData.put(LAST_MODIFIED, new PdfDate());
privateData.put(name, value);
}
PdfObject getPieceInfo(PdfReader reader, PdfName app, PdfName name)
{
PdfDictionary catalog = reader.getCatalog();
PdfDictionary pieceInfo = catalog.getAsDict(PIECE_INFO);
if (pieceInfo == null)
return null;
PdfDictionary appData = pieceInfo.getAsDict(app);
if (appData == null)
return null;
PdfDictionary privateData = appData.getAsDict(PRIVATE);
if (privateData == null)
return null;
return privateData.get(name);
}
}
But with this method if I close the program and I re-open for read the
PdfDictionary in PDF file, the Dictionary that I have insert whit method
"addPieceInfo" there isn't.
--
View this message in context:
http://itext-general.2136553.n4.nabble.com/Insert-custom-dictionary-in-pdf-file-tp4659026.html
Sent from the iText - General mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies
and advance your career. Get an incredible 1,500+ hours of step-by-step
tutorial videos with LearnDevNow. Subscribe today and save!
http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk
_______________________________________________
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