cesarvr / pdf-generator

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

Cordova pdf generator does not work on iOS #66

Closed chusmary30 closed 6 years ago

chusmary30 commented 6 years ago

Hello Cesar, We are trying to generate a .pdf from html, in Android it works correctly but in iOS it does not work and it does not generate the .pdf. This is the code we are using:

                         let options = {                              documentSize: 'A4',                              type: 'share',                              fileName: 'offer_' + window.localStorage ['id_client_name'] + '.pdf'                          };                          pdf.fromData ('' + $ ('# content_email'). html () + '</ html>', options)                          .then ((stats) => console.log ('status', stats))                          .catch ((err) => console.err (err));

Any idea what it can be?

Thank you!

Chus

cesarvr commented 6 years ago

Please try the version 1.9.7 as I did a silly mistake in 1.9.6 and the iOS project is not compiling.

Remove the old version and install 1.9.7: cordova plugin remove cordova-pdf-generator && cordova plugin add cordova-pdf-generator@1.9.7

Sorry for the inconvenience. Cheers.

chusmary30 commented 6 years ago

Hi Cear, thank you very much for your response. We are already using that version but it does not work on iOS or give us any errors. Is it necessary to have installed the pludova cordova-plugin-wkwebview-engine? We have installed it but then our APP does not respond well and many things stop working.

Thanks again and regards,

cesarvr commented 6 years ago

Umm right now I short on time but can you please try this project is just a demo testing the plugin capabilities, right now it works for me in the iPhone X emulator. Can you try to run it and see if it run ? if it fail can you then tell me the version of XCode and the target iPhone version so I can try to reproduce it.

Cheers.

chusmary30 commented 6 years ago

Hi Cesar, we have already made it work. Finally we have used the code as you indicate in your example:

  pdf.htmlToPDF ({                              data: $ ('# contentemail'). html (),                              documentSize: "A4",                              landscape: "portrait",                              type: "share",                              fileName: 'offer' + window.localStorage ['id_client_name'] + '.pdf'                          }, this.success, this.failure);

Everything OK

Pluging is a great job.

Thanks and regards ,

Chus