How to Create PDF Files with Ionic using PDFMake

Поделиться
HTML-код
  • Опубликовано: 2 окт 2024

Комментарии • 63

  • @masudirachman2324
    @masudirachman2324 3 года назад +2

    Thx simon...

  •  5 лет назад +10

    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.

    • @galaxies_dev
      @galaxies_dev  5 лет назад

      Yes simply add ngx if you see an old tutorial! Glad I saved your project :)

  • @andlukas
    @andlukas 5 лет назад +2

    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.

  • @aaronaaronaaron5922
    @aaronaaronaaron5922 6 лет назад

    deffinetely you are an ionic master!!!

  • @emmanuelnakache7808
    @emmanuelnakache7808 5 лет назад +3

    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

    • @josipspoljar7051
      @josipspoljar7051 5 лет назад

      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

  • @rexzaurusvids3204
    @rexzaurusvids3204 5 лет назад +1

    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

  • @GiselaDifini
    @GiselaDifini 6 лет назад +3

    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?

    • @kmramirez3
      @kmramirez3 6 лет назад

      Simon Grimm
      Please reply to this. I have the same problem.

    • @GiselaDifini
      @GiselaDifini 6 лет назад +1

      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.

    • @horacioortiz85
      @horacioortiz85 6 лет назад

      Hello, can you show how you did it? thank you

    • @luisernestopaezortiz4879
      @luisernestopaezortiz4879 5 лет назад

      @@GiselaDifini, can you show how you did that replaced, please? Thanks in advance.

    • @abdoulsalamally6652
      @abdoulsalamally6652 5 лет назад +1

      Having the same problem please help @Gisela

  • @bobp8921
    @bobp8921 4 года назад +1

    Is it the same way to generate PDF if I have multiple items added dynamically one after another

  • @itjoe1971
    @itjoe1971 5 лет назад +1

    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!

    • @galaxies_dev
      @galaxies_dev  5 лет назад

      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!

  • @swaroopkannah9931
    @swaroopkannah9931 6 лет назад

    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.

  • @samridhimonga4955
    @samridhimonga4955 6 лет назад +1

    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!

  • @mdsadiq5527
    @mdsadiq5527 Год назад

    hi its its not supporting for arabic language

  • @the.maciota
    @the.maciota 6 лет назад

    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?

  • @mriganksingh7586
    @mriganksingh7586 6 лет назад

    awesome one simon sir

  • @atvantic0660
    @atvantic0660 3 года назад

    anyone know how to display Chinese words?

  • @crihstianmol
    @crihstianmol 4 года назад +1

    Thank u Sr Simon

  • @jun4idm0min
    @jun4idm0min 6 лет назад

    wow... can u please make a video (or give me any link) for pdf compression (to reduce size)

  • @deliamacias7603
    @deliamacias7603 4 года назад

    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)

  • @bhaskarmitra134
    @bhaskarmitra134 4 года назад

    pdf got created in v4 but my application got creashed after opening the file
    any suggestions..anyone??

  • @DanielLima97dlcs
    @DanielLima97dlcs 5 лет назад +1

    Thanks dude, helped me a lot!

  • @teluguCultMusic
    @teluguCultMusic 6 лет назад

    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.

  • @LuisAzcuaga
    @LuisAzcuaga 4 года назад +1

    Thanksss! :D

  • @hillsongzango321
    @hillsongzango321 4 года назад

    _co.createpdf is not a function i have this error

    • @galaxies_dev
      @galaxies_dev  4 года назад

      Then you haven't defined the function in your class.

  • @angeldavidvillanuevacajas6524
    @angeldavidvillanuevacajas6524 5 лет назад

    Excellent my friend. How can I insert a barcode in the pdf?

  • @harshadagosavi1649
    @harshadagosavi1649 4 года назад

    i cant download pdf file in my device

  • @wahyupratama1058
    @wahyupratama1058 6 лет назад

    hello, wat did you use for ios emulator ? im using macbook but idk for ios emulator.. haha.. thanksss

  • @davitkarapetyan5105
    @davitkarapetyan5105 4 года назад

    there are payments cheques example?

  • @mansurhaider9163
    @mansurhaider9163 6 лет назад

    can you make video on ionic cordova plugin cordova-plugin-document-viewer and open pdf from assets folder...

  • @somudutta2469
    @somudutta2469 6 лет назад

    How to upload multiple file in one time server hit in ionic 3

  • @barbarazavaleta5264
    @barbarazavaleta5264 6 лет назад

    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.

  • @amruthalnor8693
    @amruthalnor8693 5 лет назад

    I want to create table in pdf

  • @lionfarmer5822
    @lionfarmer5822 4 года назад

    Would you recommend PDFMake for converting client-side images (phone captures) to create a B&W PDF suitable for faxing? Iconic framework.

    • @galaxies_dev
      @galaxies_dev  4 года назад

      Hmm I think in general that could work, you might have to see if the quality in the end is acceptable!

  • @waelluay6902
    @waelluay6902 6 лет назад

    Arabic is not supported ... how to solve this ??

  • @techdicer
    @techdicer 6 лет назад +1

    Can you make app for open pdf file which is in folder www/

  • @MultiAllan05
    @MultiAllan05 5 лет назад

    Wow! Amazing!! This will be very important to my project!

  • @arkadeeppaul
    @arkadeeppaul 5 лет назад

    Beautiful...just outstanding. You just saved my whole work man.

  • @lehyjoseph2007
    @lehyjoseph2007 6 лет назад

    thanks!!!!

  • @techdicer
    @techdicer 6 лет назад

    how to open the pdf file by fileOpener .

    • @galaxies_dev
      @galaxies_dev  6 лет назад

      Try to use this plugin: ionicframework.com/docs/native/file-opener/

  • @Zharich97
    @Zharich97 5 лет назад

    How can i, put a name to my pdf document?

    • @galaxies_dev
      @galaxies_dev  5 лет назад +1

      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!

    • @Zharich97
      @Zharich97 5 лет назад

      Simon Grimm thank you so much

  • @saikiran8201
    @saikiran8201 6 лет назад

    can you tell me how to add images?

    • @galaxies_dev
      @galaxies_dev  6 лет назад

      Check out the docs for PDFMake here, there are examples for images as well: pdfmake.org/#/gettingstarted

  • @newme1067
    @newme1067 6 лет назад +1

    Thai Language is not supported

    • @028122602
      @028122602 6 лет назад

      ได้ ยังครับ 555

    • @028122602
      @028122602 6 лет назад

      github.com/bpampuch/pdfmake/issues/562

    • @tonsakunchp8081
      @tonsakunchp8081 4 года назад

      ผมแก้ไม่ได้เลย ช่วยแนะนำได้ไหมครับ