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

Add PDFImage with PDFAttributedText .left, .center, .right

AlexLojewski opened this issue · comments

What did you do?

document.add(.contentLeft, image: PDFImage(
    image: CameraImageManager.loadImageFromDiskWith(
        fileName: damageReport.imageName
    )!,
    caption: PDFAttributedText(text: NSAttributedString(
        string: damageReport.descriptionText, 
        attributes: nil
    )), 
    size: CGSize(width: 200, height: 165), 
    quality: 0.85, 
    options: .none, 
    cornerRadius: .none
))

What did you expect to happen?

The image is on the left and the specified text is either on the left under the image or centered under the image

What happened instead?

The image is on the left and the text is centered on the page.

Bildschirmfoto 2023-12-15 um 12 20 47

TPPDF Environment

TPPDF version: 2.4.1
Xcode version: Version 15.1 (15C65)
Swift version: 5.9

Hi, thanks for opening up the issue.
The text being in the center of the document is indeed unexpected.

Could you please create a minimal full PDFDocument with an example image that produces the error? It's way easier for me to debug if I can run it on my machine.

You can use the Examples.xcworkspace together with the ExperimentFactory.swift to set it up