Darren,

FDnC Red wrote
> 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.

As you already have found the PdfContentStreamProcessor class, you should
inspect it some more and look at its inner IContentOperator implementations
PushGraphicsState, PopGraphicsState, and ModifyCurrentTransformationMatrix
by default registered for q, Q, and cm, and the GraphicsState class. They
can serve as examples on how to process those operators and make the CTM
available (GraphicsState.GetCtm).

https://svn.code.sf.net/p/itextsharp/code/trunk/src/core/iTextSharp/text/pdf/parser/PdfContentStreamProcessor.cs
https://svn.code.sf.net/p/itextsharp/code/trunk/src/core/iTextSharp/text/pdf/parser/GraphicsState.cs

Regards,   Michael



--
View this message in context: 
http://itext-general.2136553.n4.nabble.com/Detect-Lines-in-PDF-tp4660295p4660310.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
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

Reply via email to