#StackBounty: #error-handling #path #customization On Windows 8.1, in Emacs Ghostscript doesn't work, while on commandline it does

Bounty: 50

I’m using Emacs / AUCTeX (OS: Win 8.1) to compile LaTeX files. To shrink the PDF afterwards, I’m using pdfsizeopt. The command is easy:

pdfsizeopt.exe input.pdf output.pdf

OK, opening cmd.exe in a folder of a PDF, which I’d like to shrink, it works. This is the relevant part of the output (many lines cut out, irrelevant):

T:somefolder>pdfsizeopt.exe name-of-pdf.pdf name-of-pdf.pdf
info: This is pdfsizeopt ZIP rUNKNOWN size=105563.
info: loading PDF from: name-of-pdf.pdf
info: loaded PDF of 858466 bytes
info: found 92 obj offsets and 1 obj streams in xref stream
info: separated to 90 objs + xref + trailer
warning: cannot parse obj 24: pdfsizeopt.main.PdfIndirectLengthError: missing ob
j for indirect /Length 45 0 R at ofs=20434
info: found 6 Type1 fonts loaded
info: writing Type1CConverter (435161 font bytes) to: psotmp.5420.conv.tmp.ps
info: using Ghostscript "C:Program Files (x86)gsgs9.21bingswin32c.exe": GPL
 Ghostscript 9.21 (2017-03-16)
info: executing Type1CConverter with Ghostscript: "C:Program Files (x86)gsgs9
.21bingswin32c.exe" -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/prin
ter -dColorConversionStrategy=/LeaveColorUnchanged -sOutputFile=psotmp.5420.conv
.tmp.pdf -f psotmp.5420.conv.tmp.ps
Type1CConverter: using interpreter GPL Ghostscript 921 20170316
Type1CConverter: converting font /TBQTVH+LinBiolinum to /Obj0000000077
Type1CConverter: converting font /MKHCTZ+LMMathSymbols8-Regular to /Obj000000008
7
Type1CConverter: all OK
info: loading PDF from: psotmp.5420.conv.tmp.pdf
info: loaded PDF of 31339 bytes
info: separated to 30 objs + xref + trailer
info: found 6 fonts in GS output
info: optimized total Type1 font size 435229 to Type1C font size 22200 (5%)
info: optimized Type1 font XObject 87,86: new size=658 (25%)
info: found 6 Type1C fonts loaded
info: writing Type1CParser (22080 font bytes) to: psotmp.5420.conv.parse.tmp.ps
info: executing Type1CParser with Ghostscript: "C:Program Files (x86)gsgs9.21
bingswin32c.exe" -q -dNOPAUSE -dBATCH -sDEVICE=nullpage -sDataFile=psotmp.5420
.conv.parsedata.tmp.ps -f psotmp.5420.conv.parse.tmp.ps
Type1CParser: using interpreter GPL Ghostscript 921 20170316
Type1CParser: all OK
info: parsed 6 Type1C fonts
info: eliminated 1 duplicate objs
info: eliminated 21 unused objs in 21 classes
warning: obj 24 missing, referenced by objs [21]...
info: compressed 2 streams, kept 2 of them uncompressed
info: saving PDF with 47 objs to: name-of-pdf.pdf
info: generated object stream of 3118 bytes in 37 objects (18%)
info: generated 40874 bytes (5%)


T:somefolder>

As you can observe, Ghostscript is being found by pdfsizeopt. All is well.

Now, if I’m calling it via Emacs (64-bit):

Running `pdfsizeopt' on `name-of-pdf' with ``pdfsizeopt.exe "name-of-pdf".pdf "name-of-pdf".pdf''
info: This is pdfsizeopt ZIP rUNKNOWN size=105563.
info: loading PDF from: name-of-pdf.pdf
info: loaded PDF of 858466 bytes
info: found 92 obj offsets and 1 obj streams in xref stream
info: separated to 90 objs + xref + trailer
warning: cannot parse obj 24: pdfsizeopt.main.PdfIndirectLengthError: missing obj for indirect /Length 45 0 R at ofs=20434

info: found 6 Type1 fonts loaded
info: writing Type1CConverter (435161 font bytes) to: psotmp.6548.conv.tmp.ps
info: this Ghostscript does not work: "C:Program Files (x86)gsgs9.21bingswin32c.exe"
info: this Ghostscript does not work: "C:Program Files (x86)gsgs9.21bingswin32c.exe"
Traceback (most recent call last):
  File "C:pdfsizeoptpdfsizeopt_win32execpython26.ziprunpy.py", line 122, in _run_module_as_main
  File "C:pdfsizeoptpdfsizeopt_win32execpython26.ziprunpy.py", line 34, in _run_code
  File "C:pdfsizeoptpdfsizeopt.single__main__.py", line 1, in <module>
  File "C:pdfsizeoptpdfsizeopt.singlemainrun.py", line 10, in <module>
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 8240, in main
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 5341, in ConvertType1FontsToType1C
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 5058, in GenerateType1CFontsFromType1
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 140, in GetGsCommand
AssertionError: Could not find a working Ghostscript.

TeX Output exited abnormally with code 1 at Tue Apr 25 17:20:00

Why on earth does the same Ghostscript installation not work, if called from Emacs?

Is there an issue with the spaces in “Program Files (x86)”?

In my .emacs, I have defined calling pdfsizeopt this way:

(eval-after-load "tex"
'(add-to-list 'TeX-command-list
'("pdfsizeopt" "pdfsizeopt.exe %s.pdf %s.pdf" TeX-run-command t t :help "Run pdfsizeopt.exe") t))

Has been working for years.


Get this bounty!!!

#StackBounty: #error-handling #path #customization On Windows 8.1, in Emacs Ghostscript doesn't work, while on commandline it does

Bounty: 50

I’m using Emacs / AUCTeX (OS: Win 8.1) to compile LaTeX files. To shrink the PDF afterwards, I’m using pdfsizeopt. The command is easy:

pdfsizeopt.exe input.pdf output.pdf

OK, opening cmd.exe in a folder of a PDF, which I’d like to shrink, it works. This is the relevant part of the output (many lines cut out, irrelevant):

T:somefolder>pdfsizeopt.exe name-of-pdf.pdf name-of-pdf.pdf
info: This is pdfsizeopt ZIP rUNKNOWN size=105563.
info: loading PDF from: name-of-pdf.pdf
info: loaded PDF of 858466 bytes
info: found 92 obj offsets and 1 obj streams in xref stream
info: separated to 90 objs + xref + trailer
warning: cannot parse obj 24: pdfsizeopt.main.PdfIndirectLengthError: missing ob
j for indirect /Length 45 0 R at ofs=20434
info: found 6 Type1 fonts loaded
info: writing Type1CConverter (435161 font bytes) to: psotmp.5420.conv.tmp.ps
info: using Ghostscript "C:Program Files (x86)gsgs9.21bingswin32c.exe": GPL
 Ghostscript 9.21 (2017-03-16)
info: executing Type1CConverter with Ghostscript: "C:Program Files (x86)gsgs9
.21bingswin32c.exe" -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/prin
ter -dColorConversionStrategy=/LeaveColorUnchanged -sOutputFile=psotmp.5420.conv
.tmp.pdf -f psotmp.5420.conv.tmp.ps
Type1CConverter: using interpreter GPL Ghostscript 921 20170316
Type1CConverter: converting font /TBQTVH+LinBiolinum to /Obj0000000077
Type1CConverter: converting font /MKHCTZ+LMMathSymbols8-Regular to /Obj000000008
7
Type1CConverter: all OK
info: loading PDF from: psotmp.5420.conv.tmp.pdf
info: loaded PDF of 31339 bytes
info: separated to 30 objs + xref + trailer
info: found 6 fonts in GS output
info: optimized total Type1 font size 435229 to Type1C font size 22200 (5%)
info: optimized Type1 font XObject 87,86: new size=658 (25%)
info: found 6 Type1C fonts loaded
info: writing Type1CParser (22080 font bytes) to: psotmp.5420.conv.parse.tmp.ps
info: executing Type1CParser with Ghostscript: "C:Program Files (x86)gsgs9.21
bingswin32c.exe" -q -dNOPAUSE -dBATCH -sDEVICE=nullpage -sDataFile=psotmp.5420
.conv.parsedata.tmp.ps -f psotmp.5420.conv.parse.tmp.ps
Type1CParser: using interpreter GPL Ghostscript 921 20170316
Type1CParser: all OK
info: parsed 6 Type1C fonts
info: eliminated 1 duplicate objs
info: eliminated 21 unused objs in 21 classes
warning: obj 24 missing, referenced by objs [21]...
info: compressed 2 streams, kept 2 of them uncompressed
info: saving PDF with 47 objs to: name-of-pdf.pdf
info: generated object stream of 3118 bytes in 37 objects (18%)
info: generated 40874 bytes (5%)


T:somefolder>

As you can observe, Ghostscript is being found by pdfsizeopt. All is well.

Now, if I’m calling it via Emacs (64-bit):

Running `pdfsizeopt' on `name-of-pdf' with ``pdfsizeopt.exe "name-of-pdf".pdf "name-of-pdf".pdf''
info: This is pdfsizeopt ZIP rUNKNOWN size=105563.
info: loading PDF from: name-of-pdf.pdf
info: loaded PDF of 858466 bytes
info: found 92 obj offsets and 1 obj streams in xref stream
info: separated to 90 objs + xref + trailer
warning: cannot parse obj 24: pdfsizeopt.main.PdfIndirectLengthError: missing obj for indirect /Length 45 0 R at ofs=20434

info: found 6 Type1 fonts loaded
info: writing Type1CConverter (435161 font bytes) to: psotmp.6548.conv.tmp.ps
info: this Ghostscript does not work: "C:Program Files (x86)gsgs9.21bingswin32c.exe"
info: this Ghostscript does not work: "C:Program Files (x86)gsgs9.21bingswin32c.exe"
Traceback (most recent call last):
  File "C:pdfsizeoptpdfsizeopt_win32execpython26.ziprunpy.py", line 122, in _run_module_as_main
  File "C:pdfsizeoptpdfsizeopt_win32execpython26.ziprunpy.py", line 34, in _run_code
  File "C:pdfsizeoptpdfsizeopt.single__main__.py", line 1, in <module>
  File "C:pdfsizeoptpdfsizeopt.singlemainrun.py", line 10, in <module>
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 8240, in main
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 5341, in ConvertType1FontsToType1C
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 5058, in GenerateType1CFontsFromType1
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 140, in GetGsCommand
AssertionError: Could not find a working Ghostscript.

TeX Output exited abnormally with code 1 at Tue Apr 25 17:20:00

Why on earth does the same Ghostscript installation not work, if called from Emacs?

Is there an issue with the spaces in “Program Files (x86)”?

In my .emacs, I have defined calling pdfsizeopt this way:

(eval-after-load "tex"
'(add-to-list 'TeX-command-list
'("pdfsizeopt" "pdfsizeopt.exe %s.pdf %s.pdf" TeX-run-command t t :help "Run pdfsizeopt.exe") t))

Has been working for years.


Get this bounty!!!

#StackBounty: #error-handling #path #customization On Windows 8.1, in Emacs Ghostscript doesn't work, while on commandline it does

Bounty: 50

I’m using Emacs / AUCTeX (OS: Win 8.1) to compile LaTeX files. To shrink the PDF afterwards, I’m using pdfsizeopt. The command is easy:

pdfsizeopt.exe input.pdf output.pdf

OK, opening cmd.exe in a folder of a PDF, which I’d like to shrink, it works. This is the relevant part of the output (many lines cut out, irrelevant):

T:somefolder>pdfsizeopt.exe name-of-pdf.pdf name-of-pdf.pdf
info: This is pdfsizeopt ZIP rUNKNOWN size=105563.
info: loading PDF from: name-of-pdf.pdf
info: loaded PDF of 858466 bytes
info: found 92 obj offsets and 1 obj streams in xref stream
info: separated to 90 objs + xref + trailer
warning: cannot parse obj 24: pdfsizeopt.main.PdfIndirectLengthError: missing ob
j for indirect /Length 45 0 R at ofs=20434
info: found 6 Type1 fonts loaded
info: writing Type1CConverter (435161 font bytes) to: psotmp.5420.conv.tmp.ps
info: using Ghostscript "C:Program Files (x86)gsgs9.21bingswin32c.exe": GPL
 Ghostscript 9.21 (2017-03-16)
info: executing Type1CConverter with Ghostscript: "C:Program Files (x86)gsgs9
.21bingswin32c.exe" -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/prin
ter -dColorConversionStrategy=/LeaveColorUnchanged -sOutputFile=psotmp.5420.conv
.tmp.pdf -f psotmp.5420.conv.tmp.ps
Type1CConverter: using interpreter GPL Ghostscript 921 20170316
Type1CConverter: converting font /TBQTVH+LinBiolinum to /Obj0000000077
Type1CConverter: converting font /MKHCTZ+LMMathSymbols8-Regular to /Obj000000008
7
Type1CConverter: all OK
info: loading PDF from: psotmp.5420.conv.tmp.pdf
info: loaded PDF of 31339 bytes
info: separated to 30 objs + xref + trailer
info: found 6 fonts in GS output
info: optimized total Type1 font size 435229 to Type1C font size 22200 (5%)
info: optimized Type1 font XObject 87,86: new size=658 (25%)
info: found 6 Type1C fonts loaded
info: writing Type1CParser (22080 font bytes) to: psotmp.5420.conv.parse.tmp.ps
info: executing Type1CParser with Ghostscript: "C:Program Files (x86)gsgs9.21
bingswin32c.exe" -q -dNOPAUSE -dBATCH -sDEVICE=nullpage -sDataFile=psotmp.5420
.conv.parsedata.tmp.ps -f psotmp.5420.conv.parse.tmp.ps
Type1CParser: using interpreter GPL Ghostscript 921 20170316
Type1CParser: all OK
info: parsed 6 Type1C fonts
info: eliminated 1 duplicate objs
info: eliminated 21 unused objs in 21 classes
warning: obj 24 missing, referenced by objs [21]...
info: compressed 2 streams, kept 2 of them uncompressed
info: saving PDF with 47 objs to: name-of-pdf.pdf
info: generated object stream of 3118 bytes in 37 objects (18%)
info: generated 40874 bytes (5%)


T:somefolder>

As you can observe, Ghostscript is being found by pdfsizeopt. All is well.

Now, if I’m calling it via Emacs (64-bit):

Running `pdfsizeopt' on `name-of-pdf' with ``pdfsizeopt.exe "name-of-pdf".pdf "name-of-pdf".pdf''
info: This is pdfsizeopt ZIP rUNKNOWN size=105563.
info: loading PDF from: name-of-pdf.pdf
info: loaded PDF of 858466 bytes
info: found 92 obj offsets and 1 obj streams in xref stream
info: separated to 90 objs + xref + trailer
warning: cannot parse obj 24: pdfsizeopt.main.PdfIndirectLengthError: missing obj for indirect /Length 45 0 R at ofs=20434

info: found 6 Type1 fonts loaded
info: writing Type1CConverter (435161 font bytes) to: psotmp.6548.conv.tmp.ps
info: this Ghostscript does not work: "C:Program Files (x86)gsgs9.21bingswin32c.exe"
info: this Ghostscript does not work: "C:Program Files (x86)gsgs9.21bingswin32c.exe"
Traceback (most recent call last):
  File "C:pdfsizeoptpdfsizeopt_win32execpython26.ziprunpy.py", line 122, in _run_module_as_main
  File "C:pdfsizeoptpdfsizeopt_win32execpython26.ziprunpy.py", line 34, in _run_code
  File "C:pdfsizeoptpdfsizeopt.single__main__.py", line 1, in <module>
  File "C:pdfsizeoptpdfsizeopt.singlemainrun.py", line 10, in <module>
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 8240, in main
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 5341, in ConvertType1FontsToType1C
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 5058, in GenerateType1CFontsFromType1
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 140, in GetGsCommand
AssertionError: Could not find a working Ghostscript.

TeX Output exited abnormally with code 1 at Tue Apr 25 17:20:00

Why on earth does the same Ghostscript installation not work, if called from Emacs?

Is there an issue with the spaces in “Program Files (x86)”?

In my .emacs, I have defined calling pdfsizeopt this way:

(eval-after-load "tex"
'(add-to-list 'TeX-command-list
'("pdfsizeopt" "pdfsizeopt.exe %s.pdf %s.pdf" TeX-run-command t t :help "Run pdfsizeopt.exe") t))

Has been working for years.


Get this bounty!!!

#StackBounty: #error-handling #path #customization On Windows 8.1, in Emacs Ghostscript doesn't work, while on commandline it does

Bounty: 50

I’m using Emacs / AUCTeX (OS: Win 8.1) to compile LaTeX files. To shrink the PDF afterwards, I’m using pdfsizeopt. The command is easy:

pdfsizeopt.exe input.pdf output.pdf

OK, opening cmd.exe in a folder of a PDF, which I’d like to shrink, it works. This is the relevant part of the output (many lines cut out, irrelevant):

T:somefolder>pdfsizeopt.exe name-of-pdf.pdf name-of-pdf.pdf
info: This is pdfsizeopt ZIP rUNKNOWN size=105563.
info: loading PDF from: name-of-pdf.pdf
info: loaded PDF of 858466 bytes
info: found 92 obj offsets and 1 obj streams in xref stream
info: separated to 90 objs + xref + trailer
warning: cannot parse obj 24: pdfsizeopt.main.PdfIndirectLengthError: missing ob
j for indirect /Length 45 0 R at ofs=20434
info: found 6 Type1 fonts loaded
info: writing Type1CConverter (435161 font bytes) to: psotmp.5420.conv.tmp.ps
info: using Ghostscript "C:Program Files (x86)gsgs9.21bingswin32c.exe": GPL
 Ghostscript 9.21 (2017-03-16)
info: executing Type1CConverter with Ghostscript: "C:Program Files (x86)gsgs9
.21bingswin32c.exe" -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/prin
ter -dColorConversionStrategy=/LeaveColorUnchanged -sOutputFile=psotmp.5420.conv
.tmp.pdf -f psotmp.5420.conv.tmp.ps
Type1CConverter: using interpreter GPL Ghostscript 921 20170316
Type1CConverter: converting font /TBQTVH+LinBiolinum to /Obj0000000077
Type1CConverter: converting font /MKHCTZ+LMMathSymbols8-Regular to /Obj000000008
7
Type1CConverter: all OK
info: loading PDF from: psotmp.5420.conv.tmp.pdf
info: loaded PDF of 31339 bytes
info: separated to 30 objs + xref + trailer
info: found 6 fonts in GS output
info: optimized total Type1 font size 435229 to Type1C font size 22200 (5%)
info: optimized Type1 font XObject 87,86: new size=658 (25%)
info: found 6 Type1C fonts loaded
info: writing Type1CParser (22080 font bytes) to: psotmp.5420.conv.parse.tmp.ps
info: executing Type1CParser with Ghostscript: "C:Program Files (x86)gsgs9.21
bingswin32c.exe" -q -dNOPAUSE -dBATCH -sDEVICE=nullpage -sDataFile=psotmp.5420
.conv.parsedata.tmp.ps -f psotmp.5420.conv.parse.tmp.ps
Type1CParser: using interpreter GPL Ghostscript 921 20170316
Type1CParser: all OK
info: parsed 6 Type1C fonts
info: eliminated 1 duplicate objs
info: eliminated 21 unused objs in 21 classes
warning: obj 24 missing, referenced by objs [21]...
info: compressed 2 streams, kept 2 of them uncompressed
info: saving PDF with 47 objs to: name-of-pdf.pdf
info: generated object stream of 3118 bytes in 37 objects (18%)
info: generated 40874 bytes (5%)


T:somefolder>

As you can observe, Ghostscript is being found by pdfsizeopt. All is well.

Now, if I’m calling it via Emacs (64-bit):

Running `pdfsizeopt' on `name-of-pdf' with ``pdfsizeopt.exe "name-of-pdf".pdf "name-of-pdf".pdf''
info: This is pdfsizeopt ZIP rUNKNOWN size=105563.
info: loading PDF from: name-of-pdf.pdf
info: loaded PDF of 858466 bytes
info: found 92 obj offsets and 1 obj streams in xref stream
info: separated to 90 objs + xref + trailer
warning: cannot parse obj 24: pdfsizeopt.main.PdfIndirectLengthError: missing obj for indirect /Length 45 0 R at ofs=20434

info: found 6 Type1 fonts loaded
info: writing Type1CConverter (435161 font bytes) to: psotmp.6548.conv.tmp.ps
info: this Ghostscript does not work: "C:Program Files (x86)gsgs9.21bingswin32c.exe"
info: this Ghostscript does not work: "C:Program Files (x86)gsgs9.21bingswin32c.exe"
Traceback (most recent call last):
  File "C:pdfsizeoptpdfsizeopt_win32execpython26.ziprunpy.py", line 122, in _run_module_as_main
  File "C:pdfsizeoptpdfsizeopt_win32execpython26.ziprunpy.py", line 34, in _run_code
  File "C:pdfsizeoptpdfsizeopt.single__main__.py", line 1, in <module>
  File "C:pdfsizeoptpdfsizeopt.singlemainrun.py", line 10, in <module>
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 8240, in main
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 5341, in ConvertType1FontsToType1C
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 5058, in GenerateType1CFontsFromType1
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 140, in GetGsCommand
AssertionError: Could not find a working Ghostscript.

TeX Output exited abnormally with code 1 at Tue Apr 25 17:20:00

Why on earth does the same Ghostscript installation not work, if called from Emacs?

Is there an issue with the spaces in “Program Files (x86)”?

In my .emacs, I have defined calling pdfsizeopt this way:

(eval-after-load "tex"
'(add-to-list 'TeX-command-list
'("pdfsizeopt" "pdfsizeopt.exe %s.pdf %s.pdf" TeX-run-command t t :help "Run pdfsizeopt.exe") t))

Has been working for years.


Get this bounty!!!

#StackBounty: #error-handling #path #customization On Windows 8.1, in Emacs Ghostscript doesn't work, while on commandline it does

Bounty: 50

I’m using Emacs / AUCTeX (OS: Win 8.1) to compile LaTeX files. To shrink the PDF afterwards, I’m using pdfsizeopt. The command is easy:

pdfsizeopt.exe input.pdf output.pdf

OK, opening cmd.exe in a folder of a PDF, which I’d like to shrink, it works. This is the relevant part of the output (many lines cut out, irrelevant):

T:somefolder>pdfsizeopt.exe name-of-pdf.pdf name-of-pdf.pdf
info: This is pdfsizeopt ZIP rUNKNOWN size=105563.
info: loading PDF from: name-of-pdf.pdf
info: loaded PDF of 858466 bytes
info: found 92 obj offsets and 1 obj streams in xref stream
info: separated to 90 objs + xref + trailer
warning: cannot parse obj 24: pdfsizeopt.main.PdfIndirectLengthError: missing ob
j for indirect /Length 45 0 R at ofs=20434
info: found 6 Type1 fonts loaded
info: writing Type1CConverter (435161 font bytes) to: psotmp.5420.conv.tmp.ps
info: using Ghostscript "C:Program Files (x86)gsgs9.21bingswin32c.exe": GPL
 Ghostscript 9.21 (2017-03-16)
info: executing Type1CConverter with Ghostscript: "C:Program Files (x86)gsgs9
.21bingswin32c.exe" -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/prin
ter -dColorConversionStrategy=/LeaveColorUnchanged -sOutputFile=psotmp.5420.conv
.tmp.pdf -f psotmp.5420.conv.tmp.ps
Type1CConverter: using interpreter GPL Ghostscript 921 20170316
Type1CConverter: converting font /TBQTVH+LinBiolinum to /Obj0000000077
Type1CConverter: converting font /MKHCTZ+LMMathSymbols8-Regular to /Obj000000008
7
Type1CConverter: all OK
info: loading PDF from: psotmp.5420.conv.tmp.pdf
info: loaded PDF of 31339 bytes
info: separated to 30 objs + xref + trailer
info: found 6 fonts in GS output
info: optimized total Type1 font size 435229 to Type1C font size 22200 (5%)
info: optimized Type1 font XObject 87,86: new size=658 (25%)
info: found 6 Type1C fonts loaded
info: writing Type1CParser (22080 font bytes) to: psotmp.5420.conv.parse.tmp.ps
info: executing Type1CParser with Ghostscript: "C:Program Files (x86)gsgs9.21
bingswin32c.exe" -q -dNOPAUSE -dBATCH -sDEVICE=nullpage -sDataFile=psotmp.5420
.conv.parsedata.tmp.ps -f psotmp.5420.conv.parse.tmp.ps
Type1CParser: using interpreter GPL Ghostscript 921 20170316
Type1CParser: all OK
info: parsed 6 Type1C fonts
info: eliminated 1 duplicate objs
info: eliminated 21 unused objs in 21 classes
warning: obj 24 missing, referenced by objs [21]...
info: compressed 2 streams, kept 2 of them uncompressed
info: saving PDF with 47 objs to: name-of-pdf.pdf
info: generated object stream of 3118 bytes in 37 objects (18%)
info: generated 40874 bytes (5%)


T:somefolder>

As you can observe, Ghostscript is being found by pdfsizeopt. All is well.

Now, if I’m calling it via Emacs (64-bit):

Running `pdfsizeopt' on `name-of-pdf' with ``pdfsizeopt.exe "name-of-pdf".pdf "name-of-pdf".pdf''
info: This is pdfsizeopt ZIP rUNKNOWN size=105563.
info: loading PDF from: name-of-pdf.pdf
info: loaded PDF of 858466 bytes
info: found 92 obj offsets and 1 obj streams in xref stream
info: separated to 90 objs + xref + trailer
warning: cannot parse obj 24: pdfsizeopt.main.PdfIndirectLengthError: missing obj for indirect /Length 45 0 R at ofs=20434

info: found 6 Type1 fonts loaded
info: writing Type1CConverter (435161 font bytes) to: psotmp.6548.conv.tmp.ps
info: this Ghostscript does not work: "C:Program Files (x86)gsgs9.21bingswin32c.exe"
info: this Ghostscript does not work: "C:Program Files (x86)gsgs9.21bingswin32c.exe"
Traceback (most recent call last):
  File "C:pdfsizeoptpdfsizeopt_win32execpython26.ziprunpy.py", line 122, in _run_module_as_main
  File "C:pdfsizeoptpdfsizeopt_win32execpython26.ziprunpy.py", line 34, in _run_code
  File "C:pdfsizeoptpdfsizeopt.single__main__.py", line 1, in <module>
  File "C:pdfsizeoptpdfsizeopt.singlemainrun.py", line 10, in <module>
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 8240, in main
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 5341, in ConvertType1FontsToType1C
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 5058, in GenerateType1CFontsFromType1
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 140, in GetGsCommand
AssertionError: Could not find a working Ghostscript.

TeX Output exited abnormally with code 1 at Tue Apr 25 17:20:00

Why on earth does the same Ghostscript installation not work, if called from Emacs?

Is there an issue with the spaces in “Program Files (x86)”?

In my .emacs, I have defined calling pdfsizeopt this way:

(eval-after-load "tex"
'(add-to-list 'TeX-command-list
'("pdfsizeopt" "pdfsizeopt.exe %s.pdf %s.pdf" TeX-run-command t t :help "Run pdfsizeopt.exe") t))

Has been working for years.


Get this bounty!!!

#StackBounty: #error-handling #path #customization On Windows 8.1, in Emacs Ghostscript doesn't work, while on commandline it does

Bounty: 50

I’m using Emacs / AUCTeX (OS: Win 8.1) to compile LaTeX files. To shrink the PDF afterwards, I’m using pdfsizeopt. The command is easy:

pdfsizeopt.exe input.pdf output.pdf

OK, opening cmd.exe in a folder of a PDF, which I’d like to shrink, it works. This is the relevant part of the output (many lines cut out, irrelevant):

T:somefolder>pdfsizeopt.exe name-of-pdf.pdf name-of-pdf.pdf
info: This is pdfsizeopt ZIP rUNKNOWN size=105563.
info: loading PDF from: name-of-pdf.pdf
info: loaded PDF of 858466 bytes
info: found 92 obj offsets and 1 obj streams in xref stream
info: separated to 90 objs + xref + trailer
warning: cannot parse obj 24: pdfsizeopt.main.PdfIndirectLengthError: missing ob
j for indirect /Length 45 0 R at ofs=20434
info: found 6 Type1 fonts loaded
info: writing Type1CConverter (435161 font bytes) to: psotmp.5420.conv.tmp.ps
info: using Ghostscript "C:Program Files (x86)gsgs9.21bingswin32c.exe": GPL
 Ghostscript 9.21 (2017-03-16)
info: executing Type1CConverter with Ghostscript: "C:Program Files (x86)gsgs9
.21bingswin32c.exe" -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/prin
ter -dColorConversionStrategy=/LeaveColorUnchanged -sOutputFile=psotmp.5420.conv
.tmp.pdf -f psotmp.5420.conv.tmp.ps
Type1CConverter: using interpreter GPL Ghostscript 921 20170316
Type1CConverter: converting font /TBQTVH+LinBiolinum to /Obj0000000077
Type1CConverter: converting font /MKHCTZ+LMMathSymbols8-Regular to /Obj000000008
7
Type1CConverter: all OK
info: loading PDF from: psotmp.5420.conv.tmp.pdf
info: loaded PDF of 31339 bytes
info: separated to 30 objs + xref + trailer
info: found 6 fonts in GS output
info: optimized total Type1 font size 435229 to Type1C font size 22200 (5%)
info: optimized Type1 font XObject 87,86: new size=658 (25%)
info: found 6 Type1C fonts loaded
info: writing Type1CParser (22080 font bytes) to: psotmp.5420.conv.parse.tmp.ps
info: executing Type1CParser with Ghostscript: "C:Program Files (x86)gsgs9.21
bingswin32c.exe" -q -dNOPAUSE -dBATCH -sDEVICE=nullpage -sDataFile=psotmp.5420
.conv.parsedata.tmp.ps -f psotmp.5420.conv.parse.tmp.ps
Type1CParser: using interpreter GPL Ghostscript 921 20170316
Type1CParser: all OK
info: parsed 6 Type1C fonts
info: eliminated 1 duplicate objs
info: eliminated 21 unused objs in 21 classes
warning: obj 24 missing, referenced by objs [21]...
info: compressed 2 streams, kept 2 of them uncompressed
info: saving PDF with 47 objs to: name-of-pdf.pdf
info: generated object stream of 3118 bytes in 37 objects (18%)
info: generated 40874 bytes (5%)


T:somefolder>

As you can observe, Ghostscript is being found by pdfsizeopt. All is well.

Now, if I’m calling it via Emacs (64-bit):

Running `pdfsizeopt' on `name-of-pdf' with ``pdfsizeopt.exe "name-of-pdf".pdf "name-of-pdf".pdf''
info: This is pdfsizeopt ZIP rUNKNOWN size=105563.
info: loading PDF from: name-of-pdf.pdf
info: loaded PDF of 858466 bytes
info: found 92 obj offsets and 1 obj streams in xref stream
info: separated to 90 objs + xref + trailer
warning: cannot parse obj 24: pdfsizeopt.main.PdfIndirectLengthError: missing obj for indirect /Length 45 0 R at ofs=20434

info: found 6 Type1 fonts loaded
info: writing Type1CConverter (435161 font bytes) to: psotmp.6548.conv.tmp.ps
info: this Ghostscript does not work: "C:Program Files (x86)gsgs9.21bingswin32c.exe"
info: this Ghostscript does not work: "C:Program Files (x86)gsgs9.21bingswin32c.exe"
Traceback (most recent call last):
  File "C:pdfsizeoptpdfsizeopt_win32execpython26.ziprunpy.py", line 122, in _run_module_as_main
  File "C:pdfsizeoptpdfsizeopt_win32execpython26.ziprunpy.py", line 34, in _run_code
  File "C:pdfsizeoptpdfsizeopt.single__main__.py", line 1, in <module>
  File "C:pdfsizeoptpdfsizeopt.singlemainrun.py", line 10, in <module>
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 8240, in main
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 5341, in ConvertType1FontsToType1C
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 5058, in GenerateType1CFontsFromType1
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 140, in GetGsCommand
AssertionError: Could not find a working Ghostscript.

TeX Output exited abnormally with code 1 at Tue Apr 25 17:20:00

Why on earth does the same Ghostscript installation not work, if called from Emacs?

Is there an issue with the spaces in “Program Files (x86)”?

In my .emacs, I have defined calling pdfsizeopt this way:

(eval-after-load "tex"
'(add-to-list 'TeX-command-list
'("pdfsizeopt" "pdfsizeopt.exe %s.pdf %s.pdf" TeX-run-command t t :help "Run pdfsizeopt.exe") t))

Has been working for years.


Get this bounty!!!

#StackBounty: #error-handling #path #customization On Windows 8.1, in Emacs Ghostscript doesn't work, while on commandline it does

Bounty: 50

I’m using Emacs / AUCTeX (OS: Win 8.1) to compile LaTeX files. To shrink the PDF afterwards, I’m using pdfsizeopt. The command is easy:

pdfsizeopt.exe input.pdf output.pdf

OK, opening cmd.exe in a folder of a PDF, which I’d like to shrink, it works. This is the relevant part of the output (many lines cut out, irrelevant):

T:somefolder>pdfsizeopt.exe name-of-pdf.pdf name-of-pdf.pdf
info: This is pdfsizeopt ZIP rUNKNOWN size=105563.
info: loading PDF from: name-of-pdf.pdf
info: loaded PDF of 858466 bytes
info: found 92 obj offsets and 1 obj streams in xref stream
info: separated to 90 objs + xref + trailer
warning: cannot parse obj 24: pdfsizeopt.main.PdfIndirectLengthError: missing ob
j for indirect /Length 45 0 R at ofs=20434
info: found 6 Type1 fonts loaded
info: writing Type1CConverter (435161 font bytes) to: psotmp.5420.conv.tmp.ps
info: using Ghostscript "C:Program Files (x86)gsgs9.21bingswin32c.exe": GPL
 Ghostscript 9.21 (2017-03-16)
info: executing Type1CConverter with Ghostscript: "C:Program Files (x86)gsgs9
.21bingswin32c.exe" -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/prin
ter -dColorConversionStrategy=/LeaveColorUnchanged -sOutputFile=psotmp.5420.conv
.tmp.pdf -f psotmp.5420.conv.tmp.ps
Type1CConverter: using interpreter GPL Ghostscript 921 20170316
Type1CConverter: converting font /TBQTVH+LinBiolinum to /Obj0000000077
Type1CConverter: converting font /MKHCTZ+LMMathSymbols8-Regular to /Obj000000008
7
Type1CConverter: all OK
info: loading PDF from: psotmp.5420.conv.tmp.pdf
info: loaded PDF of 31339 bytes
info: separated to 30 objs + xref + trailer
info: found 6 fonts in GS output
info: optimized total Type1 font size 435229 to Type1C font size 22200 (5%)
info: optimized Type1 font XObject 87,86: new size=658 (25%)
info: found 6 Type1C fonts loaded
info: writing Type1CParser (22080 font bytes) to: psotmp.5420.conv.parse.tmp.ps
info: executing Type1CParser with Ghostscript: "C:Program Files (x86)gsgs9.21
bingswin32c.exe" -q -dNOPAUSE -dBATCH -sDEVICE=nullpage -sDataFile=psotmp.5420
.conv.parsedata.tmp.ps -f psotmp.5420.conv.parse.tmp.ps
Type1CParser: using interpreter GPL Ghostscript 921 20170316
Type1CParser: all OK
info: parsed 6 Type1C fonts
info: eliminated 1 duplicate objs
info: eliminated 21 unused objs in 21 classes
warning: obj 24 missing, referenced by objs [21]...
info: compressed 2 streams, kept 2 of them uncompressed
info: saving PDF with 47 objs to: name-of-pdf.pdf
info: generated object stream of 3118 bytes in 37 objects (18%)
info: generated 40874 bytes (5%)


T:somefolder>

As you can observe, Ghostscript is being found by pdfsizeopt. All is well.

Now, if I’m calling it via Emacs (64-bit):

Running `pdfsizeopt' on `name-of-pdf' with ``pdfsizeopt.exe "name-of-pdf".pdf "name-of-pdf".pdf''
info: This is pdfsizeopt ZIP rUNKNOWN size=105563.
info: loading PDF from: name-of-pdf.pdf
info: loaded PDF of 858466 bytes
info: found 92 obj offsets and 1 obj streams in xref stream
info: separated to 90 objs + xref + trailer
warning: cannot parse obj 24: pdfsizeopt.main.PdfIndirectLengthError: missing obj for indirect /Length 45 0 R at ofs=20434

info: found 6 Type1 fonts loaded
info: writing Type1CConverter (435161 font bytes) to: psotmp.6548.conv.tmp.ps
info: this Ghostscript does not work: "C:Program Files (x86)gsgs9.21bingswin32c.exe"
info: this Ghostscript does not work: "C:Program Files (x86)gsgs9.21bingswin32c.exe"
Traceback (most recent call last):
  File "C:pdfsizeoptpdfsizeopt_win32execpython26.ziprunpy.py", line 122, in _run_module_as_main
  File "C:pdfsizeoptpdfsizeopt_win32execpython26.ziprunpy.py", line 34, in _run_code
  File "C:pdfsizeoptpdfsizeopt.single__main__.py", line 1, in <module>
  File "C:pdfsizeoptpdfsizeopt.singlemainrun.py", line 10, in <module>
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 8240, in main
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 5341, in ConvertType1FontsToType1C
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 5058, in GenerateType1CFontsFromType1
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 140, in GetGsCommand
AssertionError: Could not find a working Ghostscript.

TeX Output exited abnormally with code 1 at Tue Apr 25 17:20:00

Why on earth does the same Ghostscript installation not work, if called from Emacs?

Is there an issue with the spaces in “Program Files (x86)”?

In my .emacs, I have defined calling pdfsizeopt this way:

(eval-after-load "tex"
'(add-to-list 'TeX-command-list
'("pdfsizeopt" "pdfsizeopt.exe %s.pdf %s.pdf" TeX-run-command t t :help "Run pdfsizeopt.exe") t))

Has been working for years.


Get this bounty!!!

#StackBounty: #error-handling #path #customization On Windows 8.1, in Emacs Ghostscript doesn't work, while on commandline it does

Bounty: 50

I’m using Emacs / AUCTeX (OS: Win 8.1) to compile LaTeX files. To shrink the PDF afterwards, I’m using pdfsizeopt. The command is easy:

pdfsizeopt.exe input.pdf output.pdf

OK, opening cmd.exe in a folder of a PDF, which I’d like to shrink, it works. This is the relevant part of the output (many lines cut out, irrelevant):

T:somefolder>pdfsizeopt.exe name-of-pdf.pdf name-of-pdf.pdf
info: This is pdfsizeopt ZIP rUNKNOWN size=105563.
info: loading PDF from: name-of-pdf.pdf
info: loaded PDF of 858466 bytes
info: found 92 obj offsets and 1 obj streams in xref stream
info: separated to 90 objs + xref + trailer
warning: cannot parse obj 24: pdfsizeopt.main.PdfIndirectLengthError: missing ob
j for indirect /Length 45 0 R at ofs=20434
info: found 6 Type1 fonts loaded
info: writing Type1CConverter (435161 font bytes) to: psotmp.5420.conv.tmp.ps
info: using Ghostscript "C:Program Files (x86)gsgs9.21bingswin32c.exe": GPL
 Ghostscript 9.21 (2017-03-16)
info: executing Type1CConverter with Ghostscript: "C:Program Files (x86)gsgs9
.21bingswin32c.exe" -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/prin
ter -dColorConversionStrategy=/LeaveColorUnchanged -sOutputFile=psotmp.5420.conv
.tmp.pdf -f psotmp.5420.conv.tmp.ps
Type1CConverter: using interpreter GPL Ghostscript 921 20170316
Type1CConverter: converting font /TBQTVH+LinBiolinum to /Obj0000000077
Type1CConverter: converting font /MKHCTZ+LMMathSymbols8-Regular to /Obj000000008
7
Type1CConverter: all OK
info: loading PDF from: psotmp.5420.conv.tmp.pdf
info: loaded PDF of 31339 bytes
info: separated to 30 objs + xref + trailer
info: found 6 fonts in GS output
info: optimized total Type1 font size 435229 to Type1C font size 22200 (5%)
info: optimized Type1 font XObject 87,86: new size=658 (25%)
info: found 6 Type1C fonts loaded
info: writing Type1CParser (22080 font bytes) to: psotmp.5420.conv.parse.tmp.ps
info: executing Type1CParser with Ghostscript: "C:Program Files (x86)gsgs9.21
bingswin32c.exe" -q -dNOPAUSE -dBATCH -sDEVICE=nullpage -sDataFile=psotmp.5420
.conv.parsedata.tmp.ps -f psotmp.5420.conv.parse.tmp.ps
Type1CParser: using interpreter GPL Ghostscript 921 20170316
Type1CParser: all OK
info: parsed 6 Type1C fonts
info: eliminated 1 duplicate objs
info: eliminated 21 unused objs in 21 classes
warning: obj 24 missing, referenced by objs [21]...
info: compressed 2 streams, kept 2 of them uncompressed
info: saving PDF with 47 objs to: name-of-pdf.pdf
info: generated object stream of 3118 bytes in 37 objects (18%)
info: generated 40874 bytes (5%)


T:somefolder>

As you can observe, Ghostscript is being found by pdfsizeopt. All is well.

Now, if I’m calling it via Emacs (64-bit):

Running `pdfsizeopt' on `name-of-pdf' with ``pdfsizeopt.exe "name-of-pdf".pdf "name-of-pdf".pdf''
info: This is pdfsizeopt ZIP rUNKNOWN size=105563.
info: loading PDF from: name-of-pdf.pdf
info: loaded PDF of 858466 bytes
info: found 92 obj offsets and 1 obj streams in xref stream
info: separated to 90 objs + xref + trailer
warning: cannot parse obj 24: pdfsizeopt.main.PdfIndirectLengthError: missing obj for indirect /Length 45 0 R at ofs=20434

info: found 6 Type1 fonts loaded
info: writing Type1CConverter (435161 font bytes) to: psotmp.6548.conv.tmp.ps
info: this Ghostscript does not work: "C:Program Files (x86)gsgs9.21bingswin32c.exe"
info: this Ghostscript does not work: "C:Program Files (x86)gsgs9.21bingswin32c.exe"
Traceback (most recent call last):
  File "C:pdfsizeoptpdfsizeopt_win32execpython26.ziprunpy.py", line 122, in _run_module_as_main
  File "C:pdfsizeoptpdfsizeopt_win32execpython26.ziprunpy.py", line 34, in _run_code
  File "C:pdfsizeoptpdfsizeopt.single__main__.py", line 1, in <module>
  File "C:pdfsizeoptpdfsizeopt.singlemainrun.py", line 10, in <module>
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 8240, in main
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 5341, in ConvertType1FontsToType1C
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 5058, in GenerateType1CFontsFromType1
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 140, in GetGsCommand
AssertionError: Could not find a working Ghostscript.

TeX Output exited abnormally with code 1 at Tue Apr 25 17:20:00

Why on earth does the same Ghostscript installation not work, if called from Emacs?

Is there an issue with the spaces in “Program Files (x86)”?

In my .emacs, I have defined calling pdfsizeopt this way:

(eval-after-load "tex"
'(add-to-list 'TeX-command-list
'("pdfsizeopt" "pdfsizeopt.exe %s.pdf %s.pdf" TeX-run-command t t :help "Run pdfsizeopt.exe") t))

Has been working for years.


Get this bounty!!!

#StackBounty: #error-handling #path #customization On Windows 8.1, in Emacs Ghostscript doesn't work, while on commandline it does

Bounty: 50

I’m using Emacs / AUCTeX (OS: Win 8.1) to compile LaTeX files. To shrink the PDF afterwards, I’m using pdfsizeopt. The command is easy:

pdfsizeopt.exe input.pdf output.pdf

OK, opening cmd.exe in a folder of a PDF, which I’d like to shrink, it works. This is the relevant part of the output (many lines cut out, irrelevant):

T:somefolder>pdfsizeopt.exe name-of-pdf.pdf name-of-pdf.pdf
info: This is pdfsizeopt ZIP rUNKNOWN size=105563.
info: loading PDF from: name-of-pdf.pdf
info: loaded PDF of 858466 bytes
info: found 92 obj offsets and 1 obj streams in xref stream
info: separated to 90 objs + xref + trailer
warning: cannot parse obj 24: pdfsizeopt.main.PdfIndirectLengthError: missing ob
j for indirect /Length 45 0 R at ofs=20434
info: found 6 Type1 fonts loaded
info: writing Type1CConverter (435161 font bytes) to: psotmp.5420.conv.tmp.ps
info: using Ghostscript "C:Program Files (x86)gsgs9.21bingswin32c.exe": GPL
 Ghostscript 9.21 (2017-03-16)
info: executing Type1CConverter with Ghostscript: "C:Program Files (x86)gsgs9
.21bingswin32c.exe" -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/prin
ter -dColorConversionStrategy=/LeaveColorUnchanged -sOutputFile=psotmp.5420.conv
.tmp.pdf -f psotmp.5420.conv.tmp.ps
Type1CConverter: using interpreter GPL Ghostscript 921 20170316
Type1CConverter: converting font /TBQTVH+LinBiolinum to /Obj0000000077
Type1CConverter: converting font /MKHCTZ+LMMathSymbols8-Regular to /Obj000000008
7
Type1CConverter: all OK
info: loading PDF from: psotmp.5420.conv.tmp.pdf
info: loaded PDF of 31339 bytes
info: separated to 30 objs + xref + trailer
info: found 6 fonts in GS output
info: optimized total Type1 font size 435229 to Type1C font size 22200 (5%)
info: optimized Type1 font XObject 87,86: new size=658 (25%)
info: found 6 Type1C fonts loaded
info: writing Type1CParser (22080 font bytes) to: psotmp.5420.conv.parse.tmp.ps
info: executing Type1CParser with Ghostscript: "C:Program Files (x86)gsgs9.21
bingswin32c.exe" -q -dNOPAUSE -dBATCH -sDEVICE=nullpage -sDataFile=psotmp.5420
.conv.parsedata.tmp.ps -f psotmp.5420.conv.parse.tmp.ps
Type1CParser: using interpreter GPL Ghostscript 921 20170316
Type1CParser: all OK
info: parsed 6 Type1C fonts
info: eliminated 1 duplicate objs
info: eliminated 21 unused objs in 21 classes
warning: obj 24 missing, referenced by objs [21]...
info: compressed 2 streams, kept 2 of them uncompressed
info: saving PDF with 47 objs to: name-of-pdf.pdf
info: generated object stream of 3118 bytes in 37 objects (18%)
info: generated 40874 bytes (5%)


T:somefolder>

As you can observe, Ghostscript is being found by pdfsizeopt. All is well.

Now, if I’m calling it via Emacs (64-bit):

Running `pdfsizeopt' on `name-of-pdf' with ``pdfsizeopt.exe "name-of-pdf".pdf "name-of-pdf".pdf''
info: This is pdfsizeopt ZIP rUNKNOWN size=105563.
info: loading PDF from: name-of-pdf.pdf
info: loaded PDF of 858466 bytes
info: found 92 obj offsets and 1 obj streams in xref stream
info: separated to 90 objs + xref + trailer
warning: cannot parse obj 24: pdfsizeopt.main.PdfIndirectLengthError: missing obj for indirect /Length 45 0 R at ofs=20434

info: found 6 Type1 fonts loaded
info: writing Type1CConverter (435161 font bytes) to: psotmp.6548.conv.tmp.ps
info: this Ghostscript does not work: "C:Program Files (x86)gsgs9.21bingswin32c.exe"
info: this Ghostscript does not work: "C:Program Files (x86)gsgs9.21bingswin32c.exe"
Traceback (most recent call last):
  File "C:pdfsizeoptpdfsizeopt_win32execpython26.ziprunpy.py", line 122, in _run_module_as_main
  File "C:pdfsizeoptpdfsizeopt_win32execpython26.ziprunpy.py", line 34, in _run_code
  File "C:pdfsizeoptpdfsizeopt.single__main__.py", line 1, in <module>
  File "C:pdfsizeoptpdfsizeopt.singlemainrun.py", line 10, in <module>
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 8240, in main
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 5341, in ConvertType1FontsToType1C
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 5058, in GenerateType1CFontsFromType1
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 140, in GetGsCommand
AssertionError: Could not find a working Ghostscript.

TeX Output exited abnormally with code 1 at Tue Apr 25 17:20:00

Why on earth does the same Ghostscript installation not work, if called from Emacs?

Is there an issue with the spaces in “Program Files (x86)”?

In my .emacs, I have defined calling pdfsizeopt this way:

(eval-after-load "tex"
'(add-to-list 'TeX-command-list
'("pdfsizeopt" "pdfsizeopt.exe %s.pdf %s.pdf" TeX-run-command t t :help "Run pdfsizeopt.exe") t))

Has been working for years.


Get this bounty!!!

#StackBounty: #error-handling #path #customization On Windows 8.1, in Emacs Ghostscript doesn't work, while on commandline it does

Bounty: 50

I’m using Emacs / AUCTeX (OS: Win 8.1) to compile LaTeX files. To shrink the PDF afterwards, I’m using pdfsizeopt. The command is easy:

pdfsizeopt.exe input.pdf output.pdf

OK, opening cmd.exe in a folder of a PDF, which I’d like to shrink, it works. This is the relevant part of the output (many lines cut out, irrelevant):

T:somefolder>pdfsizeopt.exe name-of-pdf.pdf name-of-pdf.pdf
info: This is pdfsizeopt ZIP rUNKNOWN size=105563.
info: loading PDF from: name-of-pdf.pdf
info: loaded PDF of 858466 bytes
info: found 92 obj offsets and 1 obj streams in xref stream
info: separated to 90 objs + xref + trailer
warning: cannot parse obj 24: pdfsizeopt.main.PdfIndirectLengthError: missing ob
j for indirect /Length 45 0 R at ofs=20434
info: found 6 Type1 fonts loaded
info: writing Type1CConverter (435161 font bytes) to: psotmp.5420.conv.tmp.ps
info: using Ghostscript "C:Program Files (x86)gsgs9.21bingswin32c.exe": GPL
 Ghostscript 9.21 (2017-03-16)
info: executing Type1CConverter with Ghostscript: "C:Program Files (x86)gsgs9
.21bingswin32c.exe" -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/prin
ter -dColorConversionStrategy=/LeaveColorUnchanged -sOutputFile=psotmp.5420.conv
.tmp.pdf -f psotmp.5420.conv.tmp.ps
Type1CConverter: using interpreter GPL Ghostscript 921 20170316
Type1CConverter: converting font /TBQTVH+LinBiolinum to /Obj0000000077
Type1CConverter: converting font /MKHCTZ+LMMathSymbols8-Regular to /Obj000000008
7
Type1CConverter: all OK
info: loading PDF from: psotmp.5420.conv.tmp.pdf
info: loaded PDF of 31339 bytes
info: separated to 30 objs + xref + trailer
info: found 6 fonts in GS output
info: optimized total Type1 font size 435229 to Type1C font size 22200 (5%)
info: optimized Type1 font XObject 87,86: new size=658 (25%)
info: found 6 Type1C fonts loaded
info: writing Type1CParser (22080 font bytes) to: psotmp.5420.conv.parse.tmp.ps
info: executing Type1CParser with Ghostscript: "C:Program Files (x86)gsgs9.21
bingswin32c.exe" -q -dNOPAUSE -dBATCH -sDEVICE=nullpage -sDataFile=psotmp.5420
.conv.parsedata.tmp.ps -f psotmp.5420.conv.parse.tmp.ps
Type1CParser: using interpreter GPL Ghostscript 921 20170316
Type1CParser: all OK
info: parsed 6 Type1C fonts
info: eliminated 1 duplicate objs
info: eliminated 21 unused objs in 21 classes
warning: obj 24 missing, referenced by objs [21]...
info: compressed 2 streams, kept 2 of them uncompressed
info: saving PDF with 47 objs to: name-of-pdf.pdf
info: generated object stream of 3118 bytes in 37 objects (18%)
info: generated 40874 bytes (5%)


T:somefolder>

As you can observe, Ghostscript is being found by pdfsizeopt. All is well.

Now, if I’m calling it via Emacs (64-bit):

Running `pdfsizeopt' on `name-of-pdf' with ``pdfsizeopt.exe "name-of-pdf".pdf "name-of-pdf".pdf''
info: This is pdfsizeopt ZIP rUNKNOWN size=105563.
info: loading PDF from: name-of-pdf.pdf
info: loaded PDF of 858466 bytes
info: found 92 obj offsets and 1 obj streams in xref stream
info: separated to 90 objs + xref + trailer
warning: cannot parse obj 24: pdfsizeopt.main.PdfIndirectLengthError: missing obj for indirect /Length 45 0 R at ofs=20434

info: found 6 Type1 fonts loaded
info: writing Type1CConverter (435161 font bytes) to: psotmp.6548.conv.tmp.ps
info: this Ghostscript does not work: "C:Program Files (x86)gsgs9.21bingswin32c.exe"
info: this Ghostscript does not work: "C:Program Files (x86)gsgs9.21bingswin32c.exe"
Traceback (most recent call last):
  File "C:pdfsizeoptpdfsizeopt_win32execpython26.ziprunpy.py", line 122, in _run_module_as_main
  File "C:pdfsizeoptpdfsizeopt_win32execpython26.ziprunpy.py", line 34, in _run_code
  File "C:pdfsizeoptpdfsizeopt.single__main__.py", line 1, in <module>
  File "C:pdfsizeoptpdfsizeopt.singlemainrun.py", line 10, in <module>
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 8240, in main
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 5341, in ConvertType1FontsToType1C
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 5058, in GenerateType1CFontsFromType1
  File "C:pdfsizeoptpdfsizeopt.singlepdfsizeoptmain.py", line 140, in GetGsCommand
AssertionError: Could not find a working Ghostscript.

TeX Output exited abnormally with code 1 at Tue Apr 25 17:20:00

Why on earth does the same Ghostscript installation not work, if called from Emacs?

Is there an issue with the spaces in “Program Files (x86)”?

In my .emacs, I have defined calling pdfsizeopt this way:

(eval-after-load "tex"
'(add-to-list 'TeX-command-list
'("pdfsizeopt" "pdfsizeopt.exe %s.pdf %s.pdf" TeX-run-command t t :help "Run pdfsizeopt.exe") t))

Has been working for years.


Get this bounty!!!