I've made some progress on this task but there are still some things I'm unsure
about. I figured out I could setup a PDFContentStreamProcessor and get all
line values from the Pdf operators like this snippet below. The only remaining
problem is I can't get the CTM so my line coordinates are off.
Listener listener = new Listener();
PdfContentStreamProcessor processor = new
PdfContentStreamProcessor(listener);
CountOps counter = new CountOps(); //IContentOperator
processor.RegisterContentOperator("q", counter);
processor.RegisterContentOperator("cm", counter);
processor.RegisterContentOperator("m", counter);
processor.RegisterContentOperator("l", counter);
processor.RegisterContentOperator("S", counter);
processor.RegisterContentOperator("Q", counter);
processor.ProcessContent(ContentByteUtils.GetContentBytesForPage(reader, 1),
res);
Is there any way to get the CTM in my IContentOperator class as the operators
are found? I assume I need the CTM so then I can add the matrix found with the
cm operator to find the real coordinates of the line.
Any help would be appreciated.
Thanks,
Darren
On Friday, August 29, 2014 1:07 AM, Darren Schroeder <fdnc...@gmail.com> wrote:
Is there an easy way with iTextSharp to detect lines in PDF files?
I see the lines in a stream but I'm not sure how to parse them out of there nor
do I know how to convert them from the current transform matrix. For this
given PDF there are 4 horizontal lines and 3 vertical lines.
q 1 0 0 1 19.96 538.9747 cm
0 0 m
716.89 0 l
S
Q
q 1 0 0 1 19.96 399.63 cm
0 0 m
716.89 0 l
S
Q
q 1 0 0 1 19.96 268.3525 cm
0 0 m
716.89 0 l
S
Q
q 1 0 0 1 19.96 141.3561 cm
0 0 m
716.89 0 l
S
Q
0 0 0 1 K
/GS1 gs
q 1 0 0 1 184.01 538.4 cm
0 0 m
0 -509.96 l
S
Q
q 1 0 0 1 368.6952 659.88 cm
0 0 m
0 -631.44 l
S
Q
q 1 0 0 1 561.25 538.4 cm
0 0 m
0 -509.96 l
S
Q
Thanks,
Darren
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php
------------------------------------------------------------------------------
Slashdot TV.
Video for Nerds. Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php