简体   繁体   English

带WhiteOctober捆绑包的TCPDF中的自定义页眉和页脚

[英]Custom header and footer in TCPDF with WhiteOctober Bundle

I'm using TCPDF for creating PDF files in my Symfony2 application and I would like to change the way header and footer is generated. 我正在使用TCPDF在Symfony2应用程序中创建PDF文件,我想更改页眉和页脚的生成方式。 I have integrated the class as service by using WhiteOctober Bundle. 我通过使用WhiteOctober Bundle将类作为服务集成到了服务中。 So is there any way how to change header and footer functions within this bundle? 那么,有什么方法可以更改此捆绑包中的页眉和页脚功能? If not, how should I use and customize TCPDF otherwise? 如果没有,应该如何使用和自定义TCPDF?

The only possibility for customizing this bundle seem to be changing Configuration.php file, but there are defined only TCPFD constants. 定制此捆绑包的唯一可能性似乎是更改Configuration.php文件,但仅定义了TCPFD常量。

Create a own class that extends the TCPDF class. 创建一个扩展TCPDF类的自己的类。 Override the methods Header() and Footer() to define your custom header and footer. 重写方法Header()Footer()来定义自定义页眉和页脚。 If you need different headers and footers for example front pages you can check for page numbers and so on. 如果您需要不同的页眉和页脚(例如首页),则可以检查页码等。

After implementing the class, use your custom class as service. 实现该类之后,将您的自定义类用作服务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM