[R-pkg-devel] Some, but not all vignettes compressed

Ivan Krylov |kry|ov @end|ng |rom d|@root@org
Thu Apr 25 20:26:40 CEST 2024


В Thu, 25 Apr 2024 08:54:41 -0700
Bryan Hanson <hanson using depauw.edu> пишет:

>   'gs+qpdf' made some significant size reductions:
>      compacted 'Vig_02_Conceptual_Intro_PCA.pdf' from 432Kb to 143Kb
>      compacted 'Vig_03_Step_By_Step_PCA.pdf' from 414Kb to 101Kb
>      compacted 'Vig_04_Scores_Loadings.pdf' from 334Kb to 78Kb
>      compacted 'Vig_06_Math_Behind_PCA.pdf' from 558Kb to 147Kb
>      compacted 'Vig_07_Functions_PCA.pdf' from 381Kb to 90Kb

I'm getting similar (but not same) results on Debian Stable, gs 10.00.0
& qpdf 11.3.0:

# R CMD build --no-resave-data --compact-vignettes=both
    compacted ‘Vig_01_Start_Here.pdf’ from 244Kb to 45Kb           
    compacted ‘Vig_02_Conceptual_Intro_PCA.pdf’ from 432Kb to 143Kb
    compacted ‘Vig_03_Step_By_Step_PCA.pdf’ from 411Kb to 100Kb    
    compacted ‘Vig_04_Scores_Loadings.pdf’ from 335Kb to 78Kb      
    compacted ‘Vig_05_Visualizing_PCA_3D.pdf’ from 679Kb to 478Kb  
    compacted ‘Vig_06_Math_Behind_PCA.pdf’ from 556Kb to 145Kb     
    compacted ‘Vig_07_Functions_PCA.pdf’ from 378Kb to 89Kb        
    compacted ‘Vig_08_Notes.pdf’ from 239Kb to 39Kb                

 
> - doc/Vig_01_Start_Here.pdf:    gs: res=0;  + qpdf: res=0; 
>     ==> (new=49942)/(old=45101) = 1.10734 .. not worth using  
> - doc/Vig_02_Conceptual_Intro_PCA.pdf:    gs: res=0;  + qpdf: res=0; 
>     ==> (new=1.00061e+07)/(old=442210) = 22.6275 .. not worth using  
> - doc/Vig_03_Step_By_Step_PCA.pdf:    gs: res=0;  + qpdf: res=0; 
>     ==> (new=5.763e+06)/(old=423484) = 13.6085 .. not worth using  
> - doc/Vig_04_Scores_Loadings.pdf:    gs: res=0;  + qpdf: res=0; 
>     ==> (new=5.41409e+06)/(old=341680) = 15.8455 .. not worth using  
> - doc/Vig_05_Visualizing_PCA_3D.pdf:    gs: res=0;  + qpdf: res=0; 
>     ==> (new=1.23622e+07)/(old=692901) = 17.8412 .. not worth using  
> - doc/Vig_06_Math_Behind_PCA.pdf:    gs: res=0;  + qpdf: res=0; 
>     ==> (new=816690)/(old=571493) = 1.42905 .. not worth using  
> - doc/Vig_07_Functions_PCA.pdf:    gs: res=0;  + qpdf: res=0; 
>     ==> (new=1.36419e+06)/(old=389478) = 3.50262 .. not worth using  
> - doc/Vig_08_Notes.pdf:    gs: res=0;  + qpdf: res=0; 
>     ==> (new=40919)/(old=38953) = 1.05047 .. not worth using  

Thank you for providing this data! Somehow, instead of compacting the
PDFs, one of the tools manages to blow them up in size, as much as ~23
times.

Can you try tools::compactPDF() separately with gs_quality = 'none'
(isolating qpdf) and with qpdf = '' (isolating GhostScript)?

If the culprit turns out to be GhostScript, it may be due to their
rewritten PDF rendering engine (now in C instead of PostScript with
special extensions) not being up to par when the PDF file needs to be
compressed. If it turns out to be qpdf, we might have to extract the
exact command lines and compare results further.

-- 
Best regards,
Ivan



More information about the R-package-devel mailing list