pdfsizeopt icon indicating copy to clipboard operation
pdfsizeopt copied to clipboard

output image doesn't work in Adobe Acrobat XI Pro and Ghostscript

Open jul059 opened this issue 6 years ago • 16 comments

This pdf becomes corrupted after using this command:

pdfsizeopt --use-image-optimizer=optipng,advpng,jbig2

Sorry for the zippyshare link, the file is too big for conventional upload. https://www85.zippyshare.com/v/z6qbdPjW/file.html

jul059 avatar Apr 08 '19 02:04 jul059

Thank you for reporting this!

What do you mean by corrupted? Which programs fail to open the PDF? How do these programs react?

Please copy-paste the console output of pdfsizeopt.

pts avatar Apr 08 '19 23:04 pts

Adobe Acrobat XI Pro gives this error on page 8

image

Which basically means "An error has occurred while reading this document (14)"

Here is the log:

info: This is pdfsizeopt ZIP rUNKNOWN size=69649.
info: prepending to PATH: C:\pdfsizeopt\pdfsizeopt_win32exec
info: loading PDF from: file.pdf
info: loaded PDF of 78326925 bytes
info: using Ghostscript C:\pdfsizeopt\pdfsizeopt_win32exec\pdfsizeopt_gswin\gswin32c.exe: GPL Ghostscript 9.05 (2012-02-
08)
info: decompressing 10458 bytes with Ghostscript /Filter/FlateDecode/DecodeParms <</Columns 6/Predictor 12>>
info: found 90743 obj offsets and 351 obj streams in xref stream
info: separated to 90392 objs + xref + trailer
info: parsed 90392 objs
info: found 0 Type1 fonts loaded
info: found 42 Type1C fonts loaded
info: writing Type1CParser (140814 font bytes) to: C:\Users\JBO\AppData\Local\Temp\psotmp.9088.conv.parse.tmp.ps
info: executing Type1CParser with Ghostscript: C:\pdfsizeopt\pdfsizeopt_win32exec\pdfsizeopt_gswin\gswin32c.exe -q -P- -
dNOPAUSE -dBATCH -sDEVICE=nullpage -sDataFile=C:\Users\JBO\AppData\Local\Temp\psotmp.9088.conv.parsedata.tmp.ps -f C:\Us
ers\JBO\AppData\Local\Temp\psotmp.9088.conv.parse.tmp.ps
Type1CParser: using interpreter GPL Ghostscript 905 20120208
Type1CParser: all OK
info: parsed 42 Type1C fonts
info: could not merge fonts from mismatch in Private: target={'defaultWidthX': 212, 'BlueFuzz': 1, 'BlueShift': 7, 'Blue
Values': ['-11.0', '0.0', '483.595', '494.595', '649.98', '660.98', '673.979', '684.979', '709.979', '720.978'], 'nomina
lWidthX': 604, 'ExpansionFactor': '0.06', 'LanguageGroup': 0, 'initialRandomSeed': 0, 'BlueScale': '0.0909116', 'ForceBo
ld': False, 'OtherBlues': ['-220.843', '-212.294', '-199.994', '-193.799', '260.992', '265.992']} source={'defaultWidthX
': 513, 'BlueFuzz': 1, 'BlueShift': 7, 'BlueValues': ['-11.0', '0.0', '483.0', '494.0', '649.0', '660.0', '673.0', '684.
0', '709.0', '720.0'], 'nominalWidthX': 319, 'ExpansionFactor': '0.06', 'LanguageGroup': 0, 'initialRandomSeed': 0, 'Blu
eScale': '0.0909116', 'ForceBold': False, 'OtherBlues': ['-220.0', '-212.0', '-199.0', '-193.0', '260.0', '265.0']} to /
RGECEG+BrandingSans-Roman: /IFTHDX+BrandingSans-Roman
info: could not merge fonts from mismatch in Private: target={'defaultWidthX': 212, 'BlueFuzz': 1, 'BlueShift': 7, 'Blue
Values': ['-11.0', '0.0', '483.595', '494.595', '649.98', '660.98', '673.979', '684.979', '709.979', '720.978'], 'nomina
lWidthX': 604, 'ExpansionFactor': '0.06', 'LanguageGroup': 0, 'initialRandomSeed': 0, 'BlueScale': '0.0909116', 'ForceBo
ld': False, 'OtherBlues': ['-220.843', '-212.294', '-199.994', '-193.799', '260.992', '265.992']} source={'defaultWidthX
': 207, 'BlueFuzz': 1, 'BlueShift': 7, 'BlueValues': ['-11.0', '0.0', '483.0', '494.0', '649.0', '660.0', '673.0', '684.
0', '709.0', '720.0'], 'nominalWidthX': 555, 'ExpansionFactor': '0.06', 'LanguageGroup': 0, 'initialRandomSeed': 0, 'Blu
eScale': '0.0909116119', 'ForceBold': False, 'OtherBlues': ['-220.0', '-212.0', '-199.0', '-193.0', '260.0', '265.0']} t
o /YVAFZM+BrandingSans-Roman: /IFTHDX+BrandingSans-Roman
info: could not merge fonts from mismatch in Private: target={'defaultWidthX': 0, 'BlueFuzz': 1, 'BlueShift': 7, 'BlueVa
lues': ['-11.0', '0.0', '483.0', '494.0', '649.0', '663.0', '673.0', '686.0', '709.0', '720.0'], 'nominalWidthX': 0, 'Ex
pansionFactor': '0.06', 'LanguageGroup': 0, 'initialRandomSeed': 0, 'BlueScale': '0.076352', 'ForceBold': False, 'OtherB
lues': ['-222.0', '-221.0', '-208.0', '-197.0', '260.0', '265.0']} source={'defaultWidthX': 492, 'BlueFuzz': 1, 'BlueShi
ft': 7, 'BlueValues': ['-11.0', '0.0', '483.0', '494.0', '649.0', '663.0', '673.0', '686.0', '709.0', '720.0'], 'nominal
WidthX': 420, 'ExpansionFactor': '0.06', 'LanguageGroup': 0, 'initialRandomSeed': 0, 'BlueScale': '0.07635203', 'ForceBo
ld': False, 'OtherBlues': ['-222.0', '-221.0', '-208.0', '-197.0', '260.0', '265.0']} to /FDDBUY+BrandingSansItalic-Roma
n: /TGGVBB+BrandingSansItalic-Roman
info: could not merge fonts from mismatch in Private: target={'defaultWidthX': 273, 'BlueFuzz': 1, 'BlueShift': 7, 'Blue
Values': ['-17.0', '0.0', '440.0', '456.0', '706.0', '731.0', '773.0', '773.0'], 'nominalWidthX': 460, 'ExpansionFactor'
: '0.06', 'LanguageGroup': 0, 'initialRandomSeed': 0, 'BlueScale': '0.039625', 'ForceBold': False, 'OtherBlues': ['-215.
0', '-215.0']} source={'defaultWidthX': 273, 'BlueFuzz': 1, 'BlueShift': 7, 'BlueValues': ['-17.0', '0.0', '440.0', '456
.0', '706.0', '731.0', '773.0', '773.0'], 'nominalWidthX': 471, 'ExpansionFactor': '0.06', 'LanguageGroup': 0, 'initialR
andomSeed': 0, 'BlueScale': '0.039625', 'ForceBold': False, 'OtherBlues': ['-215.0', '-215.0']} to /KOKYTY+Revival565BT-
Roman: /GUZJFW+Revival565BT-Roman
info: writing Type1CGenerator (336649 bytes in 42 fonts) to: C:\Users\JBO\AppData\Local\Temp\psotmp.9088.conv.gen.tmp.ps

info: executing Type1CGenerator with Ghostscript: C:\pdfsizeopt\pdfsizeopt_win32exec\pdfsizeopt_gswin\gswin32c.exe -q -P
- -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/printer -dColorConversionStrategy=/LeaveColorUnchanged -sOutputFile
=C:\Users\JBO\AppData\Local\Temp\psotmp.9088.conv.gen.tmp.pdf -f C:\Users\JBO\AppData\Local\Temp\psotmp.9088.conv.gen.tm
p.ps
Type1CGenerator: using interpreter GPL Ghostscript 905 20120208
Type1CGenerator: all OK
info: loading PDF from: C:\Users\JBO\AppData\Local\Temp\psotmp.9088.conv.gen.tmp.pdf
info: loaded PDF of 186994 bytes
info: separated to 183 objs + xref + trailer
info: parsed 183 objs
info: found 42 fonts loaded
info: optimized Type1C fonts to form 150636 bytes to 151231 bytes (100%)
info: will optimize image XObject 89019; orig width=359 height=112 colorspace=/DeviceGray bpc=1 inv=False filter=/CCITTF
axDecode dp=1 size=927 gs_device=pngmono
info: will optimize image XObject 89359; orig width=1254 height=437 colorspace=/DeviceGray bpc=1 inv=False filter=/CCITT
FaxDecode dp=1 size=1052 gs_device=pngmono
info: will optimize image XObject 90103; orig width=491 height=76 colorspace=/DeviceGray bpc=1 inv=False filter=/CCITTFa
xDecode dp=1 size=774 gs_device=pngmono
info: will optimize image XObject 90699; orig width=733 height=78 colorspace=/DeviceGray bpc=1 inv=False filter=/CCITTFa
xDecode dp=1 size=1115 gs_device=pngmono
info: optimizing 4 images of 3868 bytes in total
info: writing ImageRenderer (3820 image bytes) to: C:\Users\JBO\AppData\Local\Temp\psotmp.9088.conv.pngmono.tmp.ps
info: executing ImageRenderer with Ghostscript: C:\pdfsizeopt\pdfsizeopt_win32exec\pdfsizeopt_gswin\gswin32c.exe -q -P-
-dNOPAUSE -dBATCH -sDEVICE=pngmono -sOutputFile="C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-%04d.pngmono.tmp.png" -
f C:\Users\JBO\AppData\Local\Temp\psotmp.9088.conv.pngmono.tmp.ps
ImageRenderer: rendering image XObject 89019 width=359 height=112 bpc=1 colorspace=/DeviceGray filter=/CCITTFaxDecode de
codeparms=<< /K -1 /Rows 112 /Columns 359 >> device=pngmono
ImageRenderer: rendering image XObject 89359 width=1254 height=437 bpc=1 colorspace=/DeviceGray filter=/CCITTFaxDecode d
ecodeparms=<< /K -1 /Rows 437 /Columns 1254 >> device=pngmono
ImageRenderer: rendering image XObject 90103 width=491 height=76 bpc=1 colorspace=/DeviceGray filter=/CCITTFaxDecode dec
odeparms=<< /K -1 /Rows 76 /Columns 491 >> device=pngmono
ImageRenderer: rendering image XObject 90699 width=733 height=78 bpc=1 colorspace=/DeviceGray filter=/CCITTFaxDecode dec
odeparms=<< /K -1 /Rows 78 /Columns 733 >> device=pngmono
ImageRenderer: all OK
info: loading image from: C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-0001.pngmono.tmp.png
info: loaded PNG IDAT of 1197 bytes
info: loading image from: C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-0002.pngmono.tmp.png
info: loaded PNG IDAT of 2626 bytes
info: loading image from: C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-0003.pngmono.tmp.png
info: loaded PNG IDAT of 1142 bytes
info: loading image from: C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-0004.pngmono.tmp.png
info: loaded PNG IDAT of 1747 bytes
info: executing image converter sam2p_np: sam2p -j:quiet -pdf:2 -c zip:1:9 -s Gray1:Indexed1:Gray2:Indexed2:Rgb1:Gray4:I
ndexed4:Rgb2:Gray8:Indexed8:Rgb4:Rgb8:stop -- C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-0001.pngmono.tmp.png C:\Us
ers\JBO\AppData\Local\Temp\psotmp.9088.img-89019.sam2p-np.pdf
info: loading image from: C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-89019.sam2p-np.pdf
info: loading PDF from: C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-89019.sam2p-np.pdf
info: loaded PDF of 1896 bytes
info: separated to 5 objs + xref + trailer
info: parsed 5 objs
info: loaded PNG IDAT of 1187 bytes
info: saving PNG to C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-89019.save-oi.png
info: written 1244 bytes to PNG
info: executing image converter optipng: optipng C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-89019.save-oi.png -o4 -
fix -force -out C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-89019.optipng.png
** Processing: C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-89019.save-oi.png
359x112 pixels, 1 bit/pixel, grayscale
Input IDAT size = 1187 bytes
Input file size = 1244 bytes

Trying:
  zc = 9  zm = 8  zs = 0  f = 0         IDAT size = 1189
  zc = 9  zm = 8  zs = 1  f = 0         IDAT size = 1141

Selecting parameters:
  zc = 9  zm = 8  zs = 1  f = 0         IDAT size = 1141

Output file: C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-89019.optipng.png

Output IDAT size = 1141 bytes (46 bytes decrease)
Output file size = 1198 bytes (46 bytes = 3.70% decrease)

info: loading image from: C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-89019.optipng.png
info: loaded PNG IDAT of 1141 bytes
info: executing image converter advpng: advpng -z3 -f C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-89019.advpng.png
        1244        1244 100% C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-89019.advpng.png (Unsupported bit depth/co
lor type, 1/0)
        1244        1244 100%
info: loading image from: C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-89019.advpng.png
info: loaded PNG IDAT of 1187 bytes
info: executing image converter jbig2: jbig2 -p C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-89019.save-oi.png >C:\Us
ers\JBO\AppData\Local\Temp\psotmp.9088.img-89019.jbig2
info: optimized image XObject 89019 file_name=C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-89019.jbig2 size=871 (97%)
 methods=jbig2:871,#orig:900,sam2p_np:1350,optipng:1364,advpng:1410,save_oi:1410,gs:1420
info: executing image converter sam2p_np: sam2p -j:quiet -pdf:2 -c zip:1:9 -s Gray1:Indexed1:Gray2:Indexed2:Rgb1:Gray4:I
ndexed4:Rgb2:Gray8:Indexed8:Rgb4:Rgb8:stop -- C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-0002.pngmono.tmp.png C:\Us
ers\JBO\AppData\Local\Temp\psotmp.9088.img-89359.sam2p-np.pdf
info: loading image from: C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-89359.sam2p-np.pdf
info: loading PDF from: C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-89359.sam2p-np.pdf
info: loaded PDF of 2880 bytes
info: separated to 5 objs + xref + trailer
info: parsed 5 objs
info: loaded PNG IDAT of 2167 bytes
info: saving PNG to C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-89359.save-oi.png
info: written 2217 bytes to PNG
info: executing image converter optipng: optipng C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-89359.save-oi.png -o4 -
fix -force -out C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-89359.optipng.png
** Processing: C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-89359.save-oi.png
1254x437 pixels, 1 bit/pixel, grayscale
Input IDAT size = 2160 bytes
Input file size = 2217 bytes

Trying:
  zc = 9  zm = 8  zs = 0  f = 0         IDAT size = 2163
  zc = 9  zm = 8  zs = 1  f = 0         IDAT size = 2147

Selecting parameters:
  zc = 9  zm = 8  zs = 1  f = 0         IDAT size = 2147

Output file: C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-89359.optipng.png

Output IDAT size = 2147 bytes (13 bytes decrease)
Output file size = 2204 bytes (13 bytes = 0.59% decrease)

info: loading image from: C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-89359.optipng.png
info: loaded PNG IDAT of 2147 bytes
info: executing image converter advpng: advpng -z3 -f C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-89359.advpng.png
        2217        2217 100% C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-89359.advpng.png (Unsupported bit depth/co
lor type, 1/0)
        2217        2217 100%
info: loading image from: C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-89359.advpng.png
info: loaded PNG IDAT of 2160 bytes
info: executing image converter jbig2: jbig2 -p C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-89359.save-oi.png >C:\Us
ers\JBO\AppData\Local\Temp\psotmp.9088.img-89359.jbig2
info: optimized image XObject 89359 file_name=C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-89359.jbig2 size=905 (88%)
 methods=jbig2:905,#orig:1024,sam2p_np:2331,optipng:2372,advpng:2385,save_oi:2385,gs:2851
info: executing image converter sam2p_np: sam2p -j:quiet -pdf:2 -c zip:1:9 -s Gray1:Indexed1:Gray2:Indexed2:Rgb1:Gray4:I
ndexed4:Rgb2:Gray8:Indexed8:Rgb4:Rgb8:stop -- C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-0003.pngmono.tmp.png C:\Us
ers\JBO\AppData\Local\Temp\psotmp.9088.img-90103.sam2p-np.pdf
info: loading image from: C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-90103.sam2p-np.pdf
info: loading PDF from: C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-90103.sam2p-np.pdf
info: loaded PDF of 1839 bytes
info: separated to 5 objs + xref + trailer
info: parsed 5 objs
info: loaded PNG IDAT of 1134 bytes
info: saving PNG to C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-90103.save-oi.png
info: written 1193 bytes to PNG
info: executing image converter optipng: optipng C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-90103.save-oi.png -o4 -
fix -force -out C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-90103.optipng.png
** Processing: C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-90103.save-oi.png
491x76 pixels, 1 bit/pixel, grayscale
Input IDAT size = 1136 bytes
Input file size = 1193 bytes

Trying:
  zc = 9  zm = 8  zs = 0  f = 0         IDAT size = 1136
  zc = 9  zm = 8  zs = 1  f = 0         IDAT size = 1113

Selecting parameters:
  zc = 9  zm = 8  zs = 1  f = 0         IDAT size = 1113

Output file: C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-90103.optipng.png

Output IDAT size = 1113 bytes (23 bytes decrease)
Output file size = 1170 bytes (23 bytes = 1.93% decrease)

info: loading image from: C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-90103.optipng.png
info: loaded PNG IDAT of 1113 bytes
info: executing image converter advpng: advpng -z3 -f C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-90103.advpng.png
        1193        1193 100% C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-90103.advpng.png (Unsupported bit depth/co
lor type, 1/0)
        1193        1193 100%
info: loading image from: C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-90103.advpng.png
info: loaded PNG IDAT of 1136 bytes
info: executing image converter jbig2: jbig2 -p C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-90103.save-oi.png >C:\Us
ers\JBO\AppData\Local\Temp\psotmp.9088.img-90103.jbig2
info: optimized image XObject 90103 file_name=C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-90103.jbig2 size=732 (98%)
 methods=jbig2:732,#orig:748,sam2p_np:1296,optipng:1335,advpng:1358,save_oi:1358,gs:1364
info: executing image converter sam2p_np: sam2p -j:quiet -pdf:2 -c zip:1:9 -s Gray1:Indexed1:Gray2:Indexed2:Rgb1:Gray4:I
ndexed4:Rgb2:Gray8:Indexed8:Rgb4:Rgb8:stop -- C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-0004.pngmono.tmp.png C:\Us
ers\JBO\AppData\Local\Temp\psotmp.9088.img-90699.sam2p-np.pdf
info: loading image from: C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-90699.sam2p-np.pdf
info: loading PDF from: C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-90699.sam2p-np.pdf
info: loaded PDF of 2415 bytes
info: separated to 5 objs + xref + trailer
info: parsed 5 objs
info: loaded PNG IDAT of 1710 bytes
info: saving PNG to C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-90699.save-oi.png
info: written 1770 bytes to PNG
info: executing image converter optipng: optipng C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-90699.save-oi.png -o4 -
fix -force -out C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-90699.optipng.png
** Processing: C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-90699.save-oi.png
733x78 pixels, 1 bit/pixel, grayscale
Input IDAT size = 1713 bytes
Input file size = 1770 bytes

Trying:
  zc = 9  zm = 8  zs = 0  f = 0         IDAT size = 1715
  zc = 9  zm = 8  zs = 1  f = 0         IDAT size = 1679

Selecting parameters:
  zc = 9  zm = 8  zs = 1  f = 0         IDAT size = 1679

Output file: C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-90699.optipng.png

Output IDAT size = 1679 bytes (34 bytes decrease)
Output file size = 1736 bytes (34 bytes = 1.92% decrease)

info: loading image from: C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-90699.optipng.png
info: loaded PNG IDAT of 1679 bytes
info: executing image converter advpng: advpng -z3 -f C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-90699.advpng.png
        1770        1770 100% C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-90699.advpng.png (Unsupported bit depth/co
lor type, 1/0)
        1770        1770 100%
info: loading image from: C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-90699.advpng.png
info: loaded PNG IDAT of 1713 bytes
info: executing image converter jbig2: jbig2 -p C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-90699.save-oi.png >C:\Us
ers\JBO\AppData\Local\Temp\psotmp.9088.img-90699.jbig2
info: optimized image XObject 90699 file_name=C:\Users\JBO\AppData\Local\Temp\psotmp.9088.img-90699.jbig2 size=947 (87%)
 methods=jbig2:947,#orig:1089,sam2p_np:1872,optipng:1901,advpng:1935,save_oi:1935,gs:1969
info: saved 306 bytes (8%) on optimizable images
info: optimized 2423 streams, kept 1272 #orig, 200 uncompressed, 951 zip
info: eliminated 13 duplicate objs
info: eliminated 4 unused objs in 4 classes
info: compressed 200 streams, kept 0 of them uncompressed
info: saving PDF with 90375 objs to: file.pdf.pdf
info: generated object stream of 1988955 bytes in 87593 objects (6%)
info: generated 77758990 bytes (99%)

jul059 avatar Apr 09 '19 02:04 jul059

Please also attach your the output file (file.pdf.pdf).

pts avatar Apr 09 '19 13:04 pts

There may be 1 or more bugs in pdfsizeopt.

For example, Ghostscript fails with the output file.pso.pdf of:

$ pdfsizeopt --use-pngout=no --do-optimize-fonts=no --do-optimize-images=yes file.pdf
$ gsnd -dBATCH file.pso.pdf
(fails)

If I change it to --do-optimize-images=no, Ghostscript succeeds.

Also there is no error (and pdfsizeopt becomes much faster and the document outline disappears) if I convert with pdftk first:

$ pdftk file.pdf cat 1-1023 output file1_1023.pdf
$ pdfsizeopt --use-pngout=no --do-optimize-fonts=no --do-optimize-images=yes file.pdf
$ gsnd -dBATCH file1_1023.pso.pdf

Also there is no error (and pdfsizeopt becomes much faster and the document outline remains) if I convert with pdftk first:

$ pdftk file.pdf cat output file_all.pdf
$ pdfsizeopt --use-pngout=no --do-optimize-fonts=no --do-optimize-images=yes file_all.pdf
$ gsnd -dBATCH file_all.pso.pdf

Expected behavior: if Ghostscript succeeds on the input of pdfsizeopt, then Ghostscript should also succeed on the output of pdfsizeopt. Clearly this is not happening, see the failure of gsnd -dBATCH file.pso.pdf above.

I don't know what causes the failure in Acrobat XI Pro (because I don't have a copy of that software), in this issue I'll focus on fixing the failure in Ghostscript.

pts avatar Apr 09 '19 13:04 pts

Please also attach your the output file (file.pdf.pdf).

Here is the file produced by the command in the first post: https://www16.zippyshare.com/v/38xuXvag/file.html

jul059 avatar Apr 09 '19 16:04 jul059

Unfortunately I don't have a copy of file.pdf anymore. Could you please upload it again?

pts avatar Feb 23 '23 02:02 pts

I may have forgotten which file it was, but I have updated the link in the first post with what I believe is the right file.

Thank you for your work on this!

jul059 avatar Feb 23 '23 03:02 jul059

I'm able to reproduce this bug with Ghostscript (gsnd -dBATCH issue114.pso.pdf). Ghostscript succeeds iff pdfsizeopt -do-optimize-images=no is specified. So there may be an image optimization bug somewhere in pdfsizeopt.

pts avatar Feb 23 '23 04:02 pts

Ghostscript 9.26 reports the following error on issue114.pso.pdf: **** Error: Incorrect object count in object stream.. This may be unrelated.

pts avatar Mar 09 '23 10:03 pts

It looks like that there is a bug with the latest pdfsizeopt with --do-optimize-images=no --do-generate-object-stream=yes.

FYI Input file is issue114.pdf (78326925 bytes, 1023 pages). Conversions:

$ ./pdfsizeopt --use-pngout=no --do-optimize-fonts=no --do-optimize-images=yes --do-generate-object-stream=yes issue114.pdf issue114.c1.pdf
$ ./pdfsizeopt --use-pngout=no --do-optimize-fonts=no --do-optimize-images=no  --do-generate-object-stream=yes issue114.pdf issue114.c2.pdf
$ ./pdfsizeopt --use-pngout=no --do-optimize-fonts=no --do-optimize-images=yes --do-generate-object-stream=no 
 issue114.pdf issue114.c3.pdf

Results with Ghostscript 9.26 gsnd -dBATCH filename.pdf:

  • issue114.pdf: Success.
  • issue114.c1.pdf: Failure. **** Error: Incorrect object count in object stream., and then Error: /rangecheck in resolveobjectstream.
  • issue114.c2.pdf: Success.
  • issue114.c3.pdf: Success.

Results with Ghostscript 9.05 gsnd -dBATCH filename.pdf:

  • issue114.pdf: Success.
  • issue114.c1.pdf: Failure. Error: /limitcheck in --run--
  • issue114.c2.pdf: Failure. Error: /limitcheck in --run--
  • issue114.c3.pdf: Success.

Results with Evince and xpdf: All 4 files work.

When preprocessed with qpdf, it succeeds with Ghostscript 9.26:

$ qpdf issue114.pdf --pages issue114.pdf 1-1023 -- issue114.1-1023.pdf
WARNING: issue114.pdf (Pages object: object 66930 0): Unknown key /ITXT in /Pages object is being discarded as a result of flattening the /Pages tree
qpdf: operation succeeded with warnings; resulting file may have some problems
$ ./pdfsizeopt --use-pngout=no --do-optimize-fonts=no --do-optimize-images=yes --do-generate-object-stream=yes issue114.1-1023.pdf issue114.1-1023.c1.pdf
(Success.)
$ gsnd -dBATCH issue114.1-1023.c1.pdf 
(Success.)

pdfsizeopt can read its own output, and doesn't change it:

$ ./pdfsizeopt --use-pngout=no --do-optimize-fonts=no --do-optimize-images=yes --do-generate-object-stream=yes issue114.c1.pdf issue114.c1.c1.pdf
...
$ cmp issue114.c1.pdf issue114.c1.c1.pdf
(Bitwise equal.)

pts avatar Mar 12 '23 22:03 pts

@jul059: Does this file (issue114.c1.c1fix1.pdf in https://www.mediafire.com/file/ho884noim37ler1/issue114.c1.c1fix1.pdf/file) work in Adobe Acrobat XI Pro?

Ghostscript 9.26 seems to work with it. All I did was moving object 85456 outside of the object stream. I don't understand how this fixes Ghostscript.

pts avatar Mar 12 '23 23:03 pts

@jul059: Does this file (issue114.c1.c1fix1.pdf in https://www.mediafire.com/file/ho884noim37ler1/issue114.c1.c1fix1.pdf/file) work in Adobe Acrobat XI Pro?

Ghostscript 9.26 seems to work with it. All I did was moving object 85456 outside of the object stream. I don't understand how this fixes Ghostscript.

Same error on page 8, like screenshot here.

jul059 avatar Mar 13 '23 00:03 jul059

There may be multiple different bugs:

  • Ghostscript 9.05 just needs all object streams to contain at most 65535 objects (each issue114.c?.pdf has more).
  • Ghostscript 9.26 seems to have a weird requirement violated by object 85456 only if it's part of the object stream.
  • Adobe Acrobat XI Pro seems to have another requirement. We don't know whether this requirement is related to object streams.

This needs more investigation.

pts avatar Mar 13 '23 00:03 pts

@jul059: Could you please try these 2 PDFs in Adobe Acrobat XI Pro? https://www.mediafire.com/file/omzky589falmuhe/issue114.c2.pdf/file and https://www.mediafire.com/file/sx6rs2jmjfosax6/issue114.c3.pdf/file

pts avatar Mar 13 '23 00:03 pts

@jul059: Could you please try these 2 PDFs in Adobe Acrobat XI Pro? https://www.mediafire.com/file/omzky589falmuhe/issue114.c2.pdf/file and https://www.mediafire.com/file/sx6rs2jmjfosax6/issue114.c3.pdf/file

Unfortunately, same error as here.

jul059 avatar Mar 13 '23 01:03 jul059