gcr, based on code by Jens Axel Søgaard
pdf-read)
By default, page->pict shows the first page of the given PDF filename. You can also say something like (show-pict (page->pict (pdf-page "oopsla04-gff.pdf"5))) to show the 6th page (pages are zero-indexed).
;;ThefirstpageofaPDFfile.(Pagesarezero-indexed);;OverlayeachboxoverthePDF.;;Eachmatch'sboundingbox^0.5)))
"gray")))
-400-300-100-400)5))
All functions that accept pages or documents also accept filenames. This is more convenient for you, but it is also less efficient because the document must be re-opened every time. You can make this faster by keeping the result of pdf-page or open-pdf-uri to ensure that this library only opens the document once.
procedure
( pdf-document? maybe-doc)→boolean?
maybe-doc:any/c
procedure
( open-pdf-uri uripassword)→(or/c pdf-document? false? )
uri:string?
This function will throw an error if the PDF file does not exist.
maybe-doc:pdf-document?page-index:exact-nonnegative-integer?
(pdf-page "/tmp/oopsla04-gff.pdf"2)
procedure
( page->pict page)→pict?
page:pdf-page?
procedure
( page->bitmap page)→(is-a?/c bitmap% )
page:pdf-page?
procedure
( page-render-to-dc! pagedc)→any/c
page:pdf-page?
procedure
( page-render-to-cairo! page_cairo_t)→any/c
page:pdf-page?_cairo_t:any/c
procedure
page:pdf-page?
procedure
page:pdf-page?
Each rectangle is a (list x1y1x2y2), where x1,y1 is the top left corner and x2,y2 is the bottom right. Coordinates are in points (1/72 of an inch).
procedure
( page-text-in-rect pagemodex1y1x2y2)→string?
page:pdf-page?
When specifying the rectangle, x1,y1 should be the point of the beginning of the selection and x2,y2 should be the end. Coordinates are in points (1/72 of an inch).
procedure
( page-text-layout page)
page:pdf-page?
Each bounding box is a (list x1y1x2y2), where x1,y1 is the top left corner and x2,y2 is the bottom right. Coordinates are in points (1/72 of an inch).
procedure
( page-text-with-layout page)
page:pdf-page?
Each bounding box is a (list x1y1x2y2), where x1,y1 is the top left corner and x2,y2 is the bottom right. Coordinates are in points (1/72 of an inch).
("u\n"(162.69971.302173.65687.890))("p\n"(173.65671.302184.61387.890))("e\n"(184.61371.302194.58487.890))("r\n"(194.58471.302201.56087.890)))
procedure
( page-find-text pagetext)
page:pdf-page?text:string?
procedure
doc:pdf-document?
doc:pdf-document?doc:pdf-document?doc:pdf-document?doc:pdf-document?doc:pdf-document?doc:pdf-document?
procedure
( page-label page)→(or/c false? string? )
page:pdf-page?
Note that page->pict draws directly to the underlying surface’s cairo context. This may have problems if the dc<%> is not backed by cairo or if you perform different transformations (like cropping or blurring).