title: PDF coordinate system in iTextSharp
body: <p>Now I'm working on extracting line and rectangle from PDF by using iTextSharp. The method I used is as below:</p>
  
  <pre><code>PdfReader reader = new PdfReader(strPDFFileName);
  var pageSize = reader.GetPageSize(1);
  var cropBox = reader.GetCropBox(1);
  byte[] pageBytes = reader.GetPageContent(1);
  PRTokeniser tokeniser = new PRTokeniser(new(RandomAccessFileOrArray(pageBytes));
  PRTokeniser.TokType tokenType;
  string tokenValue;
  CoordinateCollection cc = new CoordinateCollection();
  while (tokeniser.NextToken())
  {
     tokenType = tokeniser.TokenType;
     tokenValue = tokeniser.StringValue;
  
     if (tokenType == PRTokeniser.TokType.OTHER)
     {
        if (tokenValue == "re")
        {
           if (buf.Count &lt; 5)
           {
              continue;
           }
  
           float x = float.Parse(buf[buf.Count - 5]);
           float y = float.Parse(buf[buf.Count - 4]);
           float w = float.Parse(buf[buf.Count - 3]);
           float h = float.Parse(buf[buf.Count - 2]);
           Coordinate co = new Coordinate();
           co.type = "re";
           co.X1 = x;
           co.Y1 = y;
           co.W = w;
           co.H = h;
           cc.AddCoordinate(co);
  
        }
  
  
      }
   }
  </code></pre>
  
  <p>The code works fine. But I encounter an issue about PDF measurement unit. The value get from reader.getPageSize is (619*792), it means the page size is 691*792, but when I get rectangle from tokeniser, the x and y are always over the page size, always the value of it is x=150,y=4200,w=1500,h=2000.</p>
  
  <p>I believe the measurement unit of reader.getPageSize and tokeniser is different. </p>
  
  <p>So could you please help to tell me How can I convert them? </p>