(How) can I set an offset when converting PDF to PCL with Ghostscript?
-
12-12-2019 - |
سؤال
I need to shift the whole page content of a PDF a certain distance down and to the left when converting it to PCL.
I've already found how to do it with PDF to PDF:
Is there somehing similar for the PCL conversion?
Now I convert with the following command:
gswin32c.exe \
-q \
-dNOPAUSE \
-dBATCH \
-sDEVICE=pxlmono \
-dDuplex=false \
-dTumble=false \
-sPAPERSIZE=a4 \
-dMediaPosition=4 \
-sOutputFile="d:\out.pcl" \
-f"d:\in.pdf" \
-c \
-quit
Is there a possibility to do it directly or do I need to shift the content in a PDF to PDF conversion first (like in the linked question) and then convert it to pcl in a second conversion step?
المحلول
I don't think it would work with the direct conversion of PDF => PCL.
You should do it in 2 steps, then it works:
- first shift the contents on the PDF pages,
- convert the PDF with the shifted pages to PCL.
First command:
gs \
-sDEVICE=pdfwrite \
-o pdf-shifted-by-1-inch-to-left-2-inches-to-top.pdf \
-g8420x5950 \
-c "<</PageOffset [-72 144]>> setpagedevice" \
-f input.pdf
Second command:
gs \
-sDEVICE=pxlmono \
-o pcl-output.pcl \
-sPAPERSIZE=a4 \
pdf-shifted-by-1-inch-to-left-2-inches-to-top.pdf
لا تنتمي إلى StackOverflow