title: How do I crop pages 3&4 in a multipage pdf using ghostscript
body: <p>I would like to crop just some pages in a multipage pdf keeping all pages, some cropped, others not. I tried the following but it "deletes" the non cropped pages...</p>
  
  <pre><code>gswin64.exe -o cropped.pdf -sDEVICE=pdfwrite  -dFirstPage=3 -dLastPage=4 -c "[/CropBox [24 72 1559 1794]" -c " /PAGES pdfmark" -f input.pdf
  </code></pre>
  
  <p>I've seen the posts on different cropping on odd and even pages, but I could not figure out how to apply this to a certain page in a multipage document.</p>
  
  <pre><code>gswin64.exe -o cropped.pdf -sDEVICE=pdfwrite -c "&lt;&lt;/EndPage {0 eq {2 mod 0 eq {[/CropBox [0 0 1612 1792] /PAGE pdfmark true}{[/CropBox [500 500 612 792] /PAGE pdfmark true} ifelse}{false}ifelse}&gt;&gt; setpagedevice" -f input.pdf
  </code></pre>
  
  <p>This does crop all pages according to the settings of the second CropBox. If anybody is wondering about the large margins... I apply this do large drawings.
  I have also tried to substitute some operators to only apply the crop to a certain page number: "sub 4" instead of "2 mod" was one attempt to attain the " 0 eq" condition only when the current page number reaches 4.</p>