hefronmedia / pdfsizeopt

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

NotImplementedError: generational refs not implemented #3

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
python pdfsizeopt.py --use-pngout=true --use-jbig2=true
--use-multivalent=true Seven.Steps.To.A.Successfull.Business.Pl
an.pdf

info: This is pdfsizeopt.py r91.
info: loading PDF from: Seven.Steps.To.A.Successfull.Business.Plan.pdf
info: loaded PDF of 5840924 bytes
info: separated to 5109 objs
Traceback (most recent call last):
  File "pdfsizeopt.py", line 6002, in <module>
    main(sys.argv)
  File "pdfsizeopt.py", line 5982, in main
    pdf = PdfData().Load(file_name)
  File "pdfsizeopt.py", line 3009, in Load
    file_ofs=obj_starts[obj_num])
  File "pdfsizeopt.py", line 415, in __init__
    raise NotImplementedError('generational refs not implemented')
NotImplementedError: generational refs not implemented

Original issue reported on code.google.com by roc...@gmail.com on 27 Oct 2009 at 10:57

Attachments:

GoogleCodeExporter commented 9 years ago
forget one thing, I can use pdftk to rebuild the refs, and this error will not
display again.

Original comment by roc...@gmail.com on 27 Oct 2009 at 10:58

GoogleCodeExporter commented 9 years ago
If I opt the pdf create by pdftk

pdftk Seven.Steps.To.A.Successfull.Business.Plan.pdf output aa.pdf

and 

python pdfsizeopt.py aa.pdf
I got the following error,
Type1CGenerator: all OK
info: loading PDF from: pso.conv.gen.tmp.pdf
info: loaded PDF of 516894 bytes
info: separated to 727 objs
info: found 179 fonts loaded
info: optimized Type1C fonts to size 436411 (73%)
Traceback (most recent call last):
  File "pdfsizeopt.py", line 6002, in ?
    main(sys.argv)
  File "pdfsizeopt.py", line 5992, in main
    pdf.OptimizeImages(use_pngout=use_pngout, use_jbig2=use_jbig2)
  File "pdfsizeopt.py", line 4723, in OptimizeImages
    assert isinstance(colorspace, str)
AssertionError

btw, if needed, I will upload the aa.pdf

Original comment by roc...@gmail.com on 27 Oct 2009 at 11:09

GoogleCodeExporter commented 9 years ago
another issues under windows xp(I have successfully compiled jbig2.exe, and got 
other
command I need, sam2p.exe, png22pnm.exe,pngtopnm.exe,pngout.exe, so if I opt a 
image
only pdf, no problem)

gswin32c.exe "-ID:\basetools 
\gs\gs8.64\lib;D:\basetools\gs\fonts;C:/WINDOWS/fonts"
-q -dNOPAUSE -dBATCH -sDEVICE=nullpage -sDataFile=pso.conv.parsedata.tmp.ps -f
pso.conv.parse.tmp.ps

Error: /typecheck in --read--
Operand stack:
   --nostringval--   --dict:3/3(L)--   vmajor   MY
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval-
-   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   fa
lse   1   %stopped_push   1862   1   3   %oparray_pop   1861   1   3   %oparray_
pop   1845   1   3   %oparray_pop   1739   1   3   %oparray_pop   --nostringval-
-   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringv
al--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--
 --nostringval--
Dictionary stack:
   --dict:1148/1684(ro)(G)--   --dict:0/20(G)--   --dict:85/200(L)--   --dict:54
/106(ro)(G)--   --dict:8/30(L)--
Current allocation mode is local
Current file position is 9336
GPL Ghostscript 8.64: Unrecoverable error, exit code 1
info: Type1CParser failed, status=0x1
Traceback (most recent call last):
  File "pdfsizeopt.py", line 6002, in <module>
    main(sys.argv)
  File "pdfsizeopt.py", line 5989, in main
    do_regenerate_all_fonts=do_regenerate_all_fonts)
  File "pdfsizeopt.py", line 4150, in UnifyType1CFonts
    data_tmp_file_name='pso.conv.parsedata.tmp.ps')
  File "pdfsizeopt.py", line 3887, in ParseType1CFonts
    assert 0, 'Type1CParser failed (status)'
AssertionError: Type1CParser failed (status)

Original comment by roc...@gmail.com on 27 Oct 2009 at 11:18

GoogleCodeExporter commented 9 years ago
And what does sam2p_np mean?

Original comment by roc...@gmail.com on 27 Oct 2009 at 11:54

GoogleCodeExporter commented 9 years ago
Please open separate issues for each different topic. In this issue I'll 
respond only
to ``NotImplementedError: generational refs not implemented''

sam2p_np means sam2p.exe with ZIP compression, without predictor.

I'm quite surprised that pdfsizeopt.py works on Windows. Which Python 
distribution
and version are you using? Could you please attach the jbig2.exe you have 
compiled?

Original comment by pts...@gmail.com on 28 Oct 2009 at 7:50

GoogleCodeExporter commented 9 years ago
I tried python 2.5 (directly download from python.org),of course I modified some
content of pdfsizeopt.py, I will paste the modification when I am back home.
and will attach jbig2.exe when I am back home.

Original comment by roc...@gmail.com on 28 Oct 2009 at 9:34

GoogleCodeExporter commented 9 years ago
you can download jbig2.exe here,
http://soft.rubypdf.com/softwares/windows-version-jbig2-encoder-jbig2-exe
and the modification of pdfsizeopt.py I did,
line 66,
--return "'%s'" % string.replace("'", "'\\''")
++return "\"%s\"" % string.replace("'", "'\\''")
windows treats single quote as part of path, so have to use double quote.

line 5824
--ShellQuoteFileName(multivalent_jar)
++'Multivalent.jar'
the multivalent_jar variable does not get the correct path of Multivalent.jar, 
why
not directly use Multivalent.jar?

Original comment by roc...@gmail.com on 28 Oct 2009 at 6:08

GoogleCodeExporter commented 9 years ago
To get rid of the ``generation refs not implemented'' error, please sync to r96 
(svn
update), and try again.

Original comment by pts...@gmail.com on 29 Oct 2009 at 8:04

GoogleCodeExporter commented 9 years ago
yes, fixed

Original comment by roc...@gmail.com on 29 Oct 2009 at 4:23

GoogleCodeExporter commented 9 years ago

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