My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 12: expected endstream+endobj,seems new bug
  Back to list
Status:  Fixed
Owner:  pts...@gmail.com
Closed:  Feb 2011


 
Reported by roc...@gmail.com, Oct 31, 2009
F:\2009\pdfsizeopt\win32>python pdfsizeopt.py cube.pdf
info: This is pdfsizeopt.py rUNKNOWN.
info: loading PDF from: cube.pdf
info: loaded PDF of 14208 bytes
info: separated to 5 objs
info: found 0 Type1 fonts loaded
info: found 0 Type1C fonts loaded
info: writing Multivalent input PDF: pso.conv.mi.tmp.pdf
info: saving PDF with 4 objs to: pso.conv.mi.tmp.pdf
info: generated 14203 bytes (100%)
info: executing Multivalent to optimize PDF: java -cp Multivalent.jar
tool.pdf.C
ompress pso.conv.mi.tmp.pdf
file:/F:/2009/pdfsizeopt/win32/pso.conv.mi.tmp.pdf, 14203 bytes
additional compression may be possible with:
         -compact
=> new length = 14042, saved 1%, elapsed time = 0 sec
info: Multivalent generated pso.conv.mi.tmp-o.pdf of 421 bytes (3%)
Traceback (most recent call last):
  File "pdfsizeopt.py", line 6121, in <module>
    main(sys.argv)
  File "pdfsizeopt.py", line 6114, in main
    pdf.SaveWithMultivalent(output_file_name)
  File "pdfsizeopt.py", line 5948, in SaveWithMultivalent
    data = self.FixPdfFromMultivalent(data)
  File "pdfsizeopt.py", line 5722, in FixPdfFromMultivalent
    obj_num_by_ofs_out=obj_num_by_in_ofs)
  File "pdfsizeopt.py", line 5475, in ParseSequentially
    objs=length_objs)
  File "pdfsizeopt.py", line 450, in __init__
    (endstream_str, file_ofs + stream_end_idx))
__main__.PdfTokenParseError: expected endstream+endobj in '' at 13911
cube.pdf
13.9 KB   Download
pso.conv.mi.tmp.pdf
13.9 KB   Download
pso.conv.mi.tmp-o.pdf
13.7 KB   Download
Oct 31, 2009
Project Member #1 pts...@gmail.com
This works for me on Linux. There is no Win32 version of pdfsizeopt.py!

> info: This is pdfsizeopt.py rUNKNOWN.

Next time, please svn checkout pdfsizeopt.py, so it will report the proper revision
number instead of rUNKNOWN.

These lines look strange in your output:

=> new length = 14042, saved 1%, elapsed time = 0 sec
info: Multivalent generated pso.conv.mi.tmp-o.pdf of 421 bytes (3%)

In my output on Linux:

=> new length = 14041, saved 1%, elapsed time = 0 sec
info: Multivalent generated pso.conv.mi.tmp-o.pdf of 14063 bytes (99%)

Why is it so that on Windows pdfsizeopt.py reads only 421 bytes of the 14042 bytes
generated by Multivalent? This is for you to figure out. Maybe you have to use
open(filename, 'rb') instead open(filename)? If you find out, please let me know.
Status: Started
Nov 1, 2009
#2 roc...@gmail.com
yes, in windows, need open(filename,'rb'), it is a bug of windows.

it works on my Linux environment.
Feb 10, 2011
Project Member #3 pts...@gmail.com
Although there is still no official port of pdfsizeopt to Win32, in r148 I made it a bit easier to use pdfsizeopt on Windows: now it opens every file and pipe in binary mode.

Feel free to volunteer to write a Windows port. Maybe the post complicated part would be making Ghostscript invocations work with os.popen.
Status: Fixed

Powered by Google Project Hosting