title: Confusion about current transformation matrix in a PDF
body: <p>I am having some confusions about the current transformation matrix (CTM) in PDFs. For page 5 in <a href="https://drive.google.com/file/d/0B65bQnJhC1mvbEVQQ0o0QU9STlU/view" rel="nofollow noreferrer">this PDF</a>, I have examined the Token Stream (<a href="http://pastebin.com/k6g4BGih" rel="nofollow noreferrer">http://pastebin.com/k6g4BGih</a>) and that shows the last <code>cm</code> operation before the <code>curve (c)</code> commands sets the transfomration matrix to <code>COSInt{10},COSInt{0},COSInt{0},COSInt{10},COSInt{0},COSInt{0}</code>. The full output is at <a href="http://pastebin.com/9XaPQQm9" rel="nofollow noreferrer">http://pastebin.com/9XaPQQm9</a> .</p>
  
  <p>Next I used the following set of codes to extract the line and curve commands from the same page following a code @mkl provided in a <a href="https://stackoverflow.com/questions/28321374/how-to-get-page-content-height-using-pdfbox/28343958">related SO question</a>  </p>
  
  <ol>
  <li>Main class: <a href="http://pastebin.com/htiULanR" rel="nofollow noreferrer">http://pastebin.com/htiULanR</a></li>
  <li><p>Helper classes:</p>
  
  <p>a. Class that extends <code>PDFGraphicsStreamEngine</code>: <a href="http://pastebin.com/zL2p75ha" rel="nofollow noreferrer">http://pastebin.com/zL2p75ha</a></p>
  
  <p>b. <code>Path</code>: <a href="http://pastebin.com/d3vXCgnC" rel="nofollow noreferrer">http://pastebin.com/d3vXCgnC</a></p>
  
  <p>c. <code>Subpath</code>: <a href="http://pastebin.com/CxunHPiZ" rel="nofollow noreferrer">http://pastebin.com/CxunHPiZ</a></p>
  
  <p>d. <code>Segment</code>: <a href="http://pastebin.com/XP1Dby6U" rel="nofollow noreferrer">http://pastebin.com/XP1Dby6U</a></p>
  
  <p>e. <code>Rectangle</code>: <a href="http://pastebin.com/fNtHNtws" rel="nofollow noreferrer">http://pastebin.com/fNtHNtws</a></p>
  
  <p>f. <code>Line</code>: <a href="http://pastebin.com/042cgZBp" rel="nofollow noreferrer">http://pastebin.com/042cgZBp</a></p>
  
  <p>g. <code>Curve</code>: <a href="http://pastebin.com/wXbXZdqE" rel="nofollow noreferrer">http://pastebin.com/wXbXZdqE</a></p></li>
  </ol>
  
  <p>In that code, I printed the CTM using <code>getGraphicsState().getCurrentTransformationMatrix()</code> inside the <code>curveTo()</code> method that is overridden from <code>PDFGraphicsStreamEngine</code> class. That shows the CTM as <code>[0.1,0.0,0.0,0.1,0.0,0.0]</code>. So my questions are:</p>
  
  <ol>
  <li><p>Shouldn't these two CTMs be the same?</p></li>
  <li><p>Both these CTMs have scaling operations: the first one scales with a factor of 10 and the second one scales with a factor of 0.1. If I ignore the scaling, I can create <a href="https://drive.google.com/file/d/0B65bQnJhC1mvT2FBVExwM1haYVU/view?usp=sharing" rel="nofollow noreferrer">an SVG</a> which looks fairly close to the original PDF. But I am confused why that should happen. Do I need to consider <code>all transformation matrices before the path</code> instead of the last one? </p></li>
  </ol>