I read link: https://www.overleaf.com/blog/613-tip-of-the-week-how-to-convert-typeset-pdf-pages-into-raster-image-formats

i use Texmarker 5.0.3 Can i convert main.pdf to multi images (each page = one image)?

Example code:













Thank in advance


In the (complete) TeXLive distribution there is an interesting utility called pdftoppm that can convert PDF to PNG whith some options (e.g., on my Windows machine C:\texlive\2018\bin\win32\pdftoppm.exe). The undeniable advantage is that there is no need to install anything.

Running cmd with pdftoppm -help, you get the following output that informs how the utility works:

enter image description here

Therefore, it suffices to write, e.g.,

C:\path\to\my\PDFfile pdftoppm -f 1 -l 2 -r 300 -png Name_Of_My.pdf My_Images

to convert your two pages PDF-output generated by LaTeX (Name_Of_My.pdf) to separate image files My_Images-1.png and My_Images-2.png, where the prefix name (My_Images) of generated PNG files comes from the last part of the command line above.

The PNG output from your MWE above follows...

enter image description here

| improve this answer | |

If I understand correctly, the PDF->image step is not done by LaTeX, but by an external call to convert (part of ImageMagick suite). So maybe this is off-topic, but...

Basically, once you have installed it, you should be able to use this command (at least in Linux, I think it will be the same in other OSs):

 convert -density 300 -background white -alpha remove -alpha off pdf-file.pdf page.png 

and you'll have your pages at 300 dpi, named page-0.png, page-1.png and so on.

Notice that the latest convert can have problems. Be sure to read https://stackoverflow.com/questions/42928765/convertnot-authorized-aaaa-error-constitute-c-readimage-453 and https://github.com/ImageMagick/ImageMagick/issues/396 and then if you have errors edit your /etc/ImageMagick-6/policy.xml to say:

  <policy domain="resource" name="memory" value="4GiB"/>
  <policy domain="resource" name="map" value="4GiB"/>
  <policy domain="resource" name="width" value="128KP"/>
  <policy domain="resource" name="height" value="128KP"/>
  <policy domain="resource" name="area" value="1.28GP"/>
  <policy domain="resource" name="disk" value="8GiB"/>

  <policy domain="coder" rights="read|write" pattern="PS" />
  <policy domain="coder" rights="read|write" pattern="EPS" />
  <policy domain="coder" rights="read|write" pattern="PDF" />
  <policy domain="coder" rights="read|write" pattern="XPS" />

(In the original files, the rights were none and the limits much lower, which will hinder execution for a medium-size PDF file.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.