我想通过TCPDF设置一些文本块。但我在字体大小上有一些问题。第一个文本块位于x/5-5上,其字体大小为5 to。但它是相似的,那么5。字体大小在TCPDF是不是在相同的单位,就像其他维度?
$text1 = 'AAAg';
$text1_x = 5;
$text1_y = 5;
$text1_font_size = 5;
$text2 = 'BBBg';
$text2_x = 10;
$text2_y = 10;
$text2_font_size = 10;
$text3 = 'CCCg';
$text3_x = 15;
$text3_y = 15;
$text3_font_size = 15;
// I tried $pdf->Cell and $pdf->Text... both are doing the same...
网络例子。
发布于 2015-04-23 05:54:57
好的,我找到了答案和解决方案。当我们在tcPDF中创建新的PDF文档时,整个文档的维度单元可以是mm、cm、pt、px等格式。但字体是点- pt。
所以解决办法..。
PHP - tcPDF Exampe:
$pdf->setPageUnit('pt');
$document_width = $pdf->pixelsToUnits('100');
$document_height = $pdf->pixelsToUnits('100');
$x = $pdf->pixelsToUnits('20');
$y = $pdf->pixelsToUnits('20');
$font_size = $pdf->pixelsToUnits('20');
$txt = 'AAAg';
$pdf->SetFont ('helvetica', '', $font_size , '', 'default', true );
$pdf->Text ( $x, $y, $txt, false, false, true, 0, 0, '', false, '', 0, false, 'T', 'M', false );
发布于 2015-04-22 12:18:43
在TCPDF中改变字体大小..。可以使用以下代码设置:
$pdf = new TCPDF();
$pdf->SetFont('Font family', '', font size here);
哪些是TCPDF中的默认设置?
https://stackoverflow.com/questions/29795896
复制相似问题