Replacing vector images in a PDF with raster images

后端 未结 8 1126
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-30 22:46

Is there any easy (scriptable) way to convert a PDF with vector images into a PDF with raster images? In other words, I want to generate a PDF with the exact same (un-rasterized

8条回答
  •  花落未央
    2021-01-30 23:02

    I used the following:

    gswin32c -o "%2" -dFirstPage=1 -dLastPage=1 -sDEVICE=pngalpha -r72x72 -dUseCropBox -dFitPage "%1" -dBATCH -dNOPAUSE
    

    where %1 is the input file and %2 is the output. This can be used with LaTeX, the generated PNG has the same ratio and page size as the original PDF so the relative position of the image will not change.

    Note that in Linux, you may need to use gs rather than gswin32c.

    You can also set the page range and then print the pages back to PDF. The downside is that the text gets rasterized as well.

提交回复
热议问题