[scribus] DPI and PDF question

Nigel Ridley nigel at rmk.co.il
Thu Jul 24 15:46:53 CEST 2008


avox wrote:
> 
> 
> Nigel Ridley wrote:
>> Tino Schwarze wrote:
>> ...
>>> The command line for Linux looks like this (all in one line):
>>> pdftops -level3 -paper match "$infile" - | gsc -q -dSAFER -dBATCH
>>> -dNOPAUSE -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -dAutoRotatePages=/None
>>> -dEmbedAllFonts=true -dSubsetFonts=true -sOutputFile="$outfile"
>>> -dCompatibilityLevel=1.4 -c .setpdfwrite -
>>>
>>> By using the /ebook PDF setting, Ghostscript will downsample images and
>>> the PDF get's real small.
>>>
>>> HTH,
>>>
>>> Tino.
>>>
>> How do I actually use the script?
>> I cd'd into the dir where the pdf is and executed your script and got this
>> error message:
>>
>> nigel at laptop:~/Hamaayan/Example$  "$infile" - | gsc -q -dSAFER -dBATCH
>> -dNOPAUSE 
>> -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -dAutoRotatePages=/None
>> -dEmbedAllFonts=true 
>> -dSubsetFonts=true -sOutputFile="$outfile" -dCompatibilityLevel=1.4 -c
>> .setpdfwrite -
>> *** WARNING -- Unknown or improperly placed option: "q"
>> *** WARNING -- Unknown or improperly placed option: "dSAFER"
>> *** WARNING -- Unknown or improperly placed option: "dBATCH"
>> *** WARNING -- Unknown or improperly placed option: "dNOPAUSE"
>> *** WARNING -- Unknown or improperly placed option: "sDEVICE=pdfwrite"
>> *** WARNING -- Unknown or improperly placed option: "dPDFSETTINGS=/ebook"
>> *** WARNING -- Unknown or improperly placed option:
>> "dAutoRotatePages=/None"
>> *** WARNING -- Unknown or improperly placed option: "dEmbedAllFonts=true"
>> *** WARNING -- Unknown or improperly placed option: "dSubsetFonts=true"
>> *** WARNING -- Unknown or improperly placed option: "sOutputFile="
>> *** WARNING -- Unknown or improperly placed option:
>> "dCompatibilityLevel=1.4"
>> *** WARNING -- Unknown or improperly placed option: "c"
>> *** ERROR -- Can't find file "/home/nigel/Hamaayan/Example/.setpdfwrite"
>> bash: : command not found
>> nigel at laptop:~/Hamaayan/Example$
>>
>>
> 
> If you compare your output with the original, you'll notice that the
> "pdftops -level3 -paper match"
> part is missing from your command. Also not that you should replace $infile
> and $outfile with the
> actual filenames you use (or set them as shell variables).
> 
> Sample:
> 
> infile=myoriginalpdf ; outfile=myconverted.pdf; pdftops -level3 -paper match
> "$infile" - | gsc -q -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pdfwrite
> -dPDFSETTINGS=/ebook -dAutoRotatePages=/None -dEmbedAllFonts=true
> -dSubsetFonts=true -sOutputFile="$outfile" -dCompatibilityLevel=1.4 -c
> .setpdfwrite -
> 
> Or, create a shellscript for it:
> __________
> #!/bin/sh
> infile=$1
> outfile=$2
> 
> pdftops -level3 -paper match "$infile" - | gsc -q -dSAFER -dBATCH -dNOPAUSE
> -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -dAutoRotatePages=/None
> -dEmbedAllFonts=true -dSubsetFonts=true -sOutputFile="$outfile"
> -dCompatibilityLevel=1.4 -c .setpdfwrite -
> __________
> 
> 
> Put that in a file named "pdfcompress.sh" and run it with 
> "sh pdfcompress myoriginal.pdf myconverted.pdf", or make it executable and
> put it in your PATH.
> 
> HTH,
> /Andreas

Thanks for pointing out the 'obvious_mistake'. However it still produces errors (my original file 
that I am wanting to reduce in size is named 'Example.pdf'):

nigel at laptop:~/Hamaayan/Example$ pdftops -level3 -paper match "$Example" - | gsc -q -dSAFER 
-dBATCH -dNOPAUSE -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -dAutoRotatePages=/None 
-dEmbedAllFonts=true -dSubsetFonts=true -sOutputFile="$example.pdf" -dCompatibilityLevel=1.4 -c 
.setpdfwrite -
Error: Couldn't open file ''
*** WARNING -- Unknown or improperly placed option: "q"
*** WARNING -- Unknown or improperly placed option: "dSAFER"
*** WARNING -- Unknown or improperly placed option: "dBATCH"
*** WARNING -- Unknown or improperly placed option: "dNOPAUSE"
*** WARNING -- Unknown or improperly placed option: "sDEVICE=pdfwrite"
*** WARNING -- Unknown or improperly placed option: "dPDFSETTINGS=/ebook"
*** WARNING -- Unknown or improperly placed option: "dAutoRotatePages=/None"
*** WARNING -- Unknown or improperly placed option: "dEmbedAllFonts=true"
*** WARNING -- Unknown or improperly placed option: "dSubsetFonts=true"
*** WARNING -- Unknown or improperly placed option: "sOutputFile=.pdf"
*** WARNING -- Unknown or improperly placed option: "dCompatibilityLevel=1.4"
*** WARNING -- Unknown or improperly placed option: "c"
 >
*** EOF again to exit
nigel at laptop:~/Hamaayan/Example$

I did create an empty .setpdfwrite file and noticed that after running the 'one_liner', I now 
have my original [empty] .setpdfwrite file, plus a file named .setpdfwrite.c and an executable 
named .setpdfwrite.o1 (plus another named .setpdfwrite.o - as I ran the script again just to 
double check) but as you can see from the above it won't run and hangs until I do a 'Ctrl + D' 
twice (to get back to the command prompt).

If it helps, here is the contents of .setpdfwrite.c:

#ifdef ___LINKER_INFO
; File: ".setpdfwrite.c", produced by Gambit-C 4.0 beta 20
(
400000
" .setpdfwrite.o2"
(" .setpdfwrite.o2")
(
)
(
)
(
" .setpdfwrite.o2"
)
(
)
(
)
  #f
)
#else
#define ___VERSION 400000
#define ___MODULE_NAME " .setpdfwrite.o2"
#define ___LINKER_ID ____20__2e_setpdfwrite_2e_o2
#define ___MH_PROC ___H__20__2e_setpdfwrite_2e_o2
#define ___SCRIPT_LINE 0
#define ___GLO_COUNT 1
#define ___SUP_COUNT 1
#define ___LBL_COUNT 2
#include "gambit.h"

___NEED_GLO(___G__20__2e_setpdfwrite_2e_o2)

___BEGIN_GLO
___DEF_GLO(0," .setpdfwrite.o2")
___END_GLO


#undef ___MD_ALL
#define ___MD_ALL ___D_R0 ___D_R1
#undef ___MR_ALL
#define ___MR_ALL ___R_R0 ___R_R1
#undef ___MW_ALL
#define ___MW_ALL ___W_R1
___BEGIN_M_COD
___BEGIN_M_HLBL
___DEF_M_HLBL_INTRO
___DEF_M_HLBL(___L0__20__2e_setpdfwrite_2e_o2)
___END_M_HLBL

___BEGIN_M_SW

#undef ___PH_PROC
#define ___PH_PROC ___H__20__2e_setpdfwrite_2e_o2
#undef ___PH_LBL0
#define ___PH_LBL0 1
#undef ___PD_ALL
#define ___PD_ALL ___D_R0 ___D_R1
#undef ___PR_ALL
#define ___PR_ALL ___R_R0 ___R_R1
#undef ___PW_ALL
#define ___PW_ALL ___W_R1
___BEGIN_P_COD
___BEGIN_P_HLBL
___DEF_P_HLBL_INTRO
___DEF_P_HLBL(___L0__20__2e_setpdfwrite_2e_o2)
___END_P_HLBL
___BEGIN_P_SW
___DEF_SLBL(0,___L0__20__2e_setpdfwrite_2e_o2)
    ___IF_NARGS_EQ(0,___NOTHING)
    ___WRONG_NARGS(0,0,0,0)
___DEF_GLBL(___L__20__2e_setpdfwrite_2e_o2)
    ___SET_R1(___FAL)
    ___JUMPPRM(___NOTHING,___R0)
___END_P_SW
___END_P_COD

___END_M_SW
___END_M_COD

___BEGIN_LBL
  ___DEF_LBL_INTRO(___H__20__2e_setpdfwrite_2e_o2," .setpdfwrite.o2",___REF_FAL,1,0)
,___DEF_LBL_PROC(___H__20__2e_setpdfwrite_2e_o2,0,0)
___END_LBL

___BEGIN_MOD1
___DEF_PRM(0,___G__20__2e_setpdfwrite_2e_o2,1)
___END_MOD1

___BEGIN_MOD2
___END_MOD2

#endif


Blessings,

Nigel

-- 
PrayingForIsrael.net
http://www.prayingforisrael.net/






More information about the scribus mailing list