Martin Magnusson wrote:
> Hi,
>
> I have written a script that takes an uploaded jpeg-image and places it in
> a
> PDF-file with the PDFLib functions in php. The original image file is
> 560x420, 72 dpi. Later on the PDF-file will be printed, and our printshop
> requires at least 200 dpi. The format of the printed image should be A6
> (15,2x10,9 cm).
>
> Is it possible to change resolution like this?

Yes, though the original could end up being awful grainy, depending on
what size you make it in the PDF...

PDFs are always 72-dpi, so you basically make everything be 200/72 X as
big as you want to get 200-dpi, if you know what I mean.

The image itself will get taken care of by libPDF pretty much -- Just
scale it to fit the size you want.  You can't take 72-dpi to 200-dpi in
the same size and not get it grainy though.  So maybe make the image
280x120 or even 140x60 at the 200 dpi to keep it looking good.

Though, of course, when all is said and done, you'll be using 200/72 X 140
= ~500 in your script to get the PDF to be 200-dpi.  Hope that makes
sense.  I'm no expert on this stuff, but that's what worked for me.

Sorta like this:

<?php
  $scale = 200/72;
  $pdf = pdf_new($scale * XX, $scale * YY);
  //XX == 15,2 cm <-> 72-dpi == ~7in X 72dpi == 500???
  //YY == 10,9 cm == ~5in X 72dpi == 350???
  pdf_image_place($pdf, 20 * $scale, 20 * $scale, 0.5); //Play with scale
of  0.5 to see what works, or maybe base it on the image size and $scale
or...
.
.
.

Basically draw everything with $scale as a multiplier so the 72-dpi PDF is
200/72 times as big as you want it to be, so it ends up being 200-dpi when
it gets printed/shrunk to the actual paper.

Again, that may be the wrong way to do it, but it "worked for me" in what
I had to do to get what I needed...  YMMV

-- 
Like Music?
http://l-i-e.com/artists.htm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to