Is there a way to set the DPI of output pdf using FPDF library?

Abhishek picture Abhishek · Apr 16, 2012 · Viewed 12.5k times · Source

Is there a way to reduce the DPI of an output pdf without affecting its size using FPDF library?

Answer

Álvaro González picture Álvaro González · Apr 16, 2012

As far as I know, PDF documents do not have DPI settings, given that they are vector objects. I assume you actually refer to embedded raster images (JPEG, GIF...). In that case, just check the documentation for the Image() function: forth and fifth parameters ($w and $h) can express the desired DPI if you write a negative value:

// Insert a logo in the top-left corner at 300 dpi
$pdf->Image('logo.png',10,10,-300);