Is there a way in Perl to get the coordinates of a Path from a PDF in the same coordinate system as the PDF text? -
i have pdf page contains both paths , text. need find coordinates of both paths , text in same coordinate system. can use cam::pdf text coordinates per below:
use cam::pdf; use pdf::totext; #open pdf file , @ pg1 $pdf = cam::pdf->new($pdffilename); $contenttree = $pdf->getpagecontenttree(1); $contenttree->render("pdf::totext");
i can't work out how coordinates of paths on same pdf page. can @ pdf page contents , see path coordinates think these need translated using current transformation matrix, know specific text characters sit on same location on page path (like x marks spot on treasure map...) there no overlap in coordinates can (text , path out ~500 units). there way path coordinates using cam::pdf (or other other perl module?) in same coordinate system (device space?) text?
i'm author of cam::pdf. indeed, you're on right track. take @ implementation of cam::pdf::renderer::dump
, simple. class demonstrates how capture coordinates of text command. next, @ cam::pdf::gs::notext
, see other methods can override in own custom render class similar cam::pdf::renderer::dump
.
Comments
Post a Comment