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

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

+6
source share
4 answers

As far as I know, PDF documents do not have DPI settings, as they are vector objects. I assume that you are actually referencing inline bitmaps (JPEG, GIF ...). In this case, just check the documentation for the Image () function : the fourth 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); 
+10
source

Not. But if you want to reduce the size of the document, you can use the FPDF SetCompression () method:

 $pdf = new FPDF(); $pdf->SetCompression(true); 

More information is available on their web page in the Guide section: http://www.fpdf.org/en/doc/setcompression.htm .

0
source

If you are looking for a way to configure the conversion of px → mm to mPdf:

http://mpdf1.com/manual/index.php?tid=449

http://mpdf1.com/manual/index.php?tid=148

0
source

Source: https://habr.com/ru/post/913343/


All Articles