Closed Keks-Dose closed 7 years ago
Thank you for reporting this issue!
I don't use Emacs, and I don't have easy access to a machine running Windows, but maybe I can still diagnose and improve pdfsizeopt in this situation. For that I need your input. Please copy-paste the messages printed by pdfsizeopt.
Short:
Running `pdfsizeopt' on `170130-Kalender' with ``pdfsizeopt.exe "170130-Kalender".pdf "170130-Kalender".pdf''
info: This is pdfsizeopt ZIP rUNKNOWN size=114611.
info: prepending to PATH: C:\pdfsizeopt\pdfsizeopt_win32exec
info: loading PDF from: 170130-Kalender.pdf
info: loaded PDF of 66849 bytes
info: found 26 obj offsets and 1 obj streams in xref stream
info: separated to 24 objs + xref + trailer
info: found 2 Type1 fonts loaded
info: writing Type1CConverter (47061 font bytes) to: psotmp.5572.conv.tmp.ps
Traceback (most recent call last):
File "C:\pdfsizeopt\pdfsizeopt_win32exec\python26.zip\runpy.py", line 122, in _run_module_as_main
File "C:\pdfsizeopt\pdfsizeopt_win32exec\python26.zip\runpy.py", line 34, in _run_code
File "C:\pdfsizeopt\pdfsizeopt.single\__main__.py", line 1, in <module>
File "C:\pdfsizeopt\pdfsizeopt.single\mainrun.py", line 10, in <module>
File "C:\pdfsizeopt\pdfsizeopt.single\pdfsizeopt\main.py", line 8914, in main
File "C:\pdfsizeopt\pdfsizeopt.single\pdfsizeopt\main.py", line 5654, in ConvertType1FontsToType1C
File "C:\pdfsizeopt\pdfsizeopt.single\pdfsizeopt\main.py", line 5296, in GenerateType1CFontsFromType1
File "C:\pdfsizeopt\pdfsizeopt.single\pdfsizeopt\main.py", line 140, in GetGsCommand
AssertionError: Could not find a working Ghostscript.
TeX Output exited abnormally with code 1 at Thu Aug 17 15:07:59
Path to the PDF is: //Sbs2011/users/aw/Emacs/
Works flawlessly, if path is R:/users/aw/Emacs/
or another mapped path.
Installation of pdfsizeopt according to your manual, so GS is inside C:/pdfsizeopt/ .
Thank you for your time and effort!
Sorry, misunderstood »Close and comment«.
Does the file C:\pdfsizeopt\pdfsizeopt_win32exec\pdfsizeopt_gswin\gswin32c.exe
exist? Please copy-paste the entire output of the command dir /s C:\pdfsizeopt\pdfsizeopt_win32exec
here.
If that file doesn't exist, then please delete C:\pdfsizeopt
recursively, and follow the installation instructions on https://github.com/pts/pdfsizeopt.
Please upgrade to the latest pdfsizeopt, and run pdfsizeopt --do-debug-gs
(you can add .pdf files as arguments) from Emacs, and copy-paste its output here.
gswin32c.exe is there:
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. Alle Rechte vorbehalten.
C:\Windows\System32>dir /s C:\pdfsizeopt\pdfsizeopt_win32exec
Datenträger in Laufwerk C: ist SSD_SYSTEM
Volumeseriennummer: 70BF-EAF7
Verzeichnis von C:\pdfsizeopt\pdfsizeopt_win32exec
02.08.2017 15:46 <DIR> .
02.08.2017 15:46 <DIR> ..
24.01.2017 20:27 169.472 jbig2.exe
27.06.2012 13:39 6.144 pdfsizeopt.exe
02.08.2017 15:47 <DIR> pdfsizeopt_gswin
27.06.2012 13:39 26.624 pdfsizeopt_python.exe
24.01.2017 20:56 179.200 png22pnm.exe
27.06.2012 13:49 38.912 pngout.exe
27.06.2012 13:39 2.148.864 python26.dll
23.04.2014 14:41 83.132 python26.zip
24.01.2017 20:24 386.048 sam2p.exe
8 Datei(en), 3.038.396 Bytes
Verzeichnis von C:\pdfsizeopt\pdfsizeopt_win32exec\pdfsizeopt_gswin
02.08.2017 15:47 <DIR> .
02.08.2017 15:47 <DIR> ..
28.12.2005 20:56 4.324 acctest.ps
28.12.2005 20:56 9.848 addxchar.ps
28.12.2005 20:56 2.313 align.ps
03.06.2010 02:32 353 bdftops
28.12.2005 20:56 23.403 bdftops.ps
14.04.2000 05:59 639 bj8.rpd
28.12.2005 20:56 1.721 caption.ps
25.05.2010 01:06 1.834 cat.ps
19.09.2000 20:29 11.040 cbjc600.ppd
19.09.2000 20:29 11.383 cbjc800.ppd
28.12.2005 20:56 4.475 cid2code.ps
25.06.2012 14:55 120 cidfmap
28.12.2005 20:56 350 decrypt.ps
28.11.2007 19:39 7.373 docie.ps
03.06.2010 02:32 615 dumphint
10.10.2007 19:40 20.044 dumphint.ps
03.06.2010 02:32 1.073 dvipdf
10.10.2007 19:40 1 EndOfTask.ps
03.06.2010 02:32 689 eps2eps
18.08.2006 06:42 762 FAPIconfig-FCO
03.10.2007 19:37 5.802 FCOfontmap-PCLPS3
03.10.2007 19:37 4.384 FCOfontmap-PS3
28.12.2005 20:56 4.581 fixmswrd.pl
03.06.2010 02:32 361 font2c
28.12.2005 20:56 19.591 font2c.ps
28.12.2005 20:56 17.568 font2pcl.ps
28.12.2005 20:56 5.911 Fontmap.ATB
28.12.2005 20:56 5.687 Fontmap.ATM
28.12.2005 20:56 7.271 Fontmap.OS2
09.03.2000 09:40 6.532 Fontmap.OSF
28.12.2005 20:56 13.787 Fontmap.SGI
28.12.2005 20:56 16.466 Fontmap.Sol
28.12.2005 20:56 6.080 Fontmap.Ult
25.05.2010 01:06 20.654 Fontmap.URW-136.T1
25.05.2010 01:06 20.517 Fontmap.URW-136.TT
22.09.2000 05:30 14.409 Fontmap.VMS
02.01.2007 12:36 927 ghostpdf.inf
22.10.2009 20:24 25.643 ghostpdf.ppd
03.06.2010 02:32 398 gsbj
03.06.2010 02:32 400 gsdj
03.06.2010 02:32 403 gsdj500
08.04.2011 14:43 15.044.608 gsdll32.dll
03.06.2010 02:32 401 gslj
03.06.2010 02:32 398 gslp
28.12.2005 20:56 19.643 gslp.ps
03.06.2010 02:32 325 gsnd
28.12.2005 20:56 2.725 gsnup.ps
08.04.2011 14:43 139.264 gswin32.exe
08.04.2011 14:43 139.264 gswin32c.exe
28.12.2005 20:56 2.364 gs_ce_e.ps
28.12.2005 20:56 4.844 gs_cmdl.ps
28.12.2005 20:56 3.162 gs_fform.ps
28.12.2005 20:56 2.777 gs_il2_e.ps
28.12.2005 20:56 3.942 gs_kanji.ps
28.12.2005 20:56 3.291 gs_ksb_e.ps
09.03.2000 09:40 1.945 gs_l.xbm
09.03.2000 09:40 2.751 gs_l.xpm
28.12.2005 20:56 2.886 gs_lgo_e.ps
28.12.2005 20:56 1.912 gs_lgx_e.ps
09.03.2000 09:40 1.955 gs_l_m.xbm
09.03.2000 09:40 945 gs_m.xbm
09.03.2000 09:40 1.437 gs_m.xpm
09.03.2000 09:40 955 gs_m_m.xbm
28.12.2005 20:56 4.349 gs_pfile.ps
28.12.2005 20:56 862 gs_rdlin.ps
09.03.2000 09:40 594 gs_s.xbm
09.03.2000 09:40 957 gs_s.xpm
09.03.2000 09:40 604 gs_s_m.xbm
09.03.2000 09:40 345 gs_t.xbm
09.03.2000 09:40 605 gs_t.xpm
09.03.2000 09:40 355 gs_t_m.xbm
28.12.2005 20:56 2.530 gs_wl1_e.ps
28.12.2005 20:56 2.528 gs_wl2_e.ps
28.12.2005 20:56 2.546 gs_wl5_e.ps
31.12.2007 20:06 228.194 ht_ccsto.ps
28.12.2005 20:56 73.323 image-qa.ps
28.12.2005 20:56 5.538 impath.ps
04.12.2001 01:02 469 Info-macos.plist
28.12.2005 20:56 930 jispaper.ps
06.06.2007 00:23 180 jobseparator.ps
28.12.2005 20:56 1.525 landscap.ps
28.12.2005 20:56 110 level1.ps
28.12.2005 20:56 3.868 lines.ps
28.12.2005 20:56 3.473 markhint.ps
28.12.2005 20:56 1.890 markpath.ps
14.04.2010 12:03 22.459 mkcidfm.ps
15.03.2011 09:35 148.604 opdfread.ps
28.12.2005 20:56 10.358 packfile.ps
28.12.2005 20:56 3.584 pcharstr.ps
03.06.2010 02:32 749 pdf2dsc
21.02.2010 04:38 8.381 pdf2dsc.ps
15.12.2010 17:12 956 pdf2ps
31.01.2011 12:19 1.429 PDFA_def.ps
03.06.2010 02:32 600 pdfopt
23.01.2009 20:04 36.516 pdfopt.ps
27.11.2008 02:58 11.676 pdfwrite.ps
31.01.2011 12:09 1.867 PDFX_def.ps
03.06.2010 02:32 548 pf2afm
13.06.2009 16:33 15.351 pf2afm.ps
03.06.2010 02:32 576 pfbtopfa
28.12.2005 20:56 1.141 pfbtopfa.ps
28.12.2005 20:56 1.974 ppath.ps
03.06.2010 02:32 452 pphs
28.12.2005 20:56 6.922 pphs.ps
06.06.2007 00:23 6.487 prfont.ps
03.06.2010 02:32 447 printafm
27.05.2008 19:07 3.775 printafm.ps
16.05.2009 17:29 22.485 ps2ai.ps
03.06.2010 02:32 792 ps2ascii
08.10.2009 03:53 44.623 ps2ascii.ps
03.06.2010 02:32 2.845 ps2epsi
07.04.2009 12:20 8.187 ps2epsi.ps
05.04.2010 19:22 322 ps2pdf
05.04.2010 19:22 267 ps2pdf12
05.04.2010 19:22 267 ps2pdf13
05.04.2010 19:22 267 ps2pdf14
03.06.2010 02:32 1.149 ps2pdfwr
15.12.2010 17:12 693 ps2ps
03.06.2010 02:32 719 ps2ps2
09.03.2000 09:40 5 quit.ps
29.05.2004 01:58 3.228 rinkj-2200-setup
28.12.2005 20:56 11.765 rollconv.ps
28.12.2005 20:56 2.932 showchar.ps
09.03.2000 09:40 9 showpage.ps
28.12.2005 20:56 25.733 stcinfo.ps
28.12.2005 20:56 5.221 stcolor.ps
06.06.2007 00:23 2.646 stocht.ps
28.12.2005 20:56 1.528 traceimg.ps
28.12.2005 20:56 2.734 traceop.ps
28.12.2005 20:56 2.536 type1enc.ps
28.12.2005 20:56 7.576 type1ops.ps
28.12.2005 20:56 6.136 uninfo.ps
28.12.2005 20:56 1.904 unprot.ps
28.12.2005 20:56 2.113 viewcmyk.ps
28.12.2005 20:56 4.573 viewgif.ps
28.12.2005 20:56 4.949 viewjpeg.ps
28.12.2005 20:56 3.778 viewmiff.ps
28.12.2005 20:56 5.307 viewpbm.ps
28.12.2005 20:56 4.345 viewpcx.ps
28.12.2005 20:56 1.282 viewps2a.ps
05.08.2010 21:16 5.313 viewrgb.ps
03.06.2010 02:32 345 wftopfa
28.12.2005 20:56 8.923 wftopfa.ps
14.06.2006 23:03 3.743 winmaps.ps
28.12.2005 20:56 18.168 wrfont.ps
28.12.2005 20:56 2.463 zeroline.ps
146 Datei(en), 16.524.024 Bytes
Anzahl der angezeigten Dateien:
154 Datei(en), 19.562.420 Bytes
5 Verzeichnis(se), XXX Bytes frei
C:\Windows\System32>
OK, with debug: pdfsizeopt.exe --do-debug-gs=yes "170130-Kalender".pdf "170130-Kalender".pdf
Running `pdfsizeopt' on `170130-Kalender' with ``pdfsizeopt.exe --do-debug-gs=yes "170130-Kalender".pdf "170130-Kalender".pdf''
info: This is pdfsizeopt ZIP rUNKNOWN size=127461.
info: prepending to PATH: C:\pdfsizeopt\pdfsizeopt_win32exec
info: PATH: C:\pdfsizeopt\pdfsizeopt_win32exec;C:\texlive\2017\bin\win32;...[shortened by OP];C:\Program Files (x86)\hunspell-1.3.2-3-w32-bin\bin;C:\pdfsizeopt;C:\Program Files\OpenVPN\bin;C:\Program Files (x86)\GNU\GnuPG\pub;C:\Program Files\Java\jre1.8.0_131\bin;C:\msys64\mingw64\bin;C:\msys64\usr\bin ...
info: getcwd: \\Sbs2011\users\aw\Emacs
info: verifying Ghostscript: "C:\pdfsizeopt\pdfsizeopt_win32exec\pdfsizeopt_gswin\gswin32c.exe"
info: output from Ghostscript: ''
info: Ghostscript failed
info: verifying Ghostscript: gswin32c
info: output from Ghostscript: ''
info: Ghostscript failed
Traceback (most recent call last):
File "C:\pdfsizeopt\pdfsizeopt_win32exec\python26.zip\runpy.py", line 122, in _run_module_as_main
File "C:\pdfsizeopt\pdfsizeopt_win32exec\python26.zip\runpy.py", line 34, in _run_code
File "C:\pdfsizeopt\pdfsizeopt.single\__main__.py", line 1, in <module>
File "C:\pdfsizeopt\pdfsizeopt.single\mainrun.py", line 10, in <module>
File "C:\pdfsizeopt\pdfsizeopt.single\pdfsizeopt\main.py", line 8560, in main
File "C:\pdfsizeopt\pdfsizeopt.single\pdfsizeopt\main.py", line 154, in GetGsCommand
AssertionError: Could not find a working Ghostscript.
TeX Output exited abnormally with code 1 at Mon Aug 28 18:55:31
Does this help? Thank you for your time and effort!
Yes, thank your attaching all the debug outputs! They are very helpful for me for diagnosis.
Good news: gswin32c.exe is at the correct location, your $PATH
is set up correctly, an Emacs and pdfsizeopt don't break it.
It looks like Ghostscript doesn't work if the current working directory is a UNC path. I want to make sure this is the case, so I'm asking additional logs from you:
Additionally, please rerun pdfsizeopt from Emacs with a non-UNC path as the current directory (getcwd), with --do-debug-gs=yes
, and copy-paste the output of pdfsizeopt.
Additionally, please rerun pdfsizeopt from outside Emacs (e.g. cmd.exe) with a UNC path as the current directory (getcwd), with --do-debug-gs=yes
, and copy-paste the output of pdfsizeopt.
If it's indeed the case, then it's possible add a workaround to pdfsizeopt: pdfsizeopt will change the current working directory to C:\
before running Ghostscript, and then it will change it back. But this workaround will be ugly, and many code locations have to be changed. I'm waiting for additional input from you before I start implementing the workaround.
Same file as before, but opened in Emacs from a mapped path (U: in this case; again I shortened the $PATH output):
Running `pdfsizeopt' on `170130-Kalender' with ``pdfsizeopt.exe --do-debug-gs=yes "170130-Kalender".pdf "170130-Kalender".pdf''
Type1CConverter: using interpreter GPL Ghostscript 902 20110330
Type1CConverter: converting font /IXQLTW+TeXGyreHeros-Bold to /Obj0000000021
Type1CConverter: converting font /ESELED+TeXGyreHeros-Regular to /Obj0000000023
Type1CConverter: all OK
Type1CParser: using interpreter GPL Ghostscript 902 20110330
Type1CParser: all OK
Type1CGenerator: using interpreter GPL Ghostscript 902 20110330
Type1CGenerator: all OK
info: This is pdfsizeopt ZIP rUNKNOWN size=127461.
info: prepending to PATH: C:\pdfsizeopt\pdfsizeopt_win32exec
info: PATH: C:\pdfsizeopt\pdfsizeopt_win32exec;C:\texlive\2017\bin\win32; [shortened]...
info: getcwd: u:\Emacs
info: verifying Ghostscript: "C:\pdfsizeopt\pdfsizeopt_win32exec\pdfsizeopt_gswin\gswin32c.exe"
info: output from Ghostscript: 'GPL Ghostscript 9.02 (2011-03-30)\nCopyright (C) 2010 Artifex Software, Inc. All rights reserved.\nThis software comes with NO WARRANTY: see the file PUBLIC for details.\n/GSOK\n'
info: Ghostscript version info: 'GPL Ghostscript 9.02 (2011-03-30)'
info: using Ghostscript "C:\pdfsizeopt\pdfsizeopt_win32exec\pdfsizeopt_gswin\gswin32c.exe": GPL Ghostscript 9.02 (2011-03-30)
info: found working Ghostscript: "C:\pdfsizeopt\pdfsizeopt_win32exec\pdfsizeopt_gswin\gswin32c.exe"
info: loading PDF from: 170130-Kalender.pdf
info: loaded PDF of 66849 bytes
info: found 26 obj offsets and 1 obj streams in xref stream
info: separated to 24 objs + xref + trailer
info: found 2 Type1 fonts loaded
info: writing Type1CConverter (47061 font bytes) to: psotmp.5596.conv.tmp.ps
info: executing Type1CConverter with Ghostscript: "C:\pdfsizeopt\pdfsizeopt_win32exec\pdfsizeopt_gswin\gswin32c.exe" -q -P- -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/printer -dColorConversionStrategy=/LeaveColorUnchanged -sOutputFile=psotmp.5596.conv.tmp.pdf -f psotmp.5596.conv.tmp.ps
info: loading PDF from: psotmp.5596.conv.tmp.pdf
info: loaded PDF of 12830 bytes
info: separated to 19 objs + xref + trailer
info: found 2 fonts in GS output
info: optimized total Type1 font size 47053 to Type1C font size 7449 (16%)
info: optimized Type1 font XObject 21,20: new size=3684 (16%)
info: optimized Type1 font XObject 23,22: new size=4652 (19%)
info: found 2 Type1C fonts loaded
info: writing Type1CParser (7438 font bytes) to: psotmp.5596.conv.parse.tmp.ps
info: executing Type1CParser with Ghostscript: "C:\pdfsizeopt\pdfsizeopt_win32exec\pdfsizeopt_gswin\gswin32c.exe" -q -P- -dNOPAUSE -dBATCH -sDEVICE=nullpage -sDataFile=psotmp.5596.conv.parsedata.tmp.ps -f psotmp.5596.conv.parse.tmp.ps
info: parsed 2 Type1C fonts
info: writing Type1CGenerator (18305 bytes in 2 fonts) to: psotmp.5596.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=psotmp.5596.conv.gen.tmp.pdf -f psotmp.5596.conv.gen.tmp.ps
info: loading PDF from: psotmp.5596.conv.gen.tmp.pdf
info: loaded PDF of 12549 bytes
info: separated to 19 objs + xref + trailer
info: found 2 fonts loaded
info: optimized Type1C fonts to form 7862 bytes to 7854 bytes (100%)
info: eliminated 2 duplicate objs
info: eliminated 2 unused objs in 2 classes
info: compressed 0 streams, kept 0 of them uncompressed
info: saving PDF with 20 objs to: 170130-Kalender.pdf
info: generated object stream of 1194 bytes in 16 objects (16%)
info: generated 26599 bytes (40%)
TeX Output finished at Tue Aug 29 11:47:57
I can not find a way to make cmd on Windows 8.1 accept an UNC path for the current directory. I've tried a change of registry that used to work in earlier versions of Windows, but no avail. So I have to start from a mapped path:
C:\Windows\System32>pdfsizeopt \\SBS2011\users\aw\Emacs\170130-Kalender.pdf \\SB
S2011\users\aw\Emacs\170130-Kalender.pdf
info: This is pdfsizeopt ZIP rUNKNOWN size=127461.
info: prepending to PATH: C:\pdfsizeopt\pdfsizeopt_win32exec
info: loading PDF from: \\SBS2011\users\aw\Emacs\170130-Kalender.pdf
info: loaded PDF of 66849 bytes
info: found 26 obj offsets and 1 obj streams in xref stream
info: separated to 24 objs + xref + trailer
info: found 2 Type1 fonts loaded
info: writing Type1CConverter (47061 font bytes) to: \\SBS2011\users\aw\Emacs\ps
otmp.3376.conv.tmp.ps
info: using Ghostscript "C:\pdfsizeopt\pdfsizeopt_win32exec\pdfsizeopt_gswin\gsw
in32c.exe": GPL Ghostscript 9.02 (2011-03-30)
info: executing Type1CConverter with Ghostscript: "C:\pdfsizeopt\pdfsizeopt_win3
2exec\pdfsizeopt_gswin\gswin32c.exe" -q -P- -dNOPAUSE -dBATCH -sDEVICE=pdfwrite
-dPDFSETTINGS=/printer -dColorConversionStrategy=/LeaveColorUnchanged -sOutputFi
le=\\SBS2011\users\aw\Emacs\psotmp.3376.conv.tmp.pdf -f \\SBS2011\users\aw\Emacs
\psotmp.3376.conv.tmp.ps
Type1CConverter: using interpreter GPL Ghostscript 902 20110330
Type1CConverter: converting font /IXQLTW+TeXGyreHeros-Bold to /Obj0000000021
Type1CConverter: converting font /ESELED+TeXGyreHeros-Regular to /Obj0000000023
Type1CConverter: all OK
info: loading PDF from: \\SBS2011\users\aw\Emacs\psotmp.3376.conv.tmp.pdf
info: loaded PDF of 12830 bytes
info: separated to 19 objs + xref + trailer
info: found 2 fonts in GS output
info: optimized total Type1 font size 47053 to Type1C font size 7449 (16%)
info: optimized Type1 font XObject 21,20: new size=3684 (16%)
info: optimized Type1 font XObject 23,22: new size=4652 (19%)
info: found 2 Type1C fonts loaded
info: writing Type1CParser (7438 font bytes) to: \\SBS2011\users\aw\Emacs\psotmp
.3376.conv.parse.tmp.ps
info: executing Type1CParser with Ghostscript: "C:\pdfsizeopt\pdfsizeopt_win32ex
ec\pdfsizeopt_gswin\gswin32c.exe" -q -P- -dNOPAUSE -dBATCH -sDEVICE=nullpage -sD
ataFile=\\SBS2011\users\aw\Emacs\psotmp.3376.conv.parsedata.tmp.ps -f \\SBS2011\
users\aw\Emacs\psotmp.3376.conv.parse.tmp.ps
Type1CParser: using interpreter GPL Ghostscript 902 20110330
Type1CParser: all OK
info: parsed 2 Type1C fonts
info: writing Type1CGenerator (18305 bytes in 2 fonts) to: \\SBS2011\users\aw\Em
acs\psotmp.3376.conv.gen.tmp.ps
info: executing Type1CGenerator with Ghostscript: "C:\pdfsizeopt\pdfsizeopt_win3
2exec\pdfsizeopt_gswin\gswin32c.exe" -q -P- -dNOPAUSE -dBATCH -sDEVICE=pdfwrite
-dPDFSETTINGS=/printer -dColorConversionStrategy=/LeaveColorUnchanged -sOutputFi
le=\\SBS2011\users\aw\Emacs\psotmp.3376.conv.gen.tmp.pdf -f \\SBS2011\users\aw\E
macs\psotmp.3376.conv.gen.tmp.ps
Type1CGenerator: using interpreter GPL Ghostscript 902 20110330
Type1CGenerator: all OK
info: loading PDF from: \\SBS2011\users\aw\Emacs\psotmp.3376.conv.gen.tmp.pdf
info: loaded PDF of 12549 bytes
info: separated to 19 objs + xref + trailer
info: found 2 fonts loaded
info: optimized Type1C fonts to form 7862 bytes to 7854 bytes (100%)
info: eliminated 2 duplicate objs
info: eliminated 2 unused objs in 2 classes
info: compressed 0 streams, kept 0 of them uncompressed
info: saving PDF with 20 objs to: \\SBS2011\users\aw\Emacs\170130-Kalender.pdf
info: generated object stream of 1192 bytes in 16 objects (16%)
info: generated 26597 bytes (40%)
C:\Windows\System32>
These console outputs are very useful, thank you for posting them!
Until I implement a workaround in pdfsizeopt, please don't run it with a UNC path as the current directory.
FYI I'm not able to reproduce the bad behavior in wine-1.6.2 on Linux: under Wine it works even if the current directory is an UNC path.
Since I'm unable to reproduce the problem in my setup, I'm asking you to do some more test runs:
C:\pdfsizeopt\pdfsizeopt.single
(overwriting the old file). It will do a c:
and cd \
before running Ghostscript.--do-debug-gs=yes
, and copy-paste the output to this issue. (Expect Ghostscript detection to succeed, but actual Ghostscript running to fail.)C:\pdfsizeopt\pdfsizeopt.single
. This will undo the debugging changes.Please note that I've added a new binary release for Windows: https://github.com/pts/pdfsizeopt/releases/download/2017-08-29w/pdfsizeopt_win32exec-v5.zip. You may want to delete your C:\pdfsizeopt\pdfsizeopt_win32exec
directory (and pdfsizeopt.exe
) and replace it with the contents of this new pdfsizeopt_win32exec-v5.zip. It contains a bit newer version of Ghostscript, but it's still unlikely to fix this bug, but I hope it will make the behavior more consistent across systems.
I've implemented the ugly workaround in b9f8b97ecc0c355ac60080c917a2ed68c0ffd8e4; this should fix the bug for you. Please download the newest pdfsizeopt.single, and try if it works work for you in Emacs with and without a UNC path in the current directory.
Please also copy-paste the messages I asked for above (with pdfsizeopt.single.zip).
OK, downloaded and renamed the pdfsizeopt.single.zip; surprisingly it worked well:
Running `pdfsizeopt' on `170130-Kalender' with ``pdfsizeopt.exe --do-debug-gs=yes "170130-Kalender".pdf "170130-Kalender".pdf''
Type1CConverter: using interpreter GPL Ghostscript 902 20110330
Type1CConverter: converting font /SDBKSU+LinBiolinumB to /Obj0000000023
Type1CConverter: converting font /BARZOQ+LinBiolinum to /Obj0000000025
Type1CConverter: all OK
Type1CParser: using interpreter GPL Ghostscript 902 20110330
Type1CParser: all OK
Type1CGenerator: using interpreter GPL Ghostscript 902 20110330
Type1CGenerator: all OK
info: This is pdfsizeopt ZIP rUNKNOWN size=128399.
info: prepending to PATH: C:\pdfsizeopt\pdfsizeopt_win32exec
info: PATH: C:\pdfsizeopt\pdfsizeopt_win32exec;C:\texlive\2017\bin\win32;...
info: getcwd: \\Sbs2011\users\aw\Emacs
info: verifying Ghostscript: c:&cd \&"C:\pdfsizeopt\pdfsizeopt_win32exec\pdfsizeopt_gswin\gswin32c.exe"
info: output from Ghostscript: 'GPL Ghostscript 9.02 (2011-03-30)\nCopyright (C) 2010 Artifex Software, Inc. All rights reserved.\nThis software comes with NO WARRANTY: see the file PUBLIC for details.\n/GSOK\n'
info: Ghostscript version info: 'GPL Ghostscript 9.02 (2011-03-30)'
info: using Ghostscript "C:\pdfsizeopt\pdfsizeopt_win32exec\pdfsizeopt_gswin\gswin32c.exe": GPL Ghostscript 9.02 (2011-03-30)
info: found working Ghostscript: "C:\pdfsizeopt\pdfsizeopt_win32exec\pdfsizeopt_gswin\gswin32c.exe"
info: loading PDF from: 170130-Kalender.pdf
info: loaded PDF of 186748 bytes
info: found 28 obj offsets and 1 obj streams in xref stream
info: separated to 26 objs + xref + trailer
info: found 2 Type1 fonts loaded
info: writing Type1CConverter (166411 font bytes) to: psotmp.984.conv.tmp.ps
info: executing Type1CConverter with Ghostscript: "C:\pdfsizeopt\pdfsizeopt_win32exec\pdfsizeopt_gswin\gswin32c.exe" -q -P- -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/printer -dColorConversionStrategy=/LeaveColorUnchanged -sOutputFile=psotmp.984.conv.tmp.pdf -f psotmp.984.conv.tmp.ps
info: loading PDF from: psotmp.984.conv.tmp.pdf
info: loaded PDF of 17846 bytes
info: separated to 20 objs + xref + trailer
info: found 2 fonts in GS output
info: optimized total Type1 font size 166403 to Type1C font size 11815 (7%)
info: optimized Type1 font XObject 25,24: new size=6905 (9%)
info: optimized Type1 font XObject 23,22: new size=5780 (7%)
info: found 2 Type1C fonts loaded
info: writing Type1CParser (11802 font bytes) to: psotmp.984.conv.parse.tmp.ps
info: executing Type1CParser with Ghostscript: "C:\pdfsizeopt\pdfsizeopt_win32exec\pdfsizeopt_gswin\gswin32c.exe" -q -P- -dNOPAUSE -dBATCH -sDEVICE=nullpage -sDataFile=psotmp.984.conv.parsedata.tmp.ps -f psotmp.984.conv.parse.tmp.ps
info: parsed 2 Type1C fonts
info: writing Type1CGenerator (33158 bytes in 2 fonts) to: psotmp.984.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=psotmp.984.conv.gen.tmp.pdf -f psotmp.984.conv.gen.tmp.ps
info: loading PDF from: psotmp.984.conv.gen.tmp.pdf
info: loaded PDF of 17553 bytes
info: separated to 20 objs + xref + trailer
info: found 2 fonts loaded
info: optimized Type1C fonts to form 12214 bytes to 12209 bytes (100%)
info: eliminated 1 duplicate objs
info: eliminated 2 unused objs in 2 classes
info: compressed 0 streams, kept 0 of them uncompressed
info: saving PDF with 23 objs to: 170130-Kalender.pdf
info: generated object stream of 1390 bytes in 19 objects (19%)
info: generated 31501 bytes (17%)
TeX Output finished at Fri Sep 1 15:47:52
In my *.tex file I added the libertine package as font, because it is a huge font and bloats the PDF. After using pdfsizeopt with the new pdfsize.single.zip renamed, I get the output above.
Sorry I did not answer earlier, was on a business trip.
And the new versions /v5 and pdfsizeopt.single don't work at all:
Running `pdfsizeopt' on `170130-Kalender' with ``pdfsizeopt.exe --do-debug-gs=yes "170130-Kalender".pdf "170130-Kalender".pdf''
info: This is pdfsizeopt ZIP rUNKNOWN size=115100.
Traceback (most recent call last):
File "C:\pdfsizeopt\pdfsizeopt_win32exec\python26.zip\runpy.py", line 122, in _run_module_as_main
File "C:\pdfsizeopt\pdfsizeopt_win32exec\python26.zip\runpy.py", line 34, in _run_code
File "C:\pdfsizeopt\pdfsizeopt.single\__main__.py", line 1, in <module>
File "C:\pdfsizeopt\pdfsizeopt.single\mainrun.py", line 10, in <module>
File "C:\pdfsizeopt\pdfsizeopt.single\pdfsizeopt\main.py", line 8988, in main
File "C:\pdfsizeopt\pdfsizeopt.single\pdfsizeopt\main.py", line 8786, in GetLibexecDir
NameError: global name 'libexec_dir' is not defined
TeX Output exited abnormally with code 1 at Fri Sep 1 16:05:10
Hi!
I updated to version v6 and get a new kind of error under Windows, see last line:
Running `pdfsizeopt' on `Kalender' with ``pdfsizeopt.exe "Kalender".pdf "Kalender".pdf''
Type1CConverter: using interpreter GPL Ghostscript 905 20120208
Type1CConverter: converting font /YPXHNG+LinLibertineB to /Obj0000000012
Type1CConverter: converting font /AFANNV+LinLibertine to /Obj0000000014
Type1CConverter: all OK
Type1CParser: using interpreter GPL Ghostscript 905 20120208
Type1CParser: all OK
Type1CGenerator: using interpreter GPL Ghostscript 905 20120208
Type1CGenerator: all OK
info: This is pdfsizeopt ZIP rUNKNOWN size=63735.
info: prepending to PATH: C:\pdfsizeopt\pdfsizeopt_win32exec
info: loading PDF from: Kalender.pdf
info: loaded PDF of 221268 bytes
info: found 17 obj offsets and 1 obj streams in xref stream
info: separated to 15 objs + xref + trailer
info: found 2 Type1 fonts loaded
info: writing Type1CConverter (216791 font bytes) to: psotmp.5396.conv.tmp.ps
info: using Ghostscript C:\pdfsizeopt\pdfsizeopt_win32exec\pdfsizeopt_gswin\gswin32c.exe: GPL Ghostscript 9.05 (2012-02-08)
info: executing Type1CConverter with Ghostscript: C:\pdfsizeopt\pdfsizeopt_win32exec\pdfsizeopt_gswin\gswin32c.exe -q -P- -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/printer -dColorConversionStrategy=/LeaveColorUnchanged -sOutputFile=psotmp.5396.conv.tmp.pdf -f psotmp.5396.conv.tmp.ps
info: loading PDF from: psotmp.5396.conv.tmp.pdf
info: loaded PDF of 16960 bytes
info: separated to 16 objs + xref + trailer
info: found 2 fonts in GS output
info: optimized total Type1 font size 216783 to Type1C font size 12224 (6%)
info: optimized Type1 font XObject 12,11: new size=4732 (4%)
info: optimized Type1 font XObject 14,13: new size=8326 (8%)
info: found 2 Type1C fonts loaded
info: writing Type1CParser (12207 font bytes) to: psotmp.5396.conv.parse.tmp.ps
info: executing Type1CParser with Ghostscript: C:\pdfsizeopt\pdfsizeopt_win32exec\pdfsizeopt_gswin\gswin32c.exe -q -P- -dNOPAUSE -dBATCH -sDEVICE=nullpage -sDataFile=psotmp.5396.conv.parsedata.tmp.ps -f psotmp.5396.conv.parse.tmp.ps
info: parsed 2 Type1C fonts
info: writing Type1CGenerator (32032 bytes in 2 fonts) to: psotmp.5396.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=psotmp.5396.conv.gen.tmp.pdf -f psotmp.5396.conv.gen.tmp.ps
info: loading PDF from: psotmp.5396.conv.gen.tmp.pdf
info: loaded PDF of 16893 bytes
info: separated to 18 objs + xref + trailer
info: found 2 fonts loaded
info: optimized Type1C fonts to form 12623 bytes to 12618 bytes (100%)
info: eliminated 1 unused objs in 1 classes
info: compressed 0 streams, kept 0 of them uncompressed
info: saving PDF with 14 objs to: Kalender.pdf
info: generated object stream of 1066 bytes in 11 objects (23%)
info: generated 16029 bytes (7%)
Traceback (most recent call last):
File "C:\pdfsizeopt\pdfsizeopt_win32exec\python26.zip\runpy.py", line 122, in _run_module_as_main
File "C:\pdfsizeopt\pdfsizeopt_win32exec\python26.zip\runpy.py", line 34, in _run_code
File "C:\pdfsizeopt\pdfsizeopt.single\__main__.py", line 1, in <module>
File "C:\pdfsizeopt\pdfsizeopt.single\m.py", line 6, in <module>
File "C:\pdfsizeopt\pdfsizeopt.single\pdfsizeopt\main.py", line 5060, in main
WindowsError: [Error 183] Eine Datei kann nicht erstellt werden, wenn sie bereits vorhanden ist
TeX Output exited abnormally with code 1 at Fri Sep 8 13:46:08
Thank you for your patience and the details! I was able to fix it based on the info you provided. The newest version should work now. Please download the latest pdfsizeopt.single, and retry first with a UNC path, and then with a non-UNC path as the current directory.
The error in English, with line snippet:
File "C:\pdfsizeopt\pdfsizeopt.single\pdfsizeopt\main.py", line 5060, in main
os.rename(output_file_name+'.tmp',output_file_name)
WindowsError: [Error 183] Cannot create a file when that file already exists
Fixed in 12a637ca6453717bb02e153ba3587461b981b432.
YES! Works now. By the way, I realised that Multivalent.jar no longer is in the archiv, however, it still reduces the size of a PDF much.
Let me emphasize: Thank you very much for this software.
Thank you for using pdfsizeopt and improving it by submitting bug reports!
If you happen to have a PDF which doesn't convert correctly with pdfsizeopt, with or without Multivalent enabled, or where there is a big size difference when enabling Multivalent, please open and issue, and I'll be happy to investigate. Your input is very much appreciated.
You may be interested to know that pdfsizeopt now supports filenames (and pathnames) with spaces in them on Windows. (You need to escape them with double quotes on the command-line, the usual way.)
Hi, @pts.
On Sep 15 2017, Péter Szabó wrote:
If you happen to have a PDF which doesn't convert correctly with pdfsizeopt, with or without Multivalent enabled, or where there is a big size difference when enabling Multivalent,
I have to hunt it here, but I think that I have a file that enabling Multivalent makes the file about 50% smaller or more. I will send it as soon as I find it.
Thanks,
-- Rogério Brito : rbrito@{ime.usp.br,gmail.com} : GPG key 4096R/BCFCAAAA http://cynic.cc/blog/ : github.com/rbrito : profiles.google.com/rbrito DebianQA: http://qa.debian.org/developer.php?login=rbrito%40ime.usp.br
.
I'm working with Emacs under Windows 8.1 in a network. The call of pdfsizeopt from inside Emacs is something like:
pdfsizeopt.exe XXX.pdf XXX.pdf
but the filename plus path is//Sbs2011/path/to/file/XXX.pdf
Under Emacs this results in the error that pdfsizeopt is not able to find a working Ghostscript, like I described here: https://github.com/pts/pdfsizeopt/issues/15I asked for help on the AUCTeX-Mailinglist today and after bisecting my whole .emacs, I finally discovered that it depends from the path! If the file resides in an UNC-path, Emacs runs pdfsizeopt, but pdfsizeopt hangs when trying to locate Ghostscript!
Is this even a bug? And if, of which software? Windows, Emacs, pdfsizeopt?