TCPDF 二维码在小尺寸页面上调整大小
我使用此代码创建一个带有 25x25 毫米 qrcode 的 80x30 毫米 pdf 文件:我更改了 qrcode 宽度和高度,但它没有调整大小,而且我总是在页面中看到一些 qrcode。 错误在哪里??请帮助我...我无法理解这个问题! :)
<?php
require_once('../config/lang/eng.php');
require_once('../tcpdf.php');
// create new PDF document
$pdf = new TCPDF("L", "mm", array(80,30) , true, 'UTF-8', false);
//set margins
$pdf->SetMargins(0, PDF_MARGIN_TOP, 0);
$pdf->SetHeaderMargin(0);
$pdf->SetFooterMargin(0);
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
//set auto page breaks
$pdf->SetAutoPageBreak(false, 0);
//set image scale factor
$pdf->setImageScale(1);
//set some language-dependent strings
$pdf->setLanguageArray($l);
// add a page
$pdf->AddPage();
$pdf->SetAutoPageBreak(false, 0);
// new style
$style = array(
'border' => false,
'padding' => 'auto',
'fgcolor' => array(0,0,0),
'bgcolor' => false
);
$pdf->write2DBarcode('http://www.google.it/', 'QRCODE,H', 50, 1, 300, 300, $style, 'N');
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('test.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
?>
谢谢你!!!
I use this code for create a 80x30 mm pdf file with a 25x25 mm qrcode: I change the qrcode width and height but it doesn't resize and I always see a little qrcode into the page.
Where is the error?? Please help me... I can't undertand the problem! :)
<?php
require_once('../config/lang/eng.php');
require_once('../tcpdf.php');
// create new PDF document
$pdf = new TCPDF("L", "mm", array(80,30) , true, 'UTF-8', false);
//set margins
$pdf->SetMargins(0, PDF_MARGIN_TOP, 0);
$pdf->SetHeaderMargin(0);
$pdf->SetFooterMargin(0);
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
//set auto page breaks
$pdf->SetAutoPageBreak(false, 0);
//set image scale factor
$pdf->setImageScale(1);
//set some language-dependent strings
$pdf->setLanguageArray($l);
// add a page
$pdf->AddPage();
$pdf->SetAutoPageBreak(false, 0);
// new style
$style = array(
'border' => false,
'padding' => 'auto',
'fgcolor' => array(0,0,0),
'bgcolor' => false
);
$pdf->write2DBarcode('http://www.google.it/', 'QRCODE,H', 50, 1, 300, 300, $style, 'N');
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('test.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
?>
Thank you!!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题已解决:
之前:
之后:
问题是构造函数页面方向给系统造成混乱:默认纵向是可以的,我只需将添加页面方向更改为横向,问题就解决了。
再次感谢您的关注。
:)
Problem solved:
Before:
After:
The problem is the constructor page orientation that create confusion to the system: default portrait is ok, I have only to change the Add page orientation to Landscape and the problem is solved.
Thank you again for the attention.
:)