TPPDF icon indicating copy to clipboard operation
TPPDF copied to clipboard

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

Open OceanAndWu opened this issue 2 years ago • 4 comments

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

OceanAndWu avatar Jan 13 '23 02:01 OceanAndWu

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?

philprime avatar Jan 30 '23 08:01 philprime

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?

OceanAndWu avatar Jan 30 '23 09:01 OceanAndWu

I have some problem

massimilianochiodi avatar Mar 21 '23 10:03 massimilianochiodi

I have some problem

You can try setting the size of the image in PDFImage

OceanAndWu avatar Mar 22 '23 03:03 OceanAndWu