iclems / iOS-htmltopdf

MIT License
305 stars 79 forks source link

Multipage PDFs to have a larger bottom margin each page. #2

Open bigtunacan opened 11 years ago

bigtunacan commented 11 years ago

I generated a PDF that was about 5 pages long and each page had a larger and larger area at the bottom of the page where it is just white area.

iclems commented 11 years ago

Could you provide the HTML source code so that I can reproduce this please ?

bigtunacan commented 11 years ago

Unfortunately we ended up working around this issue in our app by just eliminating some of our multi-page reports in our final released app. If I run up against this again I'll send you a sample.

lopes710 commented 10 years ago

Anyone has a solution for this?

iclems commented 10 years ago

@lopes710 did you experience this issue as well? Do you have a test file?

lopes710 commented 10 years ago

Yes. i dont have a test file sorry.

I solved it by applying the same color in the context background with the page background color I was drawing.

In the printToPDF method:

....

for ( int i = 0 ; i < self.numberOfPages ; i++ )

{

    UIGraphicsBeginPDFPage();

         //added this

        CGContextRef currentContext = UIGraphicsGetCurrentContext();

        CGContextSetFillColorWithColor(currentContext, [UIColor

colorWithHexString:@"494949"].CGColor); // set context background color

        CGContextFillRect(currentContext, bounds);

    [self drawPageAtIndex: i inRect: bounds];

}

....

On Tue, Jan 21, 2014 at 2:52 PM, Clément Wehrung notifications@github.comwrote:

@lopes710 https://github.com/lopes710 did you experience this issue as well? Do you have a test file?

— Reply to this email directly or view it on GitHubhttps://github.com/iclems/iOS-htmltopdf/issues/2#issuecomment-32886274 .

Junwang commented 10 years ago

I have same issue, someone also reported same issue: http://stackoverflow.com/questions/14775292/html-to-pdf-pages-bottom-margin-grows-larger-with-every-page?rq=1

anyone has a solution?