Thanks a lot man. You saved my project. For those who wanna do it in Ionic 4, change the imports to '@ionic-native/file-opener/ngx' and '@ionic-native/file/ngx' and it'll work.
I was having trouble to print in a cordova device, after looking in the ionic forum, I found this: if (this.plt.is('cordova')){ this.pdfObj.getBuffer((buffer) => { var utf8 = new Uint8Array(buffer); var binaryArray = utf8.buffer; var blob = new Blob([binaryArray], { type: 'application/pdf'});
this.file.writeFile(this.file.dataDirectory, 'myletter.pdf', blob, { replace: true}).then(fileEntry => { this.fileOpener.open(this.file.dataDirectory + 'myletter.pdf', 'application/pdf'); }) }); }else { this.pdfObj.download(); } So I could print in my device.
For Ionic v3 be sure that you install versions @4 with npm ( npm install --save @ionic-native/file@4 and npm install --save @ionic-native/file-opener@4) last versions do not work properly
Just in case anyone is wondering, I tried to create it today with Ionic 4 (4.12.0) and had to use: npm install @ionic-native/file@latest npm install @ionic-native/file-opener@latest
Si les llega a pasar esto "FileOpener open file not working Object(…) is not a function error", se soluciona con un downgrade npm install @ionic-native/file-opener@4.20.0 --save
Hey Simon, I'm having trouble with PDFMake, it works fine on the web but when I run it on my Android device the PDF doesn't open... Any ideas of what might be happening?
Ionic v3 needs different commands for installing these packages: npm install --save @ionic-native/file@4 npm install --save @ionic-native/file-opener@4 for the rest look at: ionicacademy.com/create-pdf-files-ionic-pdfmake/ Thanks for your help!
Yes you always need to check if an old /new video is for v3 or v4, there are some differences you have to watch out for. Thanks for leaving these notes!
Hi Simon can you make a tutorial How to just open a .PDF file stored locally(www or assets) in the app (The PDF should open Inside the ionic app not using external apps) thank you in advance.
great tutorial sir, i am having trouble in deploying the same on my device, it is throwing an exception. but, is working well on ionic lab. i am unable to make it work on device. please help!
Failed to install 'cordova-plugin-file-opener2': Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('The platform "android" does not appear to be a valid cordova platform. It is missing API.js. android not supported.') at CordovaEventEmitter.emit (events.js:199:17)
Thx simon...
Thanks a lot man. You saved my project.
For those who wanna do it in Ionic 4, change the imports to '@ionic-native/file-opener/ngx' and '@ionic-native/file/ngx' and it'll work.
Yes simply add ngx if you see an old tutorial! Glad I saved your project :)
I was having trouble to print in a cordova device, after looking in the ionic forum, I found this:
if (this.plt.is('cordova')){
this.pdfObj.getBuffer((buffer) => {
var utf8 = new Uint8Array(buffer);
var binaryArray = utf8.buffer;
var blob = new Blob([binaryArray], { type: 'application/pdf'});
this.file.writeFile(this.file.dataDirectory, 'myletter.pdf', blob, { replace: true}).then(fileEntry => {
this.fileOpener.open(this.file.dataDirectory + 'myletter.pdf', 'application/pdf');
})
});
}else {
this.pdfObj.download();
}
So I could print in my device.
deffinetely you are an ionic master!!!
For Ionic v3 be sure that you install versions @4 with npm ( npm install --save @ionic-native/file@4 and npm install --save @ionic-native/file-opener@4) last versions do not work properly
Just in case anyone is wondering, I tried to create it today with Ionic 4 (4.12.0) and had to use:
npm install @ionic-native/file@latest
npm install @ionic-native/file-opener@latest
Si les llega a pasar esto "FileOpener open file not working Object(…) is not a function error", se soluciona con un downgrade
npm install @ionic-native/file-opener@4.20.0 --save
Hey Simon, I'm having trouble with PDFMake, it works fine on the web but when I run it on my Android device the PDF doesn't open... Any ideas of what might be happening?
Simon Grimm
Please reply to this. I have the same problem.
KM Ramirez I found out that the ionic writeFile API can't write the blob (don't know why), I've replaced it with a binaryArray.
Hello, can you show how you did it? thank you
@@GiselaDifini, can you show how you did that replaced, please? Thanks in advance.
Having the same problem please help @Gisela
Is it the same way to generate PDF if I have multiple items added dynamically one after another
Ionic v3 needs different commands for installing these packages:
npm install --save @ionic-native/file@4
npm install --save @ionic-native/file-opener@4
for the rest look at: ionicacademy.com/create-pdf-files-ionic-pdfmake/
Thanks for your help!
Yes you always need to check if an old /new video is for v3 or v4, there are some differences you have to watch out for. Thanks for leaving these notes!
Hi Simon can you make a tutorial How to just open a .PDF file stored locally(www or assets) in the app (The PDF should open Inside the ionic app not using external apps) thank you in advance.
great tutorial sir, i am having trouble in deploying the same on my device, it is throwing an exception. but, is working well on ionic lab. i am unable to make it work on device. please help!
hi its its not supporting for arabic language
NICE, NICE, NICE, and VERY NICE, i LIKE IT, does a tutorial teaching how to open pdf files on ionic with an API link? please?
awesome one simon sir
anyone know how to display Chinese words?
Thank u Sr Simon
wow... can u please make a video (or give me any link) for pdf compression (to reduce size)
Failed to install 'cordova-plugin-file-opener2': Error [ERR_UNHANDLED_ERROR]: Unhandled error. ('The platform "android" does not appear to be a valid cordova platform. It is missing API.js. android not supported.')
at CordovaEventEmitter.emit (events.js:199:17)
pdf got created in v4 but my application got creashed after opening the file
any suggestions..anyone??
Thanks dude, helped me a lot!
Hi i actually created HTML screen in my iPad and want to convert the entire html screen to pdf. Can anyone help me out please.
Thanksss! :D
_co.createpdf is not a function i have this error
Then you haven't defined the function in your class.
Excellent my friend. How can I insert a barcode in the pdf?
i cant download pdf file in my device
hello, wat did you use for ios emulator ? im using macbook but idk for ios emulator.. haha.. thanksss
there are payments cheques example?
can you make video on ionic cordova plugin cordova-plugin-document-viewer and open pdf from assets folder...
How to upload multiple file in one time server hit in ionic 3
Simon, thanks for the video, do you know where can i find more tools for pdf? i mean add images, links or just make it pretier.
I want to create table in pdf
Would you recommend PDFMake for converting client-side images (phone captures) to create a B&W PDF suitable for faxing? Iconic framework.
Hmm I think in general that could work, you might have to see if the quality in the end is acceptable!
Arabic is not supported ... how to solve this ??
Can you make app for open pdf file which is in folder www/
I'll look into that Rijwan!
Wow! Amazing!! This will be very important to my project!
Beautiful...just outstanding. You just saved my whole work man.
thanks!!!!
how to open the pdf file by fileOpener .
Try to use this plugin: ionicframework.com/docs/native/file-opener/
How can i, put a name to my pdf document?
For the output file? Simply change the name. Otherwise you might have to look into the PDF Make apps on how and where to position text!
Simon Grimm thank you so much
can you tell me how to add images?
Check out the docs for PDFMake here, there are examples for images as well: pdfmake.org/#/gettingstarted
Thai Language is not supported
ได้ ยังครับ 555
github.com/bpampuch/pdfmake/issues/562
ผมแก้ไม่ได้เลย ช่วยแนะนำได้ไหมครับ