4

I am creating pdf reports using R (command ?pdf). The reports contain images that I have created and that are quite heavy (lot of datapoints) The created pdfs are very heavy. Is there a way to reduce the quality of the pdf when creating it?

I know I can do it using pdftk but I'd rather do it in one go as I want to minimize the number of manual operations.

RockScience
  • 17,932
  • 26
  • 89
  • 125

2 Answers2

3

If your PDF has a large number of data points sometimes a raster presentation is more efficient. You lose the infinite zoom of a vector format but can have a very nice representation for print or normal viewing sizes. It may also render faster.

Try generating your graphic in PDF and raster formats and see which is more efficient / suits your needs. You might be surprised that a PNG makes you happier.

John
  • 23,360
  • 7
  • 57
  • 83
  • Thanks for your answer. I'll will certainly do that. By in the end I would like to have a pdf. Do you know if it is possible to include a png inside the pdf? (without creating first the png then concatening) – RockScience Mar 15 '11 at 01:18
  • I suppose for PDF embedding jpeg is probably best just because it's the most compatible. – John Mar 15 '11 at 05:06
2

It seems that there is no other solution than calling pdftk:
(extract from ?pdf)

pdf writes uncompressed PDF. It is primarily intended for producing 
PDF graphics for inclusion in other documents, and PDF-includers such 
as pdftex are usually able to handle compression: there are a large 
number of PDF compression utilities such as pdftk. 
RockScience
  • 17,932
  • 26
  • 89
  • 125