katzer / cordova-plugin-printer

Print HTML documents
Apache License 2.0
313 stars 291 forks source link

Plugin is not working completely / not printing anything just keeping `Loading Preview` #266

Open anujraghuvanshi opened 4 years ago

anujraghuvanshi commented 4 years ago

Version information- PLugin Version: 0.8.0 iOS: iOS14 Xcode: v12

Device info (Checked in devices)

Bug- Printer keeps loading and not proceed completely for printing.

IMG_7E026C2EBB22-1

anujraghuvanshi commented 4 years ago

After some further debugging it came that it's working for PDF & Images only. While printing other file types, Here's error I am getting - failed to find PDF header: '%PDF' not found

@katzer - Is any short workaround to fix this for all file types? Earlier in previous version of plugin it was working for printing all types of files, such as Docs/CSV/Excel files etc..

kirtipriya commented 4 years ago

Hello Anuj , I have not faced #266 . But to fix my crash in https://github.com/katzer/cordova-plugin-printer/issues/264 , i used html2pdf to convert the html to pdf in base 64 format , and then i passed this base 64 output to the printer plugin. Can you try this too?

anujraghuvanshi commented 4 years ago

Thanks @kirtipriya . But My case is something different. I want to print all types of files which were able to be printed in plugin's version 0.7.3 including - docs,sheet etc. which seems not supported in latest version of plugin.

Sateeshkumarroyal commented 4 years ago

@Anuj-Raghuvanshi , I am also facing this issue but i fixed, when i was using Version information- PLugin Version: 0.7.3 iOS: iOS14 Xcode: v12 I faced app-crash when i was click on Cancel.?

Solution: I upated PLugin Version: 0.8.0 app crash is fixed.

After that i faced continuously loading-preview issue?

Solution:

cordova.plugins.printer.print('data:application/pdf;base64,' + data);

Replace like this it will work fine cordova.plugins.printer.print('base64://' + data);