Ghostscript: adding BleedBox

旧街凉风 提交于 2019-12-06 13:47:39

Firstly, nowhere in your command line do you specify a BleedBox. You do mention an ArtBox but that's not the same thing.

Secondly, you can't just arbitrarily stick a /ArtBox in the PostScript stream and expect it to do anything. This "[/ArtBox[36 36 631 877]" isn't even valid PostScript because you have unbalanced array marks.

Your command line should instead read

-c "[/ArtBox [36 36 631 877] /PAGES pdfmark" -f

Unless You actually do want a BleedBox in which case you will have to replace the /ArtBox with /BleedBox.

I recently had the need for this myself but the proposed solution using Ghostscript wasn't working for me. I created a small utility called pdfboxer to do this which uses Apache PDFBox underneath. You can download the source from https://github.com/nicknux/pdfboxer.

It allows you to change the TrimBox, ArtBox, BleedBox, and CropBox.

Sample usage for the utility is:

$ java -jar bin/pdfboxer-0.0.1.jar \ -trimBox 7.200000,7.200000,504.000031,720.000000 \ -artBox 7.200000,7.200000,504.000031,720.000000 \ -sourceFile src/test/pdfs/UNTRIMMED_PDF.pdf \ -destFile src/test/pdfs/TRIMMED_PDF.pdf

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