开发者

TCPDF Qr code resize on small size page

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');

/开发者_如何学Python/ 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!!!


Problem solved:

Before:

[...]
$pdf = new TCPDF("L", "mm", array(80,30) , true, 'UTF-8', false);
[...]
$pdf->AddPage();
[/code]

After:

[code]
[...]
$pdf = new TCPDF("P", "mm", array(80,30) , true, 'UTF-8', false);
[...]
$pdf->AddPage('L', '', false, false);
[/code]

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.

:)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜