I've looked through the forum and have not seen an answer for this. I would like to be able to import a pdf document in which each page contains an QR code. I want to then use the Barcode reader function to identify specific pages. Is there a way to convert the PDF pages into images within Mathematica. I have been able to use Acrobat to convert the PDF into images outside of Mathematica - but it would be nice not to have to pre-process each file.
Answer
Is there a way to convert the PDF pages into images within Mathematica
Yes, just do f = Import["my_file.pdf", "Pages"];
and now f
is a list, each is one page. Then use Export["f.png",f[[1]]]
to export the first page as png
Here is MWE
SetDirectory[NotebookDirectory[]];
f = Import["my_file.pdf", "Pages"];
Export["page" <> ToString[#] <> ".png", f[[#]]] & /@ Range[Length[f]]
reference http://reference.wolfram.com/language/ref/format/PDF.html
Comments
Post a Comment