Open wnbittle opened 6 years ago
Quick update with clarification:
Relative paths to CSS + HTML string do not work. Relative paths to CSS + HTML string along with setting the baseUrl to the bundleURL do not work Full paths to CSS + HTML string along with setting the baseUrl to the bundleURL do work.
@wnbittle
Can I ask you to help me there too?
https://github.com/cesarvr/pdf-generator/issues/80
Many thanks.
Hi everyone, seems this issue always here, I can't link images or css with ios. On android I have an other weird issue, it saving me a PDF with an asset per page
I'm having an issue when sending the plugin an HTML string with link elements in iOS.
On Android, I was not able to get relative paths to work either, however, I was able to rewrite the relative paths to full paths using cordova.file.applicationDirectory/www/[relative path] to make them work.
On iOS, this doesn't work. I've tried relative paths, absolute paths, and many other variations without success. Finally, I decided to debug the linked BNHtmlPdfKit.m source, I noticed that the self.baseUrl property is nil, and as a result, it uses http://localhost for the baseUrl of the webview see here. If I set self.baseUrl to [[NSBundle mainBundle] bundleURL], the relative paths work. I'm guessing that the method you added was this which could be edited to set the self.baseUrl via a configuration property from javascript.
Would you be able to expose a baseUrl property in the configuration object to set this property? I can submit a pull request, but this seemed like a pretty quick/easy change.
Thanks, William