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.

Thu Jan 23, 2020 9:33 am

Dear E-iceblue!
I need to read all graphics primitives from PDF page like Lines, Splines, Arcs, Rectangles, etc.
with thickness and color. We can read images and texts but what about graphics primitives, Is this possible?
Thanks.
Best regards,
Procam

procamSpire
 
Posts: 22
Joined: Tue Sep 03, 2019 7:56 am

Thu Jan 23, 2020 9:51 am

Hi,

Thanks for your inquiry.
Sorry that our Spire.PDF doesn't support that.
If there is any other question, welcome to get it back to us.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Thu Jan 23, 2020 10:57 am

Betsy.jiang wrote:Hi,

Thanks for your inquiry.
Sorry that our Spire.PDF doesn't support that.
If there is any other question, welcome to get it back to us.

Sincerely,
Betsy
E-iceblue support team


Dear E-iceblue!
Please can you implement it? Graphics primitives = vector graphics is important part of PDF.
Best regards,
Procam

procamSpire
 
Posts: 22
Joined: Tue Sep 03, 2019 7:56 am

Fri Jan 24, 2020 3:40 am

Hi,

To help us record your issue accurately and investigate further, could you please provide a sample PDF which includes Graphics primitives and tell us the result you want?

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Thu Apr 01, 2021 11:00 am

Hi E-IceBlue.
I had created simple sample PDF file for you in Adobe Illustrator and is attached as LineCurveEllipse.pdf
There is 1 Line + 1 Curve + 1 Ellipse on 1 PDF page.

We want to use for getting these PDF data Spire.PDF because we use Spire.PDF for drawing already (PdfCanvas methods) to PDF export.
We need to get PDF content stream with all operators and operands.
Now, we are using temporarily for reading it library iTextSharp class PdfReader method GetPageContent ​like this:

Code: Select all
PdfReader pdfReader = new PdfReader("LineCurveEllipse.pdf");
byte[] data = pdfReader.GetPageContent(1);


This will return 609 bytes. I had converted it to readable format for you so we got:
Code: Select all
"/Layer /MC0 BDC
0 0 0 0 k
0 0 0 1 K
/GS0 gs
q 1 0 0 1 115 732.8898 cm
0 0 m
318 -138 l
B
Q
q
0 841.89 595.276 -841.89 re
W n
q 1 0 0 1 80 554.8898 cm
0 0 m
76.653 -94.978 182.895 -143.552 275 -120 c
295.837 -114.672 325.641 -103.174 357 -76 c
B
Q
q 1 0 0 1 402 186.3898 cm
0 0 m
0 -44.459 -48.354 -80.5 -108 -80.5 c
-167.647 -80.5 -216 -44.459 -216 0 c
-216 44.459 -167.647 80.5 -108 80.5 c
-48.354 80.5 0 44.459 0 0 c
f
Q
q 1 0 0 1 402 186.3898 cm
0 0 m
0 -44.459 -48.354 -80.5 -108 -80.5 c
-167.647 -80.5 -216 -44.459 -216 0 c
-216 44.459 -167.647 80.5 -108 80.5 c
-48.354 80.5 0 44.459 0 0 c
h
S
Q
EMC
Q
"


So we need just get this array of bytes. We will parse it inside our app.
These data are operators and operands (see pdf_reference_1-7 Nov 2006 page 985 Operator Summary, https://ghostscript.com/~robin/pdf_reference17.pdf)
m = moveto, l = lineto, c = curveto.
I hope that you will understand to our needs :-)

Best regards

procamSpire
 
Posts: 22
Joined: Tue Sep 03, 2019 7:56 am

Fri Apr 02, 2021 2:55 am

Hello,

Thanks for your inquiry.
Sorry that our Spire.PDF does not yet support the feature you mentioned. We will consider adding it as a new feature to our upgrade list. If it can be implemented in the future, we will let you know. Apologize for the inconvenience caused.

Sincerely,
Elena
E-iceblue support team
User avatar

Elena.Zhang
 
Posts: 279
Joined: Thu Jul 23, 2020 1:18 am

Wed Apr 14, 2021 5:52 am

Hi E-IceBlue.
I hope that your dev team will implement it soon. Reading of PDF data (not just text but also vector graphics) is important part of working with PDF files.
So we stay with library iTextSharp until implemented your missing method for getting PDF content stream.
Best regards,

procamSpire
 
Posts: 22
Joined: Tue Sep 03, 2019 7:56 am

Wed Apr 14, 2021 10:45 am

Hello,

Thanks for your follow-up!

I got a feedback about your requirement from our development team. Our Spire.PDF has a complete internal mechanism to parse the PDF document. Parsing operators and operands is implemented inside. Our design philosophy is to implement some universal features, the conclusion we evaluated is that the feature of reading content stream (vector graphics data) is personal (not universal). Publishing this requirement is contrary to our product design philosophy.

Therefore, we do not consider releasing it to the official version, but considering your situation, we can add this requirement to a temporary version, can you accept this solution? I'm looking forward to your reply.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Thu Apr 29, 2021 8:19 am

Hello.
Yes please make code for returning PDF content stream buffer.
As you wrote it will be only temporary version. How we will get new version in the feature (with bugfixes and new features)?
We are using Spire.PDF nuget in our product.
Thank you.

procamSpire
 
Posts: 22
Joined: Tue Sep 03, 2019 7:56 am

Thu Apr 29, 2021 10:49 am

Hello,

Thanks for your reply.

Okay, we will prepare a temporary version which could return the PDF content stream buffer for you ASAP.

Since publish this requirement is contrary to our product design philosophy, we will not consider releasing it to the official version. If you need a new version that contains bugfixes and new features in the future, we will repackage another temporary version that contains these for you. Besides, you need to use our Spire.PDF by referencing the dlls manually.

Once the temporary version is ready, we will inform and provide you ASAP.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Fri Apr 30, 2021 1:06 pm

Hi,

I am writing to inform you that the temporary version is available now. Please download it and use the below code to get the PDF content stream buffer.
Code: Select all
PdfDocument doc = new PdfDocument();
PdfPageBase page= doc .Pages[0];
byte[] data = page.GetPageContents();

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1187
Joined: Tue Sep 27, 2016 1:06 am

Mon May 03, 2021 9:29 am

Thank you,
it is working well.
One question. Is there some way how to get XObjects from loaded PDF file?
BR

procamSpire
 
Posts: 22
Joined: Tue Sep 03, 2019 7:56 am

Mon May 03, 2021 12:55 pm

Hello,

Thanks for your feedback.
I am sorry that our Spire.PDF does not support this feature. Apologize for the inconvenience caused.
If there are any other issues related to our products, just feel free to contact us.

Sincerely,
Brain
E-iceblue support team
User avatar

Brian.Li
 
Posts: 1271
Joined: Mon Oct 19, 2020 3:04 am

Return to Spire.PDF