FPDF PHP using SetY footer displays on next page - fpdf

When using SetY in FPDF the content seems to not be placed based on the bottom of a page. I've tried using their example of a footer:
class PDF extends FPDF
{
// Page footer
function Footer()
{
// Position at 1.5 cm from bottom
$this->SetY(-15);
// Arial italic 8
$this->SetFont('Arial','I',8);
// Page number
$this->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
}
}
And also just placing it at the end of my page:
//Regular page content
$pdf->Cell(40,10,'Apple and iPhone are trademarks of Apple Inc., registered in the U.S. and other countries.');
//Footer content
$pdf->SetY(-15);
// Arial italic 8
$pdf->SetFont('Arial','I',8);
// Page number
$pdf->Cell(0,10,'Page '.$this->PageNo().'/{nb}',0,0,'C');
$pdf->Output();
But both seem to be relative to the content that is already loaded on the pdf page, not based on the bottom of the page. If the content of the page is 40 lines, the footer content will load on the same page. If the content of the page is 100 lines, the footer content is displayed at the top of a new page.
Any input is appreciated.

Try setting the Y to be positive. ex: $pdf->SetY(240); It wil set the position realtive to the top of the page.

I'm 6-1/2 years late to the party, for but the next poor sap with this same problem:
The solution for me was to add $pdf->SetAutoPageBreak(false);
No idea why the position Y at the bottom doesn't always work as intended and instead pushes the new item to a new page... but turning off AutoPageBreak() was the fix for me.

Related

EVOpdf generates empty pdf page when exporting

Currently I'm working on a PDF export. I want to add an bottom margin to my pdf, but this results in a empty pdf page. The first PDF page has enough room for all of the content but it still produces a blank page. When I remove the bottom margin the blank page disappears but it can happen when I have more than 2 pdf pages it still produces an extra empty PDF between the 2 pages. I don't know why this is happening.
Anybody has any idea? :)
Thanks,
Mark

Add multi page text box in Crystal Reports 2013

We have a multi-page Terms and Conditions which needs to print out at then end of our Quotes. I created a single row text box and pasted it in. I tried it in Page Footer a and well as Page Footer b. I formatted the text box: Can Grow with all the other boxes unchecked. I can scroll down through it to see it is all there in the text box, but when I View Preview it doesn't expand beyond one page. How can I make it grow into multiple pages?
It worked when placed in the Report Footer b section.

How to remove additional white space in between reports data Jasper HTML view only?

I am facing an issue in JasperReports HTML view. While generating the HTML view, it is showing an additional white space in between reports data (see the screenshot bellow). Actually, that extra white space is the report's footer (eg:- pdf page footer), and I don't want to show this footer in my HTML view. So, I have hidden the footer part altogether.
Is it possible to remove this white space only from the HTML view?
This issue is solved . When I set the parameter ignore pagination to true on REST API for HTML side only.

EvoPdf Page backgrounds and Margins

I am converting HTML pages using EvoPdf and would like to add a background image. I am generating documents and would like to add a cover page, I am doing this by prepending the HTML for the cover page then putting a page break directly after.
I am using this demo as a guide http://www.evopdf.com/demo/HTML_to_PDF/PDF_Pages_Background/Add_Elements_in_Background.aspx and have found that I need to remove the page margins for the image to cover the whole page otherwise it sits inside the margins.
If I remove the margins this means the content that flows over pages now starts directly at the top of the page and flows right to the bottom. I can fix this for left and right margins by putting this in the HTML but this does not work for top and bottom margins that flow over pages. (see the generated PDF from the above demo)
Is there a way to set the PDF page background irrespective of the page margins? I have been looking at creating multiple documents with their own configuration and merging the PDF's but I really want to avoid this.
You can set up a header and footer with the heights you wanted for the top and bottom margins, and then choose to not display them on the first page. This should give you the effect you're looking for.
You can find more information about how to do this here: http://www.evopdf.com/demo/HTML_to_PDF/Headers_and_Footers/HTML_in_Header_Footer.aspx

How to move up 2nd page margin to top in Crystal Report Cross tab

I build report by using cross tab in crystal report in the first page i have title page that take area about 1/4 of the page consist with logo and report name and filter detail So on the second page it shown up the same position as the first page something that I want is to remove the report header section and move up the page header section and detail section to top on the 2nd page Thanks you for answer and i want to know Is this need to do ?? because some aspect of user tell that Its' okay don't move 2nd page up its should be like this same position same line its easy to read and compare the pages some aspect think that it's lost the area of the head of page 2 it's useless what should I do from here
To cojimarmiami,
i tried your suggestion formula but it' doesn't work when i preview it show just a page in horizantal by the vertical space separate it for 2 Block (not page) and when i printed its' come out 2 pages in A4 paper What should i do for the next step Thank you
you will have to place your logo, report name and filter on Page Header, then go to that Section Expert and place this formula on Suppress pagenumber <> 1. That is going to suppress that section if your are not on the first page.