创建PDF模板: Difference between revisions

Jump to navigation Jump to search
Line 49: Line 49:
生成的模板将保存在如下路径中:
生成的模板将保存在如下路径中:


* custom/mymodule/core/modules/doc/pdf_standard_myobject.class.php
*custom/mymodule/core/modules/doc/pdf_standard_myobject.class.php
* custom/mymodule/core/modules/doc/doc_generic_myobject_odt.class.php
*custom/mymodule/core/modules/doc/doc_generic_myobject_odt.class.php


=自定义您的新模板=
=自定义您的新模板=
Line 61: Line 61:
查找函数 write_file() 。它显示PDF的正文。
查找函数 write_file() 。它显示PDF的正文。


==PDF操作库==
==用于PDF操作的库==
用于在PHP语言中创建PDF文档的库被称为FPDF,可以被找到于'''htdocs/includes/tcpdf/tcpdf.class.php'''文件中。在这个类中,您可以找到用于生成文档不同部分的所有不同方法。
用于创建PDF文档的库被称为TCPDF,可以在'''htdocs/includes/tcpdf/tcpdf.class.php'''中找到。在这个类中,您还可以找到许多用于生成文档的不同元素的方法。


模板实例化了此FPDF类,并使用其方法,结合了发票、订单或其他类型的数据。
PDF生成模板通过调用 pdf_getInstance() 来实例化PDF对象,然后将其方法与发票、订单或其他对象中的数据结合使用。


我们可以在生成PDF文档的模板时调用以下函数:
在文档创建脚本中通常会发现以下调用:


*$pdf->SetFont() - ''Define the font to use for the text''
*$pdf->SetFont() - ''指定用于后续文本的字体''
*$pdf->SetXY() - ''Define position (X,Y) for next text that will be output onto page''
*$pdf->SetXY() - ''指定以X、Y坐标绘制下一个文本的起点,以页面的毫米为单位''
*$pdf->MultiCell() - ''Draw a box containing text. Used to output any text''
*$pdf->MultiCell() - ''绘制一个可以包含文本的框,其中必须首先给出宽度和高度-非常常用''
*$pdf->GetY() - ''Return current Y position''
*$pdf->GetY() - ''返回Y的当前位置''
*$pdf->SetDrawColor() - ''Set the color to use for new text to write - ie black (0,0,0) or white (255,255,255)''
*$pdf->SetDrawColor() - ''指定用于下一个要写入的文本的颜色-通常为黑色(0,0,0)或白色 (255,255,255)''
*$pdf->Rect() - ''Drwa a rectanle whose top left corner coordinates ared defineds by two first parameters and bottom right corner is defined by two following parameters that are relative values''
*$pdf->Rect() - ''绘制一个矩形,其左上角位于前两个参数指示的点,右下角在前两个参数的相对模式下使用最后两个参数''


==脚本框架==
==脚本框架==
714

edits

Navigation menu