techprimate / TPPDF

TPPDF is a simple-to-use PDF builder for iOS and macOS written in Swift

Home Page:https://techprimate.github.io/TPPDF/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

There will be a blank page at the top when generating a PDF with an image

OceanAndWu opened this issue · comments

commented

ℹ 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.

What did you do?

Hello.
When I generate a PDF with an image, a blank page appears at the top of the PDF
Simulator Screen Shot - iPhone 13 - 2023-01-13 at 10 14 21

What did you expect to happen?

remove top blank page

TPPDF Environment

**TPPDF version:2.4.0
**Xcode version:14.2
**Swift version:5.0

Demo Code / Project

func generateDocument() -> [PDFDocument] {
let document = PDFDocument(format: .a4)
let tallImage = PDFImage(image: Image(named: "PortraitImage.jpg")!)
document.add(.none, image: tallImage)
let tallImage2 = PDFImage(image: Image(named: "Image-2.jpg")!)
document.add(.none, image: tallImage2)
return [document]
}

Hi, thanks for opening up this issue. I believe this is related to the image being to tall to fit the current page. Did you try to tweak the fitting settings of the PDFImage?

commented

Hi, thanks for opening up this issue. I believe this is related to the image being to tall to fit the current page. Did you try to tweak the fitting settings of the PDFImage?

Thank you for your reply. Yes. I tried to modify the property settings of PDFImage, but it didn't work。 Do you have any good suggestions?

I have some problem

commented

I have some problem

You can try setting the size of the image in PDFImage