Good afternoon,
say (how) is it possible to set the Producer / Creator application
string in .pdf files with PDFTron's PDFNet SDK?
Cheers and thanks,
-J
Good afternoon,
say (how) is it possible to set the Producer / Creator application
string in .pdf files with PDFTron's PDFNet SDK?
Cheers and thanks,
-J
The simplest way to access document's metadata (e.g. author, title,
keywords, etc.) is using PDFDocInfo class. For example (in C#):
PDFDocInfo info = mydoc.GetDocInfo();
string title = info.GetTitle();
info.SetTitle("My Title");
etc...
You can also access document's metadata using SDF/Cos API:
PDFDoc doc = new PDFDoc(...);
doc.InitSecurityHandler();
Obj trailer = doc.GetTrailer(); // Get the trailer
Obj info = trailer.FindObj("Info");
if (info != null) {
// Get 'Title'/'Author'/'Keywords'/'Subject'...
// entry, if available
Obj title_obj = info.FindObj("Title");
if (title_obj != null)
{ // Note: In some documents these strings are encoded
// using PDF text encoding.
String title = title_obj.GetString();
title_obj.SetString("My Title...");
}
else {
info.PutString("Title", "My Title...");
}
}
say (how) is it possible to set the Producer / Creator application
string in .pdf files with PDFTron's PDFNet SDK?