Open Sun3 opened 10 years ago
I'm trying to do this as well. Did you ever figure it out?
I need to do this also. Any update?
I haven't heard anything on this, sorry.
In my case, I needed some icons in my PDF, so I ended up rendering them with SVG instead of using an image. Seems to work well.
I found a nice solution. I temporarily stash the UIImage in the app's Documents folder and store the path. Then I just add an tag with that path.
Works like a champ.
I also have the issue that I need to provide an image into the PDF (f.e. icon.png) but I don' t know how to reference it in the html tag. Could someone provide an example how to best do that ?
I fixed the issue by setting the baseURL correctly to the documents folder like this:
NSString path = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents"]; NSURL baseURL = [NSURL fileURLWithPath:path]; self.htmlPdfKit.baseUrl = baseURL;
now I can reference with in my html and it will pick it up from the Documents/images/icon.png file.
I have html code which also includes an images, would the saveHtmlAsPdf handle the image and is there anything special that I would need to do to pass the image info?
Thanks for this lib.