Question on setting custom metadata in PDF

221 views
Skip to first unread message

Support

unread,
Jul 11, 2008, 1:41:23 PM7/11/08
to PDFTron PDFNet SDK
Q: I am wondering where the best place to insert metadata into a PDF
document is. That being a set of lat/lng values, that can be
extracted after the PDF has been converted to illustrator, worked on
and then back to PDF.?

----
A: You can place custom metadata at any location in the document. For
example, you could associate the custom data with a page as follows:

Obj cust_dict = mypage.GetSDFObj().PutDict("_MyCustomData");
cust_dict.PutNumber("Lat", num_lat);
cust_dict.PutNumber("Lng", num_lng);
...

From any 'high-level' PDF object (such as page, annotation, action,
font, bookmark, image, color-space, etc) you can access the low-level
SDF dictionary (or array) using GetSDFObj().

Similarly you can associate custom data with a document's catalog:

Obj cust_dict = pdfdoc.GetRoot().PutDict("_MyCustomData");
cust_dict.PutNumber("Lat", num_lat);
cust_dict.PutNumber("Lng", num_lng);
...

You could also place the data under more 'standard' locations (e.g.
Page/PieceInfo dictionary etc). For more info, please take a look at
Section 10.4 'Page-Piece Dictionaries' in PDF Reference.

For more examples, please take a look at SDF sample project which is
included as part of the SDK.
Reply all
Reply to author
Forward
0 new messages