Create PDF Files with Ionic and Capacitor using PDFMake

แชร์
ฝัง
  • เผยแพร่เมื่อ 10 พ.ย. 2024

ความคิดเห็น • 63

  • @Fohlken
    @Fohlken 4 ปีที่แล้ว +9

    if some of you using Capacitor are having problems writing the pdfs, try importing Filesystem from inside capacitor Plugins:
    import { FilesystemDirectory, Plugins } from '@capacitor/core;
    const { Filesystem } = Plugins;
    Also, not sure if it is necessary, but I also included this line in the android manifest in the area:
    android:requestLegacyExternalStorage="true"
    The rest is the same. It worked for me.

    • @iSamadhi
      @iSamadhi 4 ปีที่แล้ว +1

      Thanks for the tip. I needed to do this to fix mine

    • @theKiWigamer3
      @theKiWigamer3 4 ปีที่แล้ว +1

      Thank you so much sir, i was searching for a solution on this for an hour... Deleting the import of Filesystem and replacing it through 'const{Filesystem} = Plugins ' worked!!

    • @iAbhinavSinghal
      @iAbhinavSinghal 3 ปีที่แล้ว

      You are a savior bro. I was struggling on this for hours now, simply using const {Filesystem} = Plugins fixed it. Thanks a lot.

    • @Fohlken
      @Fohlken 2 ปีที่แล้ว +1

      @@iAbhinavSinghal Glad it helped

  • @NelsonPeixotoLopes
    @NelsonPeixotoLopes 4 ปีที่แล้ว +1

    I really liked the video, simple and direct, I was looking for a solution on Google, they were all old, this one is updated. Congratulations!

  • @ciaranmooney1912
    @ciaranmooney1912 10 หลายเดือนก่อน

    Hi there - how do you create PDF content with dynamic data? For example, data held in an array of objects drawn from remote database

  • @marlynelismarpimentel7863
    @marlynelismarpimentel7863 4 ปีที่แล้ว +2

    - Me: *thinking that "maybe you could if you're kinda nerd" was a good quote*
    - Simon: "since I fixed it I don't have it anymore..."
    - Me: Exactly

  • @TheSaceone
    @TheSaceone 4 ปีที่แล้ว +1

    Awesome content as usual Simon.

  • @mdomerarafat4611
    @mdomerarafat4611 4 ปีที่แล้ว +4

    waiting for the OCR app bro

  • @snakone
    @snakone 3 ปีที่แล้ว +1

    for Android v10+ you need to set android:requestLegacyExternalStorage="true" on AndroidManifest.xml on the tab

    • @galaxies_dev
      @galaxies_dev  3 ปีที่แล้ว +1

      Thanks for sharing!

    • @snakone
      @snakone 3 ปีที่แล้ว

      @@galaxies_dev thanks to you, works very well, i managed to use it along with html2pdfmaker to convert markdown to pdf also with page break and styles!!

  • @deborahjamesmathew
    @deborahjamesmathew 4 ปีที่แล้ว +1

    Though i have an issue . The image i upload( using imagePicker) is not a base64 image. I have the file URL in below form
    file:///data/user/0/io.ionic.example/files/my_media/1595442801328.jpg
    i am getting error Msg: Not allowed to load local resource
    Also converted above with webview.convertFileSrc
    localhost/_capacitor_file_/data/user/0/io.ionic.example/files/my_media/1595442801328.jpg
    with both these file path still i am unable to create base64 of the image .Not sure where I am going wrong . Any help would be much appreciated . TIA .

  • @sounakdas2441
    @sounakdas2441 4 ปีที่แล้ว +2

    I want to add elements on the table dynamically using a loop.
    What should I do, sir..

    • @ciaranmooney1912
      @ciaranmooney1912 10 หลายเดือนก่อน

      I have same question- did u find a solution ? Thx

  • @alexjuniortupapa
    @alexjuniortupapa 4 ปีที่แล้ว

    Excellent, i will be waiting fot the ebook, Simon the best master of Ionic

  • @furkanorhan7194
    @furkanorhan7194 2 ปีที่แล้ว +1

    angular capacitor android jspdf indirilmiyor

  • @dannyshf1993
    @dannyshf1993 4 ปีที่แล้ว

    thanks! I am working on a project using ionic framework to build an invoice system, but i am stuck on drafting a pdf file with custom inputs. It would be much appreciated if you can make a tutorial on making a pdf template.

  • @Zahirul3
    @Zahirul3 4 ปีที่แล้ว +1

    Hi,
    Thanks for nice video. I faced a problem to open pdf file with fileopener. When I give file `uri` it says {message: 'file not found' ,status: 9}, Any tips how to put actual file path in file opener or documentViewer? I am using capaciter

    • @iAbhinavSinghal
      @iAbhinavSinghal 3 ปีที่แล้ว

      Hey I am facing the same issue, did you find any solution for the same?

  • @rvuyyuru
    @rvuyyuru 4 ปีที่แล้ว +2

    Thank you... doing the same today helped alot

  • @brendonbruh4036
    @brendonbruh4036 4 หลายเดือนก่อน

    Good content, however it fails to generate image whenever i have the image field and alignment field

  • @haniqudsi
    @haniqudsi 3 ปีที่แล้ว +1

    Hi Simon, I have another problem in android and I solved it, I hope this comment give benefit wo who use android..
    The problem is when write the doc give error : FILE_NOTCREATED.
    The solution is adding ( android:requestLegacyExternalStorage="true" ) in the application tag in the AndroidManifest.xml
    * this issue occur in android 10 and above.

  • @davidechierici7413
    @davidechierici7413 3 ปีที่แล้ว

    Hi Simon, thanks for all the tutorial. Is it possible to save a file to external storage and browse it with android phone connected to pc? I can only save file in private data folder :(

    • @galaxies_dev
      @galaxies_dev  3 ปีที่แล้ว

      Hmm you can select the directory external storage but I think this only refers to the Android device storage, not a computer!

  • @idgaf3959
    @idgaf3959 4 ปีที่แล้ว +1

    you are a great inspiration for me, thanks for great upload :)

  • @Alesvetina
    @Alesvetina 3 ปีที่แล้ว

    Hey Simon. Do you maybe have any experience with Android 11? Because the Documents folder is not accessible on Android 11 or newer. i tried the requestLegacyExternalStorage="true" fix and compileSdkVersion = 29 but no luck

  • @HabibAlMawali
    @HabibAlMawali 4 ปีที่แล้ว +1

    Great useful tutorial.

  • @MaxDiegardo
    @MaxDiegardo 3 ปีที่แล้ว

    Hey simon! Nice tutorial! However, I did have a problem with that last part that saves the PDF and opens it with fileopener. I googled ard for some other approach and could only save it in the apps directory - but that approach can't open the created file because I couldn't get the path, which I think needs to also use similar approach to yours to get the results.uri. hmmm can u help me 😭 console says that getbase64 isn't a function

  • @pascalz9992
    @pascalz9992 3 ปีที่แล้ว

    Thanks for the video, it helped me understand pdfMake better. Not sure I will want to use this exactly the way you did it as you rely a lot on old cordova plugins. That's why you had the problem with android V4. I will try and upgrade your solution with things like @capacitor/filesystem

  • @herickraposo1342
    @herickraposo1342 3 ปีที่แล้ว

    How can i create pdf using images of camera and gallery? I need put one image per page

  • @sumansen3202
    @sumansen3202 4 ปีที่แล้ว

    Hey Simon, thanks for the awesome tutorial. Can you please tell me the name of the theme used in your visual studio code.

    • @galaxies_dev
      @galaxies_dev  4 ปีที่แล้ว +1

      It's One Dark Pro!

    • @sumansen3202
      @sumansen3202 4 ปีที่แล้ว

      @@galaxies_dev Thanks :)

  • @abdullahrehan8632
    @abdullahrehan8632 3 ปีที่แล้ว

    Hy sir , i am facing problem on download pdf file on android the download is working on web but when i installed the app on deveice nothing happens when i pressed the download button

  • @sbrsbr6953
    @sbrsbr6953 ปีที่แล้ว

    Today this doesn't work's for me, all we try ends with gradle build failed.... :(

  • @OmgThatsIncredible
    @OmgThatsIncredible 4 ปีที่แล้ว +3

    I guess google can read my mind as well.... I was literally just wondering how to do this today xD

    • @deborahjamesmathew
      @deborahjamesmathew 4 ปีที่แล้ว

      Totally . I was trying to make a PDF with multiple image upload . And Look what i found Thank you so much Simon Grimm :)

  • @asadullazadeh
    @asadullazadeh 4 ปีที่แล้ว

    Hey Simon,
    What can you about StatusBat color in capacitor?
    I tried anything but cannot change statusbar color.
    What you can suggest to me?

    • @galaxies_dev
      @galaxies_dev  4 ปีที่แล้ว

      Did you check out the docs here? -> capacitorjs.com/docs/apis/status-bar

  • @Zookenatorenator
    @Zookenatorenator 4 ปีที่แล้ว

    Hi Simon. Thanks for the great video! I've run into a slight issue. When I create a PDF without a picture or logo it works perfectly, but as soon an I try to upload an image I get errors, preventing me to load a local resource or "Unrecognized document structure" any help would be greatly appreciated. Thanks.

    • @galaxies_dev
      @galaxies_dev  4 ปีที่แล้ว

      I think you need to inject images as base64, the local file URL won't work.

  • @armandoguachan5197
    @armandoguachan5197 2 ปีที่แล้ว

    Hola como estas una consulta como puedes comprimir las imágenes en el pdf para que no se genere con mucho espacio por ejemplo yo tengo generando un pdf con 20 imágenes y pesa 90mb como puede comprimir las imágenes o el pdf por favor

  • @thealemaniaco7677
    @thealemaniaco7677 3 ปีที่แล้ว +1

    ERROR Error: Uncaught (in promise): Unrecognized document structure: {"colummns":[{"width":"50%","text":"From","style":"subheader"},{"width":"50%","text":"To","style":"subheader"}]}
    HELP PLISS

  • @saidganduradarme6941
    @saidganduradarme6941 4 ปีที่แล้ว

    Hi Simon firstly mate thank you so much i watch all your videos since time before and basically are amazing, so thnks. In this particular tutorial im gettin a problem when i install the app in android, everything is working fine except! when im trying to save the pdf into my local storage i got a problem of capacitor like : {"message":"Parent folder doesn't exist"}} you know how can i fix it ? however thnks a lot !! and please dont stop making this videos those are amazing! .

    • @saidganduradarme6941
      @saidganduradarme6941 4 ปีที่แล้ว +2

      i Just got the answer ill leave it here if someone need it. ! In android 10 you must be able to access to storage, so basically you have to add this line: android:requestLegacyExternalStorage="true"
      to your manifest in androidstudio, in the area.
      haha thnks simon

  • @edgarconrado8333
    @edgarconrado8333 3 ปีที่แล้ว

    Hi, I’m getting the error when running ionic serve using the import "import { FileOpener } from '@ionic-native/file-opener/ngx' when I delete the import I do not receive the error. I am doing something wrong?

    • @galaxies_dev
      @galaxies_dev  3 ปีที่แล้ว

      Did you install the package correctly?

  • @haniqudsi
    @haniqudsi 3 ปีที่แล้ว

    Thanks Simon,, But I have the problem in Arabic language,, how can I fixed it.

  • @rt.1
    @rt.1 4 ปีที่แล้ว +2

    🔥🔥🔥

  • @RodrigoMuVa
    @RodrigoMuVa 2 ปีที่แล้ว

    how to donwload pdf file in Platform IOS?

    • @galaxies_dev
      @galaxies_dev  2 ปีที่แล้ว

      From a server? Like you would download any file, just make a GET request and store the resulting blob data on the device!

  • @eliabekun
    @eliabekun 4 ปีที่แล้ว

    It'ts return "FILE_NOTCREATED". Someone get same problem?

  • @mediprixtutos7064
    @mediprixtutos7064 ปีที่แล้ว

    thanks

  • @paulettejacomehidalgo3366
    @paulettejacomehidalgo3366 3 ปีที่แล้ว

    If I want to share the pdf?

    • @galaxies_dev
      @galaxies_dev  3 ปีที่แล้ว

      You could use the web share API or another plugin!

  • @ekenemechima6572
    @ekenemechima6572 4 ปีที่แล้ว

    You do not have any ionic react solution. Kindly point me to a resource.

    • @galaxies_dev
      @galaxies_dev  4 ปีที่แล้ว

      No, don't have any React content.

  • @dvignesh5
    @dvignesh5 3 ปีที่แล้ว

    TypeError: pdfmake_build_pdfmake__WEBPACK_IMPORTED_MODULE_5__.createPDF is not a function
    Did same as what you tutorial insisted. Thrown this error..
    Installed latest verion: npm install pdfmake
    Imported like below mentioned:
    import pdfMake from "pdfmake/build/pdfmake";
    import pdfFonts from "pdfmake/build/vfs_fonts";
    pdfMake.vfs = pdfFonts.pdfMake.vfs;