Issue 24: Duplicate obj /Page can't be removed
Status:  WontFix
Owner: ----
Closed:  Apr 2012
Reported by j.lefebv...@gmail.com, Jan 15, 2010
version r134

If Obj /Page was duplicate in a PDF, pdfsizeopt remove duplicate Obj page
.... but PDF was corrupt Ex: 

1 0 obj<< 
/Type /Pages
/Count 3
/Kids [
 7 0 R
 11 0 R 
 12 0 R # same as 7 0 R
]
<<
pdfsizeopt produce ... 
1 0 obj<< 
/Type /Pages
/Count 3
/Kids [
 7 0 R
 11 0 R 
 7 0 R
]
<<

Acrobat reader cannot be show Page 3 ... small box 

I join a small dirty fix 

Jan 15, 2010
#1 j.lefebv...@gmail.com
I join a correct small dirty Fix ;-)
Jan 15, 2010
#2 j.lefebv...@gmail.com
Again again .... the true correct ... small dirty Fix ;-)
pdfsizeopt.r134fix.patch
690 bytes   View   Download
Jan 16, 2010
Project Member #3 pts...@gmail.com
Thank you for the patch. Before I can apply it to pdfsizeopt, I'll make sure it's the
right thing to do.

Could you please send me a small example input and output PDF and also specify the
version of Acrobat Reader and the operating system you use?
Jan 16, 2010
#4 j.lefebv...@gmail.com
I produce a better dirty patch ;-)

I have created a small PDF to illustrate the problem.

Tested on Acrobat Reader 7 8 9 same visual BUG

In  : intergral.merge.pdf
Out : intergral.merge.opt.pdf

info: This is pdfsizeopt-dev.py r134.
info: loading PDF from: integral.merge.pdf
info: loaded PDF of 183559 bytes
info: separated to 31 objs
info: found 0 Type1 fonts loaded
info: found 0 Type1C fonts loaded
info: eliminated 16 duplicate objs
info: writing Multivalent input PDF: pso.conv.mi.tmp.pdf
info: saving PDF with 14 objs to: pso.conv.mi.tmp.pdf
info: generated 61641 bytes (34%)
info: executing Multivalent to optimize PDF: java -cp
/home/stuff/dev/pdf/pdfsizeopt-read-only/Multivalent.jar tool.pdf.Compress
pso.conv.mi.tmp.pdf
file:/home/stuff/dev/pdf/pso.conv.mi.tmp.pdf, 61641 bytes
PDF 1.4, producer=itext-paulo-155 (itextpdf.sf.net-lowagie.com), creator=?pdftk 1.41
- www.pdftk.com
additional compression may be possible with:
         -compact
=> new length = 61306, saved 0%, elapsed time = 0 sec
info: Multivalent generated pso.conv.mi.tmp-o.pdf of 61328 bytes (99%)
info: compressed xref stream from 32 to 149 bytes (466%)
info: optimized to 61198 bytes after Multivalent (100%)
info: saving PDF to: integral.merge.opt.pdf
info: generated 61198 bytes (33%)

pdfsizeopt.r134fix.patch
782 bytes   View   Download
intergral.merge.pdf
172 KB   Download
integral.merge.opt.pdf
59.8 KB   Download
Feb 10, 2011
Project Member #5 pts...@gmail.com
(No comment was entered for this change.)
Status: Accepted
Apr 15, 2012
Project Member #6 pts...@gmail.com
The latest pdfsizeopt has a --do-unify-pages= flag. The default, --do-unify-pages=true may not work for you. Could you please attach a sample .pdf whose optimized version Acrobat Reader can display properly with --do-unify-pages=true, but not with --do-unify-pages=false? Please also specify the Acrobat Reader version. Please use the latest pdfsizeopt.

Unfortunately, I couldn't reproduce the problem with the integral.merge.pdf previously attached. I get very different output for it:

info: eliminated 5 duplicate objs
info: saving PDF with 14 objs with Multivalent to: /mnt/mandel/warez/tmp/ issue24 .psom.pdf
info: writing Multivalent input PDF: pso.conv.mi.tmp.pdf
info: generated object stream of 850 bytes in 9 objects (12%)
info: written 87341 bytes to Multivalent input PDF: pso.conv.mi.tmp.pdf
info: executing Multivalent to optimize PDF: java -cp .../Multivalent.jar -Djava.awt.headless=true tool.pdf.Compress -nopagepiece -noalt pso.conv.mi.tmp.pdf
file:/home/pts/prg/pdfsizeopt/trunk/pso.conv.mi.tmp.pdf, 87341 bytes
PDF 1.5, producer=itext-paulo-155 (itextpdf.sf.net-lowagie.com), creator=pdftk 1.41 - www.pdftk.com
additional compression may be possible with:
         -compact
=> new length = 83142, saved 4%, elapsed time = 0 sec
info: Multivalent generated pso.conv.mi.tmp-o.pdf of 83164 bytes (95%)
info: compressed xref stream from 85 to 200 bytes (235%)
info: optimized to 83031 bytes after Multivalent (100%)
info: generated 83031 bytes with Multivalent (47%)

I close this issue now. I'll reopen it once I have the file which which exposes the problem.
Summary: Duplicate obj /Page can't be removed
Status: WontFix