TPPDF
TPPDF copied to clipboard
when export to pdf i got extra one empty page
ℹ Please fill out this template when filing an issue. All lines beginning with an ℹ symbol instruct you with what info we expect. You can delete those lines once you've filled in the info.
I am saving images into pdf document
let suppose I have 3 images and add them to the document it should show 3 pages. but what's happing is this I am getting 4 pages with the first page empty.
TPPDF Environment
TPPDF version: 2.3.5 Xcode version: 13.0 Swift version: 4 or above
Demo Code / Project
let document = PDFDocument(format: .a4)
document.add(.footerLeft, textObject: PDFSimpleText(text: "Generated from Pdf Scanner"))
for eachImage in images{
let imageElement = PDFImage(image: eachImage)
imageElement.sizeFit = .height
document.add(.contentCenter ,image: imageElement)
// Height should fittppdf
}
let generator = PDFGenerator(document: document)
let pdfUrl = (try? generator.generateURL(filename: "Example.pdf"))!
I noticed that you also posted this on stackoverflow. Did you try the suggestions or try to narrow down which image cause the page overflow?
Hi, thanks for opening up the issue and providing a code example.
Could you please also upload the images, or at least images with the same resolution? I believe this might be a calculation error, therefore this would help to reproduce the image.
(you can also replace the images with single-color ones, but the sizes must match)
Closed due to inactivity