PDF Generate In Android Studio | Kotlin | Android Tutorials

Sdílet
Vložit
  • čas přidán 1. 05. 2021
  • Hello Friends in this video we will learn how to generate pdf in the android studio
    library:
    implementation 'com.itextpdf:itextg:5.5.10'

Komentáře • 34

  • @armandosanchtz
    @armandosanchtz Před 3 lety

    Here, how i can do for send it an image instead of a text? what would change?

  • @armandosanchtz
    @armandosanchtz Před 3 lety

    Like and suscribed :D

  • @prasanthmanimaran5158
    @prasanthmanimaran5158 Před 2 lety

    Thanks for this tutorial. Is there any way to add image to PDF as well? I would really appreciate it.

  • @PhongTran-hz4ht
    @PhongTran-hz4ht Před 2 lety +1

    how to save content html to pdf? pls

  • @sat_talk
    @sat_talk Před 2 lety

    thanks.. how to generate pdf file for say invoice A4 size page

  • @armandosanchtz
    @armandosanchtz Před 3 lety +1

    Bro can you do a tutorial video of generate pdf but with images, that we able scanner image and pass it to a pdf

  • @GouravDubeyCSE--
    @GouravDubeyCSE-- Před 2 lety +1

    Getting error getExternalStorageDirectory() is deprecated and app crashing

    • @anurajms
      @anurajms Před 2 lety

      you can modify the above code with this val cw = ContextWrapper(applicationContext)
      val FileDirectory = cw.getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS)
      val mFilePath = File(FireDirectory, "your pdf file name".pdf"

  • @anurajms
    @anurajms Před 2 lety

    thank you for the video but its throwing an error "FileNotFoundException open failed: XXXXXXX EPERM (Operation not permitted)"

  • @joaquinuliambre315
    @joaquinuliambre315 Před 2 lety +1

    What do I have to change so that when I press the button it opens the pdf after saving to the device?

    • @kbcoder8788
      @kbcoder8788  Před 2 lety

      Create the function of view PDF

    • @joaquinuliambre315
      @joaquinuliambre315 Před 2 lety

      @@kbcoder8788 that is done with intent?

    • @joaquinuliambre315
      @joaquinuliambre315 Před 2 lety +1

      @@kbcoder8788 The pdf is saved on /storage/emulated/ how do i access that?

    • @joaquinuliambre315
      @joaquinuliambre315 Před 2 lety

      ​@@kbcoder8788 Im trying with this, but when I want to open in the default reader it tells me that it cannot open
      val abrirPdf = Intent(Intent.ACTION_VIEW)
      abrirPdf.setDataAndType(FileProvider.getUriForFile(this@MainActivity,"com.topoffice.pdfcreator2.fileprovider",
      File("storage/emulated/0/$mFileName.pdf")
      ),"application/pdf")
      abrirPdf.flags = Intent.FLAG_GRANT_READ_URI_PERMISSION
      abrirPdf.flags = Intent.FLAG_ACTIVITY_CLEAR_TOP
      abrirPdf.flags = Intent.FLAG_ACTIVITY_NEW_TASK
      startActivity(abrirPdf)

    • @RovenaGSR
      @RovenaGSR Před 2 lety

      @@joaquinuliambre315 I would like to that as well, if you found a solution i'd appreciate it if you could share it

  • @asaelrddz
    @asaelrddz Před 2 lety +2

    It never worked, try with the help of a comment here, it generates the pdf for me but it cannot be found, dislike

  • @diegohermann1590
    @diegohermann1590 Před 2 lety +1

    no funciona!!

  • @sandhyav7171
    @sandhyav7171 Před rokem

    I'm not able to generate pdf

  • @luisr.2615
    @luisr.2615 Před 2 lety +3

    I was getting the 'open failed: EACCES (Permission denied)' error every time. I could solve it changing the filepath to: val filePath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).toString() + "/" + fileName + ".pdf"
    I hope this helps someone!