whenever I view it in chrome it zooms in at 100% to the top left corner. The problem is I need the images to be large and suitable to print (7"x5" or thereabouts) and so the PDF isn't built to be viewed at 100%, it just looks too zoomed in.
Every other browser respects the fit to width setting.
My images are 1600px on their long side, pages are landscape.
Try setting $zoom to 100 (or below - as a percentage value) instead of "fullwidth". Or did you try that and it leads to other problems?
// EDIT:
Or maybe "fullpage" or "default" instead of "fullwidth"?
// EDIT 2:
No, forget that, it doesn't work... I'm just trying your code with two of the images, I can reproduce the problem. It's a bit weird, Chrome seems to completely ignore SetDisplayMode(), you can set zoom to anything you like, it'll always keep this weird zoom mode beyond 100%. I'll try to play around with it some more later.
Last edit: cpw 2014-12-05
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It's $format in AddPage() - it seems Chrome sticks to the set PDF unit (which defaults to millimeters) regarding these values while seemingly ignoring SetDisplayMode() completely, so your page width is e.g. 1600 mm = 160 cm which Chrome displays in real size, hence the massive "overzoom".
Changing
(Line 11)
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
to
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, "pt", PDF_PAGE_FORMAT, true, 'UTF-8', false);
should solve the problem and hopefully not create others.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi all!
I'm tearing my hair out with this one. I've got this page that generates PDF's via TCPDF http://www.kinho.com/lightbox/
whenever I view it in chrome it zooms in at 100% to the top left corner. The problem is I need the images to be large and suitable to print (7"x5" or thereabouts) and so the PDF isn't built to be viewed at 100%, it just looks too zoomed in.
Every other browser respects the fit to width setting.
My images are 1600px on their long side, pages are landscape.
here's the create.php: https://dl.dropboxusercontent.com/u/14123055/PHP/create.php
Can anybody advise a workaround for chrome?
many thanks!
Bumb, does anybody know?
Line 69:
Try setting $zoom to 100 (or below - as a percentage value) instead of "fullwidth". Or did you try that and it leads to other problems?
// EDIT:
Or maybe "fullpage" or "default" instead of "fullwidth"?
// EDIT 2:
No, forget that, it doesn't work... I'm just trying your code with two of the images, I can reproduce the problem. It's a bit weird, Chrome seems to completely ignore SetDisplayMode(), you can set zoom to anything you like, it'll always keep this weird zoom mode beyond 100%. I'll try to play around with it some more later.
Last edit: cpw 2014-12-05
OK, I think I might have found the problem:
It's $format in AddPage() - it seems Chrome sticks to the set PDF unit (which defaults to millimeters) regarding these values while seemingly ignoring SetDisplayMode() completely, so your page width is e.g. 1600 mm = 160 cm which Chrome displays in real size, hence the massive "overzoom".
Changing
(Line 11)
to
should solve the problem and hopefully not create others.