From ligges at statistik.tu-dortmund.de  Mon Apr 22 23:51:27 2013
From: ligges at statistik.tu-dortmund.de (Uwe Ligges)
Date: Mon, 22 Apr 2013 23:51:27 +0200
Subject: [Rd] vignettes: problems with PDF compaction
In-Reply-To: <51755E5C.10306@yorku.ca>
References: <517421D0.2@yorku.ca> <51755E5C.10306@yorku.ca>
Message-ID: <5175B0DF.1080703@statistik.tu-dortmund.de>



On 22.04.2013 17:59, Michael Friendly wrote:
> On 4/21/2013 1:28 PM, Michael Friendly wrote:
>> [Env: OS: Win Xp; R 2.15.2; IDE: eclipse/StatET]
>>
>> Each time I update my heplots package, I get warnings from R CMD check
>> on R-Forge,
>>
>> * checking sizes of PDF files under ?inst/doc? ... WARNING
>>    ?gs+qpdf? made some significant size reductions:
>>       compacted ?HE-examples.pdf? from 739Kb to 366Kb
>>
> To follow up my own post, I did some more checking of whether/how to
> compact PDFs on my own system.  My conclusion is that that I am unable
> to comply with the request from CRAN maintainers, even though I would
> like to.  Once again, I wonder why this cannot be handled on the CRAN
> side automatically.

Because we cannot know if the result is acceptable. This is not a 
lossless compression.



> qpdf: running it from a cmd prompt (using the options from
> tools::compactPDF) doesn't do very much compression
>
> C:\R\test>qpdf --stream-data=compress --object-streams=generate
> HE-examples.pdf
> HE-examples-comp.pdf
>
> C:\R\test>dir HE-examples*
> 04/22/2013  10:55 AM           699,191 HE-examples-comp.pdf
> 04/22/2013  10:28 AM           756,624 HE-examples.pdf
>
> gs:  I have gs installed at C:\Program Files\gs\gs9.07\bin\gswin32.exe,
> but the gs installer doesn't put itself on the path, so
> tools::compactPDF sees gs_cmd as empty:
>
>  > gs_cmd = Sys.getenv("R_GSCMD", "")
> [1] ""
>
> so it can't run gs+qpdf.  OK, so I try to do it manually:
>
>  > Sys.setenv(R_GSCMD = "C:/Program Files/gs/gs9.07/bin/gswin32.exe")
>  > setwd("test")
>  >
>  > tools::compactPDF("HE-examples.pdf")
>  > tools::compactPDF("HE-examples.pdf", gs_quality="ebook")
>
> But this doesn't do anything, not even changing the timestamp on the
> file, because the file size doesn't change enough.

Either you changed it or not, there is no "not enough".

Best,
Uwe



> C:\R\test>dir HE-examples.pdf
> 04/22/2013  10:28 AM           756,624 HE-examples.pdf
>



[Rd] vignettes: problems with PDF compaction
Uwe Ligges