cesarvr / pdf-generator

Cordova plugin to generate pdf in the client-side
MIT License
107 stars 61 forks source link

IOS - [Unknown process name] Failed to load CorePDF #101

Closed MEELB777 closed 5 years ago

MEELB777 commented 5 years ago

Hi, thanks for the plugin!!!

Testing the plugin cordova-pdf-generator (v 2.0.8) on:

IOS 10 and 12.2

I got this error:

[Unknown process name] Failed to load /System/Library/PrivateFrameworks/CorePDF.framework/Versions/A/CorePDF

Xcode debugger error line on BNHtmlPdfKit.m, savePdf method, line 481 ():

  for (NSInteger i = 0; i < pages; i++) {
        UIGraphicsBeginPDFPage();
        [renderer drawPageAtIndex:i inRect:renderer.paperRect]; //Error line
    }

My .ts file code:

generatePDF() {
    document.addEventListener('deviceready', function() {
      if(device.platform.toUpperCase() === 'ANDROID'){//Android
               ...
      }else{//IOS
        cordova.plugins.pdf.htmlToPDF({
          data: '<img src="' + this.image + '"><br/><strong>' + this.title + '</strong><br/><br/>' + this.text,
          documentSize: "A4",
          landscape: "portrait",
          type: "share",
          fileName: this.title + '.pdf'
        },(sucess) => ons.notification.toast('PDF Generated!!!.', { timeout: 2000 }),
          (error) => ons.notification.toast('Error. ' + error, { timeout: 2000 }));
      }
    }.bind(this), false);
  }

Someone asked for this same error on iOS:

https://stackanswers.net/questions/ios-pdfkit-will-not-write

I used the plugin before on IOS and didn't got this error. Works fine on Android.

Thanks

MEELB777 commented 5 years ago

This hang occurred because exception breakpoints were enabled in Xcode and an exception occurred. The exception was apparently occurring within the implementation of [UIPrintPageRenderer drawPageAtIndex: inRect:]. You can ignore this exception and the code will continue as expected.

(https://stackoverflow.com/questions/27257600/drawpageatindex-hangs-in-ios-8-1-1)