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.
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!!
@@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!!
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 .
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.
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
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.
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 :(
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
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
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
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
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.
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
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! .
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
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?
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;
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.
Thanks for the tip. I needed to do this to fix mine
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!!
You are a savior bro. I was struggling on this for hours now, simply using const {Filesystem} = Plugins fixed it. Thanks a lot.
@@iAbhinavSinghal Glad it helped
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!
Glad I could help!
Hi there - how do you create PDF content with dynamic data? For example, data held in an array of objects drawn from remote database
- 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
Awesome content as usual Simon.
waiting for the OCR app bro
for Android v10+ you need to set android:requestLegacyExternalStorage="true" on AndroidManifest.xml on the tab
Thanks for sharing!
@@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!!
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 .
I want to add elements on the table dynamically using a loop.
What should I do, sir..
I have same question- did u find a solution ? Thx
Excellent, i will be waiting fot the ebook, Simon the best master of Ionic
angular capacitor android jspdf indirilmiyor
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.
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
Hey I am facing the same issue, did you find any solution for the same?
Thank you... doing the same today helped alot
Good content, however it fails to generate image whenever i have the image field and alignment field
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.
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 :(
Hmm you can select the directory external storage but I think this only refers to the Android device storage, not a computer!
you are a great inspiration for me, thanks for great upload :)
Happy to hear that!
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
Great useful tutorial.
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
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
How can i create pdf using images of camera and gallery? I need put one image per page
Hey Simon, thanks for the awesome tutorial. Can you please tell me the name of the theme used in your visual studio code.
It's One Dark Pro!
@@galaxies_dev Thanks :)
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
Today this doesn't work's for me, all we try ends with gradle build failed.... :(
I guess google can read my mind as well.... I was literally just wondering how to do this today xD
Totally . I was trying to make a PDF with multiple image upload . And Look what i found Thank you so much Simon Grimm :)
Hey Simon,
What can you about StatusBat color in capacitor?
I tried anything but cannot change statusbar color.
What you can suggest to me?
Did you check out the docs here? -> capacitorjs.com/docs/apis/status-bar
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.
I think you need to inject images as base64, the local file URL won't work.
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
ERROR Error: Uncaught (in promise): Unrecognized document structure: {"colummns":[{"width":"50%","text":"From","style":"subheader"},{"width":"50%","text":"To","style":"subheader"}]}
HELP PLISS
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! .
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
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?
Did you install the package correctly?
Thanks Simon,, But I have the problem in Arabic language,, how can I fixed it.
🔥🔥🔥
how to donwload pdf file in Platform IOS?
From a server? Like you would download any file, just make a GET request and store the resulting blob data on the device!
It'ts return "FILE_NOTCREATED". Someone get same problem?
thanks
You're welcome!
If I want to share the pdf?
You could use the web share API or another plugin!
You do not have any ionic react solution. Kindly point me to a resource.
No, don't have any React content.
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;