0

I'm trying to setup a book to print at Blurb.com. I'm preparing the PDF and want to setup the MediaBox, Bleedbox, and TrimBox to confirm that my document is setup correctly for printing. There is an existing question here about the BleedBox, but, the answers do not change the output as reported by pdfinfo and changing multiple boxes is not covered.

Test Script

#!/bin/sh
gs -o output.pdf \
   -sDEVICE=pdfwrite \
   -r72 \
   -dPDFX \
   -sProcessColorModel=DeviceCMYK \
   -dFIXEDMEDIA \
   -dDEVICEWIDTHPOINTS=660 \
   -dDEVICEHEIGHTPOINTS=910 \
    -c "[/BleedBox [36 36 600 877] /PAGES pdfmark" \
    -f test_in.pdf

pdfinfo -f 1 -l 1 -box output.pdf

Output

GPL Ghostscript 9.50 (2019-10-15)
Copyright (C) 2019 Artifex Software, Inc.  All rights reserved.
This software is supplied under the GNU AGPLv3 and comes with NO WARRANTY:
see the file COPYING for details.
Processing pages 1 through 17.
Page 1
Page 2
Page 3
Page 4
Page 5
Page 6
Page 7
Page 8
Page 9
Page 10
Page 11
Page 12
Page 13
Page 14
Page 15
Page 16
Page 17
Producer:       GPL Ghostscript 9.50
CreationDate:   Sun Jan  5 15:46:42 2020
ModDate:        Sun Jan  5 15:46:42 2020
Tagged:         no
Form:           none
Pages:          17
Encrypted:      no
Page    1 size: 660 x 910 pts (rotated 0 degrees)
Page    1 MediaBox:     0.00     0.00   660.00   910.00
Page    1 CropBox:      0.00     0.00   660.00   910.00
Page    1 BleedBox:     0.00     0.00   660.00   910.00
Page    1 TrimBox:      0.00     0.00   660.00   910.00
Page    1 ArtBox:       0.00     0.00   660.00   910.00
File size:      1213265 bytes
Optimized:      no
PDF version:    1.3
EricB
  • 468
  • 3
  • 9

1 Answers1

2

Your input is a PDF file (rather than, say, a PostScript program), which means it already has a /MediaBox and possibly other boxes as well. Note that setting -dFIXEDMEDIA means that you really shouldn't try and change the MediaBox, I mention this because you reference the MediaBox in your question.

Your command line starts by setting up the BleedBox, and then runs the PDF file. The PDF file's own BleedBox (if present) therefore overwrite the BleedBox you set up using a pdfmark, because it comes after the initial setup.

If you execute the pdfmark after running the PDF file, then the pdfmark will override the PDF file, which is (I believe) what you want.

So to take your command line:

gs -o output.pdf \
   -sDEVICE=pdfwrite \
   -r72 \
   -dPDFX \
   -sProcessColorModel=DeviceCMYK \
   -dFIXEDMEDIA \
   -dDEVICEWIDTHPOINTS=660 \
   -dDEVICEHEIGHTPOINTS=910 \
    test_in.pdf \
    -c "[/BleedBox [36 36 600 877] /PAGES pdfmark" \
    -f

NOTE: You are requesting PDF/X-3 output, but you haven't set a PDF/X definition program, which means that the output will not be PDF/X-3 compliant because you have not specified a CMYK ICC profile. See here

To set multiple Box values, you just add them to the pdfmark. The pdfmark reference can be found here today, but be warned that Adobe rearrange the furniture on their web site frequently, it'll probably move. Googling for 'pdfmark technical reference' should find it.

KenS
  • 30,202
  • 3
  • 34
  • 51
  • I updated my script as suggested. Removed, "-dFIXEDMEDIA \". I also added, "-sColorConversionStrategy=CMYK \", and "-f LOCAL_PDFX_def.ps", which I modified to have ICC profile from Blurb. However, pdfinfo still reports all boxes to be the same. I'm wondering if I need to set, "PDFXSetBleedBoxToMediaBox" to false and how to do that correctly in the -c line? – EricB Jan 07 '20 at 05:37
  • I tried, "-f custom.joboptions LOCAL_PDFX_def.ps". Where custom.joboptions contents were, "<< /PDFXSetBleedBoxToMediaBox false >> setdistillerparams" – EricB Jan 07 '20 at 05:45
  • I can't tell from the information here, perhaps you can post an example file which doesn't work, without that its hard to tell. Note that the PDF/X definitions file has no effect on the boxes, but without an ICC profile your PDF file won't be a conforming PDF/X file, which is why I say you need to have it. – KenS Jan 07 '20 at 08:15
  • Here is a [link to a sample file](https://ln2.sync.com/dl/647165830/qw26ssrb-b58pwawh-xnd6hymv-hkk7nu9u). – EricB Jan 07 '20 at 18:22
  • To get this to work I had to set. CropBox and then set distiller parameters. I'm not entirely sure why, but this is working for everything but the ArtBox. I hope to figure out the ArtBox next. I can't not fit the entire script in a comment. -c "[ /CropBox [1 1 611 791] /PAGES pdfmark << /PDFXSetBleedBoxToMediaBox false /PDFXTrimBoxToMediaBoxOffset [90 90 90 90] /PDFXBleedBoxToTrimBoxOffset [50 50 50 50] >> setdistillerparams" -f If the PDF has hyperlinks addd, "-dPDFACompatibilityPolicy=1" – EricB Jan 13 '20 at 06:28
  • Sorry I'm currently on vacation, I'll try to remember to look when I return. – KenS Jan 13 '20 at 17:22