We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

pdf file properties

Can anyone please suggest me how to find the properties of a pdf file in C# language. For ex, a user uploads a pdf file of 5 pages. how to find the font , format (pdf or pdf/a) and other various properties of that uploaded file.
will be very helpful if code snippet is provided.

Thanks.
Miran

9 Replies

PH Praveenkumar H Syncfusion Team October 27, 2015 06:04 AM UTC

Hi Miran,

Thank you for using syncfusion products,

You can get the various information from the PDF document by loading into the class “PdfLoadedDocument”, please refer the below code snippet.

PdfLoadedDocument doc = new PdfLoadedDocument("../../Data/sample.pdf");

//Get the used fonts from the document

PdfUsedFont[] usedFonts=doc.UsedFonts;

//get the conformance level of the document

PdfConformanceLevel conformance = doc.Conformance;

//Get the document information such document title,subject etc

PdfDocumentInformation information= doc.DocumentInformation;

For more information please refer the class reference of  PdfLoadedDocument”.

With Regards,
Praveen



MM mohammad miran replied to Praveenkumar H October 28, 2015 09:55 AM UTC

Hi Miran,

Thank you for using syncfusion products,

You can get the various information from the PDF document by loading into the class “PdfLoadedDocument”, please refer the below code snippet.

PdfLoadedDocument doc = new PdfLoadedDocument("../../Data/sample.pdf");

//Get the used fonts from the document

PdfUsedFont[] usedFonts=doc.UsedFonts;

//get the conformance level of the document

PdfConformanceLevel conformance = doc.Conformance;

//Get the document information such document title,subject etc

PdfDocumentInformation information= doc.DocumentInformation;

For more information please refer the class reference of  PdfLoadedDocument”.

With Regards,
Praveen


Hi Praveen ,

Thanks for your reply, it was helpful.
I am facing another issue that is while using the Syncfusion dlls in a separate console project it is giving me an error of assembly/dll not found. The dlls used are the same ones which are used in my project.
I wanted to do some POC stuff but not able to proceed.
Below is the error thrown at build time.
The type or namespace name 'Pdf' does not exist in the namespace 'Syncfusion' (are you missing an assembly reference?) 

Thanks
Miran


PH Praveenkumar H Syncfusion Team October 29, 2015 06:28 AM UTC

Hi Miran,

Thank you for your update,

Currently the Essential PDF doesn’t support the “.Net frame work with Client profile” so change this to “.Net framework” , refer the below screenshot.



Please try the above step and let me know the results.

With Regards,
Praveen


MM mohammad miran replied to Praveenkumar H October 29, 2015 01:52 PM UTC

Hi Miran,

Thank you for your update,

Currently the Essential PDF doesn’t support the “.Net frame work with Client profile” so change this to “.Net framework” , refer the below screenshot.



Please try the above step and let me know the results.

With Regards,
Praveen

Hi Praveen ,
Thanks for prompt reply. I was able to proceed with it. But however I am getting error in below line of code
PdfConformanceLevel conformance = doc.Conformance;
I am unable to get the conformance of the uploaded file i.e. whether the file is pdf or pdf/a. I am using version 9 of syncfusion dlls.
Also if a sample project can be made available for parsing the pdf and reading/modifying its properties and saving it.

Thanks
Miran


PH Praveenkumar H Syncfusion Team October 30, 2015 07:03 AM UTC

Hi Miran,

We are able to reproduce the issue “Exception occurs when getting conformance level from existing document”. We have logged a report on this and will fix the issue internally, also the fix will be included in our upcoming Vol 4 release, which has been scheduled to be rolled out in the end of December.

We have also created an incident internally to have a follow up with this issue.


Please find the attached sample for parsing and modifying the existing document.

http://www.syncfusion.com/downloads/support/forum/120901/ze/PdfFileTesting-1271588662.zip


Regards,

Praveen



MM mohammad miran replied to mohammad miran November 3, 2015 03:45 PM UTC

Hi Miran,

Thank you for your update,

Currently the Essential PDF doesn’t support the “.Net frame work with Client profile” so change this to “.Net framework” , refer the below screenshot.



Please try the above step and let me know the results.

With Regards,
Praveen

Hi Praveen ,
Thanks for prompt reply. I was able to proceed with it. But however I am getting error in below line of code
PdfConformanceLevel conformance = doc.Conformance;
I am unable to get the conformance of the uploaded file i.e. whether the file is pdf or pdf/a. I am using version 9 of syncfusion dlls.
Also if a sample project can be made available for parsing the pdf and reading/modifying its properties and saving it.

Thanks
Miran

Hi Praveen,

Thanks for the acknowledgement.
can you please put some highlight on the below issue-
while parsing a pdf file of 900 pages , time taken is 7 minutes where as when the same file when converted to pdf/a format and then parsed it takes 30 minutes. Is there any particular way for parsing a pdf/a file. Also let me know if using the higher versions of syncfusion dlls(for ex, 11.0,) will be beneficial for parsing pdf files in terms of time taken,features available and efficiency.

Thanks
Miran


PH Praveenkumar H Syncfusion Team November 4, 2015 07:05 AM UTC

Hi Miran,

Can you please share us the PDF/A document which has 900 pages, it will help us to investigate the reason for time taken.
We have improved and fixed the lot of bugs related to document parsing in the latest version, so the latest version is efficient than previous version of Essential PDF. We suggesting you to use latest version

Please let us know if you need further assistance.

With Regards,
Praveen


MM mohammad miran replied to Praveenkumar H November 9, 2015 03:45 PM UTC

Hi Miran,

Can you please share us the PDF/A document which has 900 pages, it will help us to investigate the reason for time taken.
We have improved and fixed the lot of bugs related to document parsing in the latest version, so the latest version is efficient than previous version of Essential PDF. We suggesting you to use latest version

Please let us know if you need further assistance.

With Regards,
Praveen

Hi Praveen,

Thanks for the update.
Can you please help me  in the below issue-
How to insert a text hyperlink to a pdf file. For example I am generating a pdf file with the content as "Welcome to Hello World". 
Now my requirement is that the text "World" should be a hyperlink and on clicking it a url will open in a new browser.

I tried with PdfTextWebLink  property but it is not coming in the C# code. I am using syncfusion dlls of version 9.
Sample code will be helpful.

Thanks
Miran



KC Karthikeyan Chandrasekar Syncfusion Team November 10, 2015 05:04 AM UTC

Hi Miran.
Thank you for your update.
PdfTextWebLink is only available after Version 10 of Essential Studio, we suggest you to update to latest version to make use of it. Please refer the below UG documentation for adding the hyperlink in PDF document.
http://help.syncfusion.com/file-formats/pdf/working-with-hyperlinks

Regards,
Karthikeyan.C

Loader.
Up arrow icon