You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The size of the column is not calculated properly and the background is covering the content.
I tried to check by setting a color with alpha and it seems like the background is drawn twice or it's sliced and the second time it's rendered it's on top.
The other issue that might be related to this is when a padding is added if a background is set then there seems to be an extra space at the bottom. this does not happen if the background is not set.
here is an example code to reproduce the issue
import Foundation
import TPPDF
import CoreGraphics
import UIKit
classColumnHeightExample:ExampleFactory{func generateDocument()->[PDFDocument]{letdocument=PDFDocument(format:.a4)
document.appendSectionedText(
leading:"some text goes here as a leading text",
trailing:"some text goes here as a trailing text")return[document]}}extensionPDFDocument{staticvardefaultPadding:CGFloat{5}vardefaultPadding:CGFloat{TPPDF.PDFDocument.defaultPadding }varleadingSectionRatio:CGFloat{ 0.4 }vartrailingSectionRatio:CGFloat{1- leadingSectionRatio }func addDefaultSpacing(multipliedBy multiplier:CGFloat=1, into container:PDFContainer=.contentLeft){add(container, space: defaultPadding * multiplier)}func addDefaultFullWidthSeparator(){letseparatorColor=UIColor.lightGray.withAlphaComponent(0.5)letstyle=PDFLineStyle(
type:.full,
color: separatorColor,
width: 0.1
)addLineSeparator(style: style)}func appendSectionedText(leading title:String, trailing detail:String){letattributedTitle=NSAttributedString(
string: title,
attributes:[.font :UIFont.systemFont(ofSize: 12.0, weight:.bold)])letattributedDetail=NSAttributedString(
string: detail,
attributes:[.font :UIFont.systemFont(ofSize: 12.0)])letmainSection=PDFSection(
columnWidths:[leadingSectionRatio, trailingSectionRatio])letleadingColumn= mainSection.columns.first
lettailingColumn= mainSection.columns.last
leadingColumn?.appendPaddedAttributedText(attributedTitle)
tailingColumn?.appendPaddedAttributedText(attributedDetail)
leadingColumn?.backgroundColor =UIColor(red: 0.91, green: 0.91, blue: 0.91, alpha: 1.00)
tailingColumn?.backgroundColor =UIColor(red: 0.97, green: 0.97, blue: 0.97, alpha: 1.00)add(section: mainSection)}}extensionTPPDF.PDFSectionColumn{staticvardefaultPadding:CGFloat{TPPDF.PDFDocument.defaultPadding }vardefaultPadding:CGFloat{TPPDF.PDFSectionColumn.defaultPadding }func appendDefaultSpacing(multipliedBy multiplier:CGFloat=1, into container:PDFSectionColumnContainer=.left){add(container, space: defaultPadding * multiplier)}func appendPaddedAttributedText(_ attributedText:NSAttributedString?, into container:PDFSectionColumnContainer=PDFSectionColumnContainer.left){
guard let attributedText = attributedText else{return}appendDefaultSpacing(multipliedBy:1)set(indent: defaultPadding, left: true)set(indent: defaultPadding, left: false)add(container, attributedText: attributedText)appendDefaultSpacing(multipliedBy:1)}}
The code above would generate this:
TPPDF version used is 2.3.1
Xcode Version 12.0.1
Apple Swift version 5.3
The text was updated successfully, but these errors were encountered:
The size of the column is not calculated properly and the background is covering the content.
I tried to check by setting a color with alpha and it seems like the background is drawn twice or it's sliced and the second time it's rendered it's on top.
The other issue that might be related to this is when a padding is added if a background is set then there seems to be an extra space at the bottom. this does not happen if the background is not set.
here is an example code to reproduce the issue
The code above would generate this:
TPPDF version used is 2.3.1
Xcode Version 12.0.1
Apple Swift version 5.3
The text was updated successfully, but these errors were encountered: