TCPDF 二维码在小尺寸页面上调整大小 [英] TCPDF Qr code resize on small size page

查看:36
本文介绍了TCPDF 二维码在小尺寸页面上调整大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用此代码创建了一个 80x30 毫米的 pdf 文件和一个 25x25 毫米的二维码:我更改了二维码的宽度和高度,但它没有调整大小,而且我总是在页面中看到一个小二维码.错误在哪里??请帮帮我...我无法理解这个问题!:)

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
//============================================================+
?>    

谢谢!!!

推荐答案

问题解决:

之前:

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

之后:

[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.

再次感谢您的关注.

:)

这篇关于TCPDF 二维码在小尺寸页面上调整大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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