1

I've been trying several GS commands to remove the margins from right and left side of a PDF file such as:

gs \
  -q -dNOPAUSE -dBATCH \
  -sDEVICE=pdfwrite \
  -dSAFER \
  -dCompatibilityLevel=1.3 \
  -dPDFSETTINGS=/printer \
  -dSubsetFonts=true \
  -dEmbedAllFonts=true \
  -sPAPERSIZE=a4 \
  -sOutputFile=d:\\ghost\\gs\\bin\\shiftedgulf.pdf  \
  -c <</BeginPage{0.9 0.9 scale 29.75 42.1 translate}>> setpagedevice \
  -f d:\\ghost\\gs\\bin\\gulf.pdf"

but its like nothing is happening, my question is there any effective, direct and clear way to achieve this ?

Maybe this questions is duplicated but I tried most of the scripts and none of them is giving me any result, any other command line tool might be suggested is fine as well.

Kurt Pfeifle
  • 86,724
  • 23
  • 248
  • 345
mmoghrabi
  • 1,233
  • 1
  • 14
  • 23

3 Answers3

1

PDF files don't have 'margins'. The content is placed on the page, which may leave white space at the edges of the media, but its not a margin as such.

I'd need to see the PDF file to have any chance of figuring out what you're trying to achieve, and why what you are doing doesn't work. Setting the PAPERSIZE to A4 seems like a bad start though. You probably want to set a specific medi asize and set -dFIXEDMEDIA so that the PDF interpreter doesn't overrride it.

KenS
  • 30,202
  • 3
  • 34
  • 51
0

You may want to study this other Stackoverflow answer to a similar question

and you'll probably be able to achieve what you want....

Community
  • 1
  • 1
Kurt Pfeifle
  • 86,724
  • 23
  • 248
  • 345
0

Thank you all for the answers i found very easy and direct to the point tool, it called briss all you need is downloading the JAR briss-0.0.14 and run the command :

java -jar briss-0.0.14.jar -s original.pdf -d cropped.pdf -c 0.11/0.08/0.11/0.08:0.11/0.08/0.11/0.08

and thats all :)

mmoghrabi
  • 1,233
  • 1
  • 14
  • 23