Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Mon Aug 24, 2015 1:15 pm

Hi,
I am currently evaluating Spire.PDF: The goal is to open an existing PDF document,
change the DocumentInformation and set some new Custom Attributes (which can be found on the "Custom" Tab when you the PDF properties in Adobe Reader.

Two Questions:
A) How can I set custom attributes?

B) I have tried to set the doc properties similar to the exosting example , but by opening an existing file, they do not show up.
What am I doing wrong?

//Create a pdf document.
PdfDocument doc = new PdfDocument();
doc.LoadFromFile(@"D:\temp\Input.pdf");



//set document info
doc.DocumentInformation.Author = "Harry Hu";
doc.DocumentInformation.Creator = "Harry Hu";
doc.DocumentInformation.Keywords = "pdf, demo, document information";
doc.DocumentInformation.Producer = "Myself";
doc.DocumentInformation.Subject = "Demo of Spire.Pdf";
doc.DocumentInformation.Title = "Document Information";

//file info
doc.FileInfo.CrossReferenceType = PdfCrossReferenceType.CrossReferenceStream;
doc.FileInfo.IncrementalUpdate = false;
doc.FileInfo.Version = PdfVersion.Version1_5;

//Save pdf file.
doc.SaveToFile(@"D:\temp\Properties.pdf");
doc.Close();
regards
Holger

holger.sachs
 
Posts: 2
Joined: Mon Aug 24, 2015 12:54 pm

Tue Aug 25, 2015 3:34 am

Hello,

Thanks for your inquiry.
I have noticed your issue. And I have posted the issue to our dev team. We will inform you when it is fixed. Sorry for the inconvenience.

Best Regards,
Sweety

E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Tue Aug 25, 2015 6:39 am

Thanky ou, what is about question A: Is it possible to set the custom properties ?
What would be the code for that ?

regards

Holger

holger.sachs
 
Posts: 2
Joined: Mon Aug 24, 2015 12:54 pm

Tue Aug 25, 2015 7:57 am

Hello,

Thanks for your reply.
A. So sorry that our product doesn't support this feature at this stage. We will consider adding it in our future upgrade.
B. please delete this line of code and try again.
Code: Select all
 doc.FileInfo.IncrementalUpdate = false;


Best Regards,
Sweety

E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Tue Sep 08, 2015 6:34 am

Hello,

Sorry to keep you waiting.
The new version of Spire.Pdf( Spire.PDF Pack(Hot Fix) Version:3.5.34 ) supported the feature you metioned has been released. Please download it and have a try.
The new version added the below new methods to manipulate the custom properties in PDF document.
Code: Select all
PdfDocument.DocumentInformation.SetCustomerDefined(string key,string value);
PdfDocument.DocumentInformation.RemoveCustomerDefined(string key);
PdfDocument.DocumentInformation.GetCustomerDefined(string Key);
PdfDocument.DocumentInformation.GetAllCustomerDefined();

And here is the sample code for your reference.
Code: Select all
PdfDocument doc = new PdfDocument();
doc.LoadFromFile(@"5660test.pdf");
doc.DocumentInformation.SetCustomerDefined("name", "sweety");
doc.DocumentInformation.SetCustomerDefined("company", "e-iceblue");
doc.DocumentInformation.RemoveCustomerDefined("company");
string name = doc.DocumentInformation.GetCustomerDefined("name");     
Dictionary<string, string> all = new Dictionary<string, string>();
all = doc.DocumentInformation.GetAllCustomerDefined();


Best Regards,
Sweety
E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Thu Sep 10, 2015 8:28 am

Hello,

Have you tried the Spire.PDF Pack(Hot Fix) Version:3.5.34 and the code?
Has your issues been resolved?
Thanks for your feedback.

Best Regards,
Sweety
E-iceblue support team
User avatar

sweety1
 
Posts: 539
Joined: Wed Mar 11, 2015 1:14 am

Return to Spire.PDF