Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

jPodRenderer - Coordinates

Help
srini
2010-03-15
2013-04-17
  • srini
    srini
    2010-03-15

    I am a little confused about the coordinate system in jPodRenderer. I am trying to translate mouse clicks into equivalent locations in the pdf page. (Let us say for annotation). I try to detect the locations by implementing a MouseMotionListener but the event locations seem way off.

    Where can I find the details about the coordinate transforms / mapping between pdf and the java JFrame's.

    thanks, srini

     
  • mtraut
    mtraut
    2010-03-16

    Hmmm -the details you will find in the PDF spec. This is something you will need to read anyway if you are working with PDF any longer.

    As a rough overview: PDF coordinates are in "user space" which is 1/72 inch by default, the origin in the lower left. THis may be changed by internal operators and is further complicated by the notion of "text space", but should be enough for the beginning.

    Watch out for the annotation local coordinate system (Matrix and bounding box) when dealing with annotations.

    Second, if you already render a PDF you must have set up a transformation, don't you? Just use it in the inverse direction…