简体   繁体   中英

How to set bottom space in pdf when create a PDF file from an HTML string in swift?

Following the example as below URL.

https://gist.github.com/nyg/b8cd742250826cb1471f

It is a great example for me if can set bottom space more perfect.

After a lot of test and search with any possible, I find this theme ( Is there any way to generate PDF file from a XML/HTML template in iOs ) and revise some codes as below:

//let page = CGRect(x: 0, y: 0, width: 595.2, height: 841.8); // A4, 72 dpi    
let page = CGRect(x: 0, y: 0, width: 575.2, height: 821.8); // A4, 72 dpi
..
..
..
//UIGraphicsBeginPDFContextToData(pdfData, CGRectZero, nil);
UIGraphicsBeginPDFContextToData(pdfData, CGRect(x: 0, y: 0, width: 595.2, height: 841.8) , nil);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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