11/11/2022 0 Comments Pdfkit swift![]() ![]() Pdfkit swift how to#I discovered I can draw a UIBezierPath on my annotation with the following code, but my image has to be saved as base64 in my database which cannot be converted back to an UIBezierPath, so I still need to determine how to draw an image on an annotation. Image.draw(in: annotation.accessibilityFrame) let image: UIImage = UIImage.shapeImageWithBezierPath(bezierPath: path, fillColor. I have also tried drawing the image onto the annotation like the following, but it doesn't appear on the pdf. Let imageStamp = PDFImageAnnotation(image, bounds: imageBounds, properties: nil)Īnnotation.page?.addAnnotation(imageStamp) ![]() Let imageBounds = CGRect(x: pageBounds.midX, y: pageBounds.midY, width:, height: ) ![]() Using the above question I tried the following without any luck. I also found this similar question Cannot add image and save to pdf file using PDFKit, but it creates a new annotation and places it on top of the page, while I need to place my image in or on top of an annotation on my PDF. Let data = image.jpegData(compressionQuality: 0.5)Īnnotation.widgetStringValue = String(data?.base64EncodedString() ? "")Īntents = String(data?.base64EncodedString() ? "") I have tried setting some fields on the annotation to the image by converting it to a base64 string with no luck. I have a pdf that has an Image Field and in swift I have a UIImage, how do I draw the UIImage on the pdf where the Image Field annotation is? ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |