Change the width of all lines in a PDF programmatically

你。 提交于 2021-01-27 15:23:57

问题


I made handwritten slides using an iPad app, and found out that the line was too thin to be projected on a big screen in a room.

Unfortunately that app doesn't have the ability to change the stroke widths afterwards... (geez.) But I have the exported PDF file.

As a programmer I should be able to solve my problem programmatically, by
changing the width of all lines on a PDF by, say, a factor of two.

So, my question is what would be the easiest way to achieve my objective. Is there a Perl module which allows me to inspect all the lines on a PDF, for example?

-- Update

OK, I converted the PDF to a PS file via ps2pdf (which uses Ghostscript), and replaced 3 w by 6 w etc. using my text editor. (here w is a macro expanding to setlinewidth.) Then I converted the resulting PS file back to a PDF. Problem solved.

But is there a nicer way?


回答1:


You could use Inkscape to convert the .pdf into .svg, parse it with some script (Python, for example, it doesn't matter), then convert it back to .pdf . If this isn't enough programmatic, a command line option is available:

>inkscape -l test.pdf output.svg

And back after processing:

>inkscape -l processed.svg final.pdf


来源:https://stackoverflow.com/questions/5040958/change-the-width-of-all-lines-in-a-pdf-programmatically

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!