Welcome Guest, Not a member yet? Register   Sign In
tcpdf configuration
#3

(07-11-2022, 08:42 AM)dgvirtual Wrote:
(07-07-2022, 07:17 AM)Erwin Wrote: Hi,
I'm using tcpdf 6.4.1 with Codeigniter 4. It works without any problems.
There are a few changes in the configuration that I need:
For example, I have changed the definition for PDF_MARGIN_TOP in vendor/tecnickom/tcpdf/config.
I would prefer to leave the vendor directory untouched and keep those changes inside my /app directory. Any ideas how this can be done?

I do not use the library directly, but will try to help you.

When you start using the tcpdf library, you initiate a new tcpdf object:

PHP Code:
$pdf = new TCPDF(PDF_PAGE_ORIENTATIONPDF_UNITPDF_PAGE_FORMATtrue'UTF-8'false); 

and then you can manipulate it's properties through the TCPDF class methods.

The property you refer to is defined in the config file as a constant:

PHP Code:
define ('PDF_MARGIN_TOP'27); 

But as described in the documentation, you can change it through the TCPDF method SetMargins:

PHP Code:
$pdf->SetMargins(PDF_MARGIN_LEFTPDF_MARGIN_TOPPDF_MARGIN_RIGHT); 

Instead of using the defaults (as in the example line above) you can use your own numbers - all or part of them:

PHP Code:
$pdf->SetMargins(PDF_MARGIN_LEFT33PDF_MARGIN_RIGHT); 
Hi,
thanks for your answer. This works with definitions that aren't used in the TCPDF class. In my case, I want to set K_TCPDF_CALLS_IN_HTML to true to be able to use the tcpdf  tag in HTML.
Reply


Messages In This Thread
tcpdf configuration - by Erwin - 07-07-2022, 07:17 AM
RE: tcpdf configuration - by dgvirtual - 07-11-2022, 08:42 AM
RE: tcpdf configuration - by Erwin - 07-11-2022, 12:07 PM
RE: tcpdf configuration - by dgvirtual - 07-28-2022, 12:59 PM
RE: tcpdf configuration - by Erwin - 08-04-2022, 03:14 PM



Theme © iAndrew 2016 - Forum software by © MyBB