为什么TCPDF图像比它应该小? [英] Why is TCPDF Image smaller than it should be?

查看:801
本文介绍了为什么TCPDF图像比它应该小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个842 x 595 PDF,72 dpi,我正在插入1200x800图像,再次使用72dpi。

I have a 842 x 595 PDF, 72 dpi and i'm inserting a 1200x800 image, again with 72dpi.

scaleFactor为1,imageScale为1

scaleFactor is 1, imageScale is 1

理论上,我的pdf应显示部分图像(首先842px)。实际上这个比例是错误的,我的右边和底部都有空格。

in theory, my pdf should show part of the image (the first 842px). In reality the ratio is wrong, i have white space to the right and bottom.

我正在从FPDF升级,如果我切换回它,它显示图片确定。

I'm upgrading from FPDF and if i switch back to that it shows the picture ok.

$pdf = new TCPDF($this->orientation, 'pt', $this->format, true, 'UTF-8', false);
$pdf->setMargins(0, 0, -1, 1);
$pdf->setJPEGQuality(90);
$pdf->setImageScale(1);

$pdf->Image($image->path,0,0,0,0,'','','T',false, 72,'',false,false,0,'LT');

如果我转储$ pdf对象,大小和比例看起来都很好......

The sizes and scales all look fine if i dump the $pdf object...

我错过了什么吗?

推荐答案

$pdf->SetAutoPageBreak(false, 0);

如果有人遇到同样的问题,我就是这样解决的。当我找到有同样问题的人时,我讨厌它,并且在他们解决之后没有得到答案。

If someone is having the same problem, this is how i solved it. I hate it when i find people with the same exact problem i have and don't get back with the answer after they solved it.

这篇关于为什么TCPDF图像比它应该小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆