et footerAttributes: [NSAttributedString.Key: Any] = [
.font: UIFont.systemFont(ofSize: 20),
// .foregroundColor: UIColor.red.withAlphaComponent(
// 0.5),
]
let footerString = NSAttributedString(
string: watermarkText, attributes: footerAttributes)
let footerTextWidth = footerString.size().width
let footerTextHeight = footerString.size().height
let footerX = (pageBounds.width - footerTextWidth) / 2
let footerY = 10 + footerTextHeight // Adjust 10 as bottom margin
let footerAnnotation = PDFAnnotation(
bounds: CGRect(
x: footerX, y: footerY, width: footerTextWidth,
height: footerTextHeight),
forType: .freeText,
withProperties: nil
)
footerAnnotation.contents = watermarkText.dropLast(2) + "**"
footerAnnotation.font = UIFont.systemFont(ofSize: 20)
footerAnnotation.color = .clear
footerAnnotation.fontColor = UIColor.darkGray
.withAlphaComponent(0.5)
page.addAnnotation(footerAnnotation)
i am not able to control the opacity of font why?