Closed phcs971 closed 4 years ago
The full Pdf has to fit in memory to be processed.
The full Pdf has to fit in memory to be processed.
I see. Is there any way for me to save each page after the page is written? Like concatenating the bytes into the file?
No, it would require a major rewrite of the library to write it directly to the disk instead of memory.
I see so not even isolates would solve this problem. OP have you found a workaround for this? maybe splitting the work?
If your images are too big, you can resize them first, and convert them to jpeg if not already using that.
If your images are too big, you can resize them first, and convert them to jpeg if not already using that.
do you mean images inside the pdf? maybe that would work for OP, I am dealing with converting pdf into png files.
when I convert them to jpg instead of png every color is red-pinkish and the file size is increased by 500% and the speed is about the same as png.
and my pdf only contains texts and a few lines, and a logo, I doubt it uses that much memory, maybe it's the package algorithm itself, as you said it needs to load everything into memory first. I doubt I can fix that without splitting the work somehow, after 20 pages in a pdf the app will crash with oom error, worse when it also needs to convert into a PNG file.
Hopefully, there is a solution to this in the future. I'm hopeful and thanks for the package.
pdf.save() is taking too long when build on web compared to mobile. Is there any way to resolve this?
@michelle010721 It's just Javascript, so yes it takes time. Until the Dart team implement a webassembly compilation we can't do much.
Is there a way to prevent timeout, I’m encountering problem like “page not responding” when I run pdf.save() on web.
Run the PDF creation in a dart isolate.
I ran through the isolate_test.dart but i don’t quite understand how it work. Any advice?
Run the PDF creation in a dart isolate.
Try using dart isolate for pdf creation. but got throw an error. Error: Unsupported operation: dart:isolate is not supported on dart4web
Run the PDF creation in a dart isolate.
Try using dart isolate for pdf creation. but got throw an error. Error: Unsupported operation: dart:isolate is not supported on dart4web
Hello, @michhhh99 and @DavBfr.
I would like to know if any of you have managed a solution to this issue that does not give the last problem mentioned for web mode.
Hi guys did anyone found any workaround this as isolates does not work in web and compute is supposed to work for non async. web page freezes for few seconds if there is any image in pdf. If anyone found any solution to this please mention
Use jpeg images, there is no processing and are embedded as is.
Describe the bug The app is crashes without any error when I have a big pdf and I'm saving it. The app needs to create a pdf for a photographic report, so it will have lots of photos.
To Reproduce Code snippet to reproduce the behavior:
Expected behavior The pdf saves to a file so the user can share it later
Flutter Doctor
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context If there is a way to save the pdf by page it would help a lot