title: Ghostscript - getting "pdfsettings=/ebook" into individual arguments?
body: <p>I’m creating pdf's for a RIP-engine.
  Sometimes I have to convert all fonts to outlines and maybe 1/1000 of those pdfs will get stuck while ripping.
  For the conversion to outlines I use:</p>
  
  <pre><code>gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -dNoOutputFonts -sOutputFile outlined_output.pdf input.pdf
  </code></pre>
  
  <p>When this occures, I previously just opened the pdf in Acrobat and used PitStop to convert to outlines instead, since I thought that the problem was with Ghostscript's way of outlining.</p>
  
  <p>Now, I’ve noticed that if I just open the very same pdf that get stuck while ripping in Acrobat 9 Standard and save it to another location, it will rip just fine.</p>
  
  <p>I then tried a bunch of gs-commands and found out that if I use -dPDFSETTINGS=/screen or /ebook it would rip ok, but not when using /printer or /prepress. For quality reasons, /screen and /ebook is not ok.</p>
  
  <p>I tried to understand what differs from ebook and printer.</p>
  
  <p>/ebook</p>
  
  <pre><code>gs   -q   -dNODISPLAY   -c ".distillersettings /ebook get {exch ==only ( ) print ===} forall quit" | sort
  </code></pre>
  
  <p>Gives:</p>
  
  <pre><code>/AutoRotatePages /All
  /CannotEmbedFontPolicy /Warning
  /ColorACSImageDict &lt;&lt; /Blend 1 /HSamples [2 1 1 2] /VSamples [2 1 1 2] /QFactor 0.76 /ColorTransform 1 &gt;&gt;
  /ColorConversionStrategy /sRGB
  /ColorImageDownsampleType /Average
  /ColorImageResolution 150
  /CompatibilityLevel 1.5
  /CreateJobTicket false
  /DoThumbnails false
  /EmbedAllFonts true
  /GrayACSImageDict &lt;&lt; /Blend 1 /HSamples [2 1 1 2] /VSamples [2 1 1 2] /QFactor 0.76 /ColorTransform 1 &gt;&gt;
  /GrayImageDownsampleType /Average
  /GrayImageResolution 150
  /MonoImageDownsampleType /Subsample
  /MonoImageResolution 300
  /NeverEmbed [/Courier /Courier-Bold /Courier-Oblique /Courier-BoldOblique /Helvetica /Helvetica-Bold /Helvetica-Oblique /Helvetica-BoldOblique /Times-Roman /Times-Bold /Times-Italic /Times-BoldItalic /Symbol /ZapfDingbats]
  /PreserveEPSInfo false
  /PreserveOPIComments false
  /PreserveOverprintSettings false
  /UCRandBGInfo /Remove
  </code></pre>
  
  <p>And /printer</p>
  
  <pre><code>gs   -q   -dNODISPLAY   -c ".distillersettings /ebook get {exch ==only ( ) print ===} forall quit" | sort
  </code></pre>
  
  <p>Gives:</p>
  
  <pre><code>/AutoRotatePages /None
  /CannotEmbedFontPolicy /Warning
  /ColorACSImageDict &lt;&lt; /Blend 1 /HSamples [1 1 1 1] /VSamples [1 1 1 1] /QFactor 0.4 /ColorTransform 1 &gt;&gt;
  /ColorConversionStrategy /UseDeviceIndependentColor
  /ColorImageDownsampleType /Average
  /ColorImageResolution 300
  /CompatibilityLevel 1.7
  /CreateJobTicket true
  /DoThumbnails false
  /EmbedAllFonts true
  /GrayACSImageDict &lt;&lt; /Blend 1 /HSamples [1 1 1 1] /VSamples [1 1 1 1] /QFactor 0.4 /ColorTransform 1 &gt;&gt;
  /GrayImageDownsampleType /Average
  /GrayImageResolution 300
  /MonoImageDownsampleType /Subsample
  /MonoImageResolution 1200
  /NeverEmbed []
  /PreserveEPSInfo true
  /PreserveOPIComments true
  /PreserveOverprintSettings true
  /UCRandBGInfo /Preserve
  </code></pre>
  
  <p>Now, I was thinking if I could take the /ebook settings into command-line arguments and adjust or remove one by one until I find the correct command that makes the pdf rip fine.
  As I can read from examples on the web, -dAutoRotatePages=/None is a correct argument. Adding "-d" together with "=" looks to be correct?
  Also,  NeverEmbed, ColorACSImageDict and GrayACSImageDict must be called from "-c" (<a href="https://www.ghostscript.com/doc/9.22/VectorDevices.htm#note_13" rel="nofollow noreferrer">https://www.ghostscript.com/doc/9.22/VectorDevices.htm#note_13</a>)</p>
  
  <p>EDIT: new command based on KenS guidelines:</p>
  
  <pre><code>gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite
  -dAutoRotatePages=/All \
  -dCannotEmbedFontPolicy=/Warning \
  -dColorConversionStrategy=/sRGB \
  -dColorImageDownsampleType=/Average \
  -dColorImageResolution=150 \
  -dCompatibilityLevel=1.5 \
  -dCreateJobTicket=false \
  -dDoThumbnails=false \
  -dEmbedAllFonts=true \
  -dGrayImageDownsampleType=/Average \
  -dGrayImageResolution=150 \
  -dMonoImageDownsampleType=/Subsample \
  -dMonoImageResolution=300 \
  -dPreserveEPSInfo=false \
  -dPreserveOPIComments=false \
  -dPreserveOverprintSettings=false \
  -dUCRandBGInfo=/Remove \
  -sOutputFile=final_output.pdf \
  -c '&lt;&lt;/ColorACSImageDict &lt;&lt; /Blend 1 /HSamples [2 1 1 2] /VSamples [2 1 1 2] /QFactor 0.76 /ColorTransform 1 &gt;&gt;  &lt;&lt;/GrayACSImageDict &lt;&lt; /Blend 1 /HSamples [2 1 1 2] /VSamples [2 1 1 2] /QFactor 0.76 /ColorTransform 1 &gt;&gt; &lt;&lt;/NeverEmbed [/Courier /Courier-Bold /Courier-Oblique /Courier-BoldOblique /Helvetica /Helvetica-Bold /Helvetica-Oblique /Helvetica-BoldOblique /Times-Roman /Times-Bold /Times-Italic /Times-BoldItalic /Symbol /ZapfDingbats] &gt;&gt; setdistillerparams' \
  -f outlined_output.pdf
  </code></pre>
  
  <p>This command produces a pdf that still gets stuck. So what am I doing wrong, is the formatting wrong somewhere?
  How should the arguments look like to be exactly like /ebook?</p>
  
  <p>Anyone have direct suggestions on what the difference could be between /ebook and /printer that can cause the pdf to stuck at the rip?</p>
  
  <p>Best Regards
  Niclas</p>