Using object coordinates from a hit in a Process Plan

Beginning with pdfToolbox 11 coordinates for all objects identified by a hit are available in the pdfToolbox JavaScript object app.doc. In this example this information is used to print image resolutions on all images in a PDF file.

You can use this Process Plan with any file including this one:

The Process Plan identifies all images and their image resolutions in step 1. In the second step the results are copied into app.vars.imageHits and in the final step the coordinates are used to place the image resolutions at the top and centered on each image.

An alternative approach is used in this Process Plan.

It prints the resolutions in a loop which is much slower than in the Process Plan above where a combined template is created and then put on top of the page. But since it lacks the complexity of the combined template it may be easier to adjust.

New properties in app.doc.result.checks[i].hits

  • "llx": lower left x coordinate of snippet bounding box (pt)
  • "lly": lower left y coordinate of snippet bounding box (pt)
  • "urx": upper right y coordinate of snippet bounding box (pt)
  • "ury": upper right y coordinate of snippet bounding box (pt)
  • "type": Type of snippets:
    • "Fill"
    • "Stroke"
    • "StrokeFill"
    • "TextFill"
    • "TextOutline"
    • "TextOutlineFill"
    • "TextInvisible"
    • "InlineImage"
    • "XObj"
    • "Image"
    • "FormXObj"
    • "PostScript"
    • "Shade"
    • "Unknown"
    • "InvalidCmd"

0 Comments

Send Your Comment

E-Mail me when someone replies to this comment