Hi E-IceBlue.
I had created simple sample PDF file for you in Adobe Illustrator and is attached as
LineCurveEllipse.pdfThere 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
Login to view the files attached to this post.