nRewik / SimplePDF

Create a simple PDF effortlessly. :smile:
MIT License
253 stars 53 forks source link

Adding checkboxes in PDF file #6

Open JorgeAGomez opened 8 years ago

JorgeAGomez commented 8 years ago

Is there a way of adding checkboxes?

Also can I add a string and an image besides the string?

Something like:

Do you want to participate? "Image or checkbox here"

davidseek commented 7 years ago
        let typeDetails = NSMutableAttributedString()

        let attachment = NSTextAttachment()
        attachment.image = Img.checked
        attachment.bounds = CGRect(x: 0, y: 0, width: 10, height: 10)
        let attachmentStr = NSAttributedString(attachment: attachment)

        typeDetails.append(attachmentStr)
        pdf.addAttributedText(typeDetails)

that would be the way it is done. but for whatever reason images are not accepted in attributed string here. trying to find a solution for the exact issue myself