zackw / pdfsizeopt

Automatically exported from code.google.com/p/pdfsizeopt
0 stars 0 forks source link

pdfs that can't open in gsview #5

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
(Please select a label starting with Optimize- in ``Labels:'' below, and
remove this paragraph.)

What command do you run to optimize the PDF?
user@ubuntu804server:~/pdfsizeopt$ ./pdfsizeopt.py --use-pngout=false
--use-jbig2=true --use-multivalent=true --do-unify-fonts=false bt2.pdf

What does pdfsizeopt display when running the command above?
info: This is pdfsizeopt.py r92.
info: loading PDF from: bt2.pdf
info: loaded PDF of 193204 bytes
info: separated to 75 objs
info: found 7 Type1 fonts loaded
info: writing Type1CConverter (166873 font bytes) to: pso.conv.tmp.ps
info: executing Type1CConverter with Ghostscript: gs -q -dNOPAUSE -dBATCH
-sDEVI
CE=pdfwrite -dPDFSETTINGS=/printer
-dColorConversionStrategy=/LeaveColorUnchange
d -sOutputFile=pso.conv.tmp.pdf -f pso.conv.tmp.ps
Type1CConverter: using interpreter GPL Ghostscript 861 20071121
Type1CConverter: converting font /JESDUO+MinionPro-It to /Obj0000000065
Type1CConverter: converting font /QPGEBD+MinionPro-MediumCapt to /Obj0000000067
Type1CConverter: converting font /PIIUFM+MinionPro-Regular to /Obj0000000069
Type1CConverter: converting font /OTVPRB+MinionPro-Semibold to /Obj0000000071
Type1CConverter: converting font /PAMMIA+MnSymbol12 to /Obj0000000073
Type1CConverter: converting font /FJMZYA+CMSS12 to /Obj0000000075
Type1CConverter: converting font /HSDSIM+EUSM10 to /Obj0000000077
Type1CConverter: all OK
info: loading PDF from: pso.conv.tmp.pdf
info: loaded PDF of 16065 bytes
info: separated to 38 objs
info: found 7 fonts in GS output
info: optimized total Type1 font size 166960 to Type1C font size 7005 (4%)
info: optimized Type1 font XObject 65,64: new size=1010 (2%)
info: optimized Type1 font XObject 67,66: new size=912 (10%)
info: optimized Type1 font XObject 69,68: new size=2756 (7%)
info: optimized Type1 font XObject 71,70: new size=1626 (4%)
info: optimized Type1 font XObject 73,72: new size=1138 (5%)
info: optimized Type1 font XObject 75,74: new size=639 (9%)
info: optimized Type1 font XObject 77,76: new size=791 (31%)
info: eliminated 4 duplicate objs
info: writing Multivalent input PDF: pso.conv.mi.tmp.pdf
info: saving PDF with 70 objs to: pso.conv.mi.tmp.pdf
info: generated 28453 bytes (15%)
info: executing Multivalent to optimize PDF: java -cp
/home/user/pdfsizeopt/Mult
ivalent.jar tool.pdf.Compress pso.conv.mi.tmp.pdf
file:/home/user/pdfsizeopt/pso.conv.mi.tmp.pdf, 28453 bytes
PDF 1.4, producer=pdfTeX, creator=pdfTeX
additional compression may be possible with:
         -compact
=> new length = 22501, saved 20%, elapsed time = 0 sec
info: Multivalent generated pso.conv.mi.tmp-o.pdf of 22523 bytes (79%)
info: compressed xref stream from 288 to 327 bytes (114%)
info: optimized to 22445 bytes after Multivalent (100%)
info: saving PDF to: bt2.psom.pdf
info: generated 22445 bytes (12%)

What's wrong with the optimized PDF?
I cannot open it with ghostscript 8.63. 

I can open it with ghostscript 8.61 however, so maybe this is a bug in
(this version of) ghostscript?

If I use --use-multivalent=false then it works also, so maybe this is a bug
in multivalent?

Output when there is an error:
bash$ gswin32c.exe bt2.psom.pdf
GPL Ghostscript 8.63 (2008-08-01)
Copyright (C) 2008 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
   **** File has an unbalanced >> (close dictionary).
   **** Incorrect object count in object stream.
Error: /rangecheck in resolveobjectstream
Operand stack:
   PageCount   22406   5   7   --dict:7/15(L)--   49   --nostringval--  
false   --nostringval--   --dict:4/4(L)--   --dict:2/2(L)--  
--dict:11/11(L)--   --dict:0/0(L)--   --dict:3/3(L)--   --dict:4/4(L)--  
--nostringval--   Type   FontDescriptor      FontBBox   --nostringval--  
CharSet   (/A/rho)   Descent   -12   XHeight   438   FontName  
JESDUO+MinionPro-It   FontFile3   --nostringval--   CapHeight   675   StemV
  77   Flags   4   Ascent   675   ItalicAngle   -12   --dict:12/12(L)--  
--dict:4/4(L)--   --dict:1/1(L)--   --dict:2/2(L)--   --dict:1/1(L)--  
--dict:2/2(L)--   --dict:4/4(L)--   --dict:1/1(L)--   --dict:9/9(L)--  
--dict:1/1(L)--   --dict:9/9(L)--   --dict:8/8(L)--   --dict:8/8(L)--  
--dict:9/9(L)--   --dict:9/9(L)--   --dict:9/9(L)--   --dict:9/9(L)--  
--dict:9/9(L)--   --dict:9/9(L)--   --dict:9/9(L)--   --nostringval--  
--dict:2/2(L)--   --nostringval--   --dict:2/2(L)--   --nostringval--  
--nostringval--   --dict:2/2(L)--   --nostringval--   --dict:2/2(L)--  
--nostringval--   --nostringval--   --nostringval--   --nostringval--  
--dict:2/2(L)--   --nostringval--   --nostringval--   --dict:12/12(L)--  
--dict:12/12(L)--   --dict:12/12(L)--   --dict:12/12(L)--   --dict:2/2(L)--
  --dict:1/1(L)--
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--  
--nostringval--   2   %stopped_push   --nostringval--   --nostringval--  
--nostringval--   false   1   %stopped_push   1905   1   3   %oparray_pop 
 1904   1   3   %oparray_pop   1888   1   3   %oparray_pop  
--nostringval--   --nostringval--   --nostringval--   --nostringval--  
--nostringval--   --nostringval--   --nostringval--   --nostringval--
Dictionary stack:
   --dict:1148/1684(ro)(G)--   --dict:1/20(G)--   --dict:75/200(L)--  
--dict:75/200(L)--   --dict:106/127(ro)(G)--   --dict:275/300(ro)(G)--  
--dict:20/25(L)--
Current allocation mode is local
GPL Ghostscript 8.63: Unrecoverable error, exit code 1

Original issue reported on code.google.com by lev.bishop on 28 Oct 2009 at 2:47

Attachments:

GoogleCodeExporter commented 8 years ago
See the attached output using Ghostscript 8.61 for conversion. Both Ghostscript 
8.61
and 8.64 can render bt2.psom.pdf perfectly. If you're having problems with
Ghostscript 8.63, please try it with my bt2.psom.pdf, and please attach your
bt2.psom.pdf as well.

$ ./pdfsizeopt.py bt2.pdf 
info: This is pdfsizeopt.py r102.
info: loading PDF from: bt2.pdf
info: loaded PDF of 193204 bytes
info: separated to 75 objs
info: found 7 Type1 fonts loaded
info: writing Type1CConverter (166873 font bytes) to: pso.conv.tmp.ps
info: executing Type1CConverter with Ghostscript: gs -q -dNOPAUSE -dBATCH -sDEVI
CE=pdfwrite -dPDFSETTINGS=/printer -dColorConversionStrategy=/LeaveColorUnchange
d -sOutputFile=pso.conv.tmp.pdf -f pso.conv.tmp.ps
Type1CConverter: using interpreter GPL Ghostscript 861 20071121
Type1CConverter: converting font /JESDUO+MinionPro-It to /Obj0000000065
Type1CConverter: converting font /QPGEBD+MinionPro-MediumCapt to /Obj0000000067
Type1CConverter: converting font /PIIUFM+MinionPro-Regular to /Obj0000000069
Type1CConverter: converting font /OTVPRB+MinionPro-Semibold to /Obj0000000071
Type1CConverter: converting font /PAMMIA+MnSymbol12 to /Obj0000000073
Type1CConverter: converting font /FJMZYA+CMSS12 to /Obj0000000075
Type1CConverter: converting font /HSDSIM+EUSM10 to /Obj0000000077
Type1CConverter: all OK
info: loading PDF from: pso.conv.tmp.pdf
info: loaded PDF of 16065 bytes
info: separated to 38 objs
info: found 7 fonts in GS output
info: optimized total Type1 font size 166960 to Type1C font size 7005 (4%)
info: optimized Type1 font XObject 65,64: new size=1010 (2%)
info: optimized Type1 font XObject 67,66: new size=912 (10%)
info: optimized Type1 font XObject 69,68: new size=2756 (7%)
info: optimized Type1 font XObject 71,70: new size=1626 (4%)
info: optimized Type1 font XObject 73,72: new size=1138 (5%)
info: optimized Type1 font XObject 75,74: new size=639 (9%)
info: optimized Type1 font XObject 77,76: new size=791 (31%)
info: found 7 Type1C fonts loaded
info: writing Type1CParser (6857 font bytes) to: pso.conv.parse.tmp.ps
info: executing Type1CParser with Ghostscript: gs -q -dNOPAUSE -dBATCH -sDEVICE=
nullpage -sDataFile=pso.conv.parsedata.tmp.ps -f pso.conv.parse.tmp.ps
Type1CParser: using interpreter GPL Ghostscript 861 20071121
Type1CParser: all OK
info: parsed 7 Type1C fonts
info: eliminated 4 duplicate objs
info: writing Multivalent input PDF: pso.conv.mi.tmp.pdf
info: saving PDF with 70 objs to: pso.conv.mi.tmp.pdf
info: generated 28371 bytes (15%)
info: executing Multivalent to optimize PDF: java -cp /home/kat/tex/pdfsizeopt/t
runk/Multivalent.jar tool.pdf.Compress pso.conv.mi.tmp.pdf
file:/home/kat/tex/pdfsizeopt/trunk/pso.conv.mi.tmp.pdf, 28371 bytes
PDF 1.4, producer=pdfTeX, creator=pdfTeX
additional compression may be possible with:
         -compact
=> new length = 22480, saved 20%, elapsed time = 0 sec
info: Multivalent generated pso.conv.mi.tmp-o.pdf of 22502 bytes (79%)
info: compressed xref stream from 288 to 327 bytes (114%)
info: optimized to 22424 bytes after Multivalent (100%)
info: saving PDF to: bt2.psom.pdf
info: generated 22424 bytes (12%)

Original comment by pts...@gmail.com on 31 Oct 2009 at 7:48

Attachments:

GoogleCodeExporter commented 8 years ago
With your bt2.psom.pdf I get the error. My bt2.psom.pdf is bytewise-identical to
yours, so I do not post it.

Here is the error:
bash-3.2$ gswin32c.exe bt2.psom.pdf
GPL Ghostscript 8.63 (2008-08-01)
Copyright (C) 2008 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
   **** File has an unbalanced >> (close dictionary).
   **** Incorrect object count in object stream.
Error: /rangecheck in resolveobjectstream
Operand stack:
   PageCount   22385   5   7   --dict:7/15(L)--   49   --nostringval--   false
 --nostringval--   --dict:4/4(L)--   --dict:2/2(L)--   --dict:11/11(L)--   --dic
t:0/0(L)--   --dict:3/3(L)--   --dict:4/4(L)--   --nostringval--   Type   FontDe
scriptor      FontBBox   --nostringval--   CharSet   (/A/rho)   Descent   -12
FontName   JESDUO+MinionPro-It   FontFile3   --nostringval--   CapHeight   675
 StemV   77   Ascent   675   Flags   4   ItalicAngle   -12   --dict:11/11(L)--
 --dict:4/4(L)--   --dict:1/1(L)--   --dict:2/2(L)--   --dict:1/1(L)--   --dict:
2/2(L)--   --dict:4/4(L)--   --dict:1/1(L)--   --dict:9/9(L)--   --dict:1/1(L)--
   --dict:9/9(L)--   --dict:8/8(L)--   --dict:8/8(L)--   --dict:9/9(L)--   --dic
t:9/9(L)--   --dict:9/9(L)--   --dict:9/9(L)--   --dict:9/9(L)--   --dict:9/9(L)
--   --dict:9/9(L)--   --nostringval--   --dict:2/2(L)--   --nostringval--   --d
ict:2/2(L)--   --nostringval--   --nostringval--   --dict:2/2(L)--   --nostringv
al--   --dict:2/2(L)--   --nostringval--   --nostringval--   --nostringval--   -
-nostringval--   --dict:2/2(L)--   --nostringval--   --nostringval--   --dict:11
/11(L)--   --dict:11/11(L)--   --dict:11/11(L)--   --dict:11/11(L)--   --dict:2/
2(L)--   --dict:1/1(L)--
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval-
-   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   fa
lse   1   %stopped_push   1905   1   3   %oparray_pop   1904   1   3   %oparray_
pop   1888   1   3   %oparray_pop   --nostringval--   --nostringval--   --nostri
ngval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--
  --nostringval--
Dictionary stack:
   --dict:1148/1684(ro)(G)--   --dict:1/20(G)--   --dict:75/200(L)--   --dict:75
/200(L)--   --dict:106/127(ro)(G)--   --dict:275/300(ro)(G)--   --dict:20/25(L)-
-
Current allocation mode is local
GPL Ghostscript 8.63: Unrecoverable error, exit code 1

Original comment by lev.bishop on 1 Nov 2009 at 12:31

GoogleCodeExporter commented 8 years ago
Just to clarify: I run pdfsizeopt.py on ubuntu linux using ghostscript 8.61, 
and I
get a bytewise-identical bt2.psom.pdf to yours. I then transfer the file to 
windows
and get the error when I try to view using ghostscript 8.63.

Original comment by lev.bishop on 1 Nov 2009 at 6:57

GoogleCodeExporter commented 8 years ago
This looks like a bug in Ghostscript 8.63 on Windows.

Closing until there is proof that more recent Ghostscripts are also affected.

Original comment by pts...@gmail.com on 15 Nov 2009 at 8:25