I am trying to create a PDF using TCPDF library. I have some problem with table written with method writeHTML() though. When table has to many rows, the rest of it is moved to the next page. Its proper behavior, but I need to to have some top margin on this new page. However TCPDF is making only default margin, which is to small in my case. Ive tried to us开发者_运维百科e setMargins(), setXY() but nothing seems to work. It even looks like general margins of PDF has no influcence on content created by writeHTML(). Anyone had similar problem?
TCPDF::SetMargins($left,$top,$right = -1,$keepmargins = false)
And describes the parameters as:
Parameters:
$left (float) Left margin.
$top (float) Top margin.
$right (float) Right margin. Default value is the left one.
$keepmargins (boolean) if true overwrites the default page margins
So, for the right margin a -1 is used to indicate that no right margin was supplied and to use the same as the left margin. You were using -50 which is not a valid margin.
Try this instead:
$pdf->SetMargins(10, 10, 10, true);
Try using the PDF_MARGIN_HEADER and PDF_MARGIN_FOOTER variables in the config file of tcpdf. WriteHTML recognises these and skips to the next page and starts taking these margins into account.
精彩评论