After updating cordova-plugin-ionic-webview to 4.1.1 it is impossible to include images in pdf.
All paths is not resolved. I spend about 3 days, trying find right path, but unsuccessfully.
Diving deeper in native source of plugin, i found that base url will be empty string:
PDFGenerator.m:137
At this time output of self.webViewEngine.URL will be ionic://localhost.
Unfortunately i'm not familiar in native code, but diving deeper in code, i found this in BNHtmlPdfKit.m:371 :
As i understand, !self.baseUrl === true, and it pass first if-case, where for baseUrl will be assigned http://localhost. And i think it may crash all process.
Anyway, i'm not sure about my previous assumptions, but putting in PDFGenerator.m:143
baseUrl:[[NSBundle mainBundle] bundleURL] instead of baseUrl:base solve this problem.
After updating
cordova-plugin-ionic-webview
to 4.1.1 it is impossible to include images in pdf. All paths is not resolved. I spend about 3 days, trying find right path, but unsuccessfully. Diving deeper in native source of plugin, i found that base url will be empty string: PDFGenerator.m:137At this time output of self.webViewEngine.URL will be
ionic://localhost
. Unfortunately i'm not familiar in native code, but diving deeper in code, i found this in BNHtmlPdfKit.m:371 :As i understand,
!self.baseUrl === true
, and it pass first if-case, where for baseUrl will be assignedhttp://localhost
. And i think it may crash all process.Anyway, i'm not sure about my previous assumptions, but putting in PDFGenerator.m:143
baseUrl:[[NSBundle mainBundle] bundleURL]
instead ofbaseUrl:base
solve this problem.Hope, it will save some time for somebody.