Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
OceanAndWu opened this issue Jan 13, 2023 · 4 comments

Comments

@OceanAndWu
Copy link

ℹ 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]
}

@philprime
Copy link
Member

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?

@OceanAndWu
Copy link
Author

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?

@massimilianochiodi
Copy link

I have some problem

@OceanAndWu
Copy link
Author

I have some problem

You can try setting the size of the image in PDFImage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants