Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
256 views
in Technique[技术] by (71.8m points)

Convert LaTex PDF from Vector to Raster

In my battle against cheating (I am a teacher), I would like to convert my LaTex PDF's to images so that students cannot cut and paste out of the files. I am currently using ImageMagick to do this:

convert -density 300 mwe.pdf mwe_convert.pdf

While this works, when zoomed insufficiently on the PDF aliasing causes unfortunate problems. My understanding is that antialiasing is on by default in convert (https://legacy.imagemagick.org/Usage/antialiasing/)

If I instead use the following command, things are better:

convert -density 800 -resample 300 mwe.pdf mwe_convert.pdf

With this PDF, as I zoom in and out it does a better job of preserving fine lines in the file. I'm guessing I'm getting some different type of effective antialiasing by doing this, but the options to convert have outsmarted me.

The problem is that using density and resample causes the paper size in mwe_convert.pdf to be 3.19 × 4.12 inch (according to identify). This means that viewing the file causes it to open small on the screen, and that you need crazy magnifications to make it readable on the screen.

So my question for the crowd is, is there (a) a way to do the density/resample and get the correct paper size at the end, or (b) a better way to achieve my goal.

I cannot include a PDF here as an MWE. I can show what I'm seeing. Here's a screen shot of the original LaTex PDF.

enter image description here

Here's a screen shot of the -density 300 without the resample:

enter image description here

Here's a screen shot of the -density 800 -resample 300. Note that the PDF was even smaller on the screen and the equals sign was still visible.

enter image description here

question from:https://stackoverflow.com/questions/65921201/convert-latex-pdf-from-vector-to-raster

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...