Pdfmake: return promise while creating PDF (feature request)

Created on 17 Dec 2014  Â·  8Comments  Â·  Source: bpampuch/pdfmake

Hi,

I really like what you have build.
For larger PDF's I would like to show a spinner so that people know the browser is crunching numbers until it is ready.
Any way you could return a promise so that I can kill the spinner when the promise is resolved?

Maybe even fancier, can you give an update on the creation progress so we can show a progress bar?

Cheers

Most helpful comment

Hi,
I have created 56 pages pdf file which takes 40Sec to download but i can not determine the progress( completed percentages ). and also i can not access my webpage until download is completed. The download callback triggers only at the end of completion. meanwhile i want to show downloaded percentages at the bottom of page like other pdf files and also want to access my web page when downloading is in process. Is it possible?

All 8 comments

Funny, I was proposing to fork and add a CB to the download. Today I want to push that to the branch and I see it has already been implemented LOL.
It is just not available in the Bower version yet.

@mattiLeBlanc can you tell me where you see that there is a promise available? I currently try to debug the library for .downloadand .openwithout any success. Thanks!

Well, it is not a promise. I was incorrect in my comment. As I can see in the Download function

Document.prototype.download = function(defaultFileName, cb) 

it only supports a callback.
So I created my own promise and I resolve for example in the download CB.
Would still be nice if we could get some kind of feedback on percentage complete of PDF creation.

@mattiLeBlanc thanks for your reply. Does .downloadworks for you on iOS? I don't see any error message, it simply does nothing.

I have not tried it on iOS, so I can't answer that question.
PDFMake utilises the features of the browser if I am not mistaken, so could it be that it doesnt work on Safari?
Have you tried Safari on a macbook? I only used pdfmake in Chrome.

I'm running a web app and need to support system wide all browsers.. such a pain in the ass :) Only on iOS it doesn't work at all, no matter which browser. On all other its working quite well.

Maybe fall back on a server created pdf. You can run pdfmake also on node
(npm require) and return the results via base64 and save it on your browser.

I have example code for this if you need help
On 22 Oct 2015 7:23 pm, "Dominic Garms" [email protected] wrote:

I'm running a web app and need to support system wide all browsers.. such
a pain in the ass :) I works just not on iOS at all, doesnt matter which
browser. On all other its working quite well.

—
Reply to this email directly or view it on GitHub
https://github.com/bpampuch/pdfmake/issues/157#issuecomment-150143506.

Hi,
I have created 56 pages pdf file which takes 40Sec to download but i can not determine the progress( completed percentages ). and also i can not access my webpage until download is completed. The download callback triggers only at the end of completion. meanwhile i want to show downloaded percentages at the bottom of page like other pdf files and also want to access my web page when downloading is in process. Is it possible?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Masber picture Masber  Â·  3Comments

MathLavallee picture MathLavallee  Â·  3Comments

Christian24 picture Christian24  Â·  3Comments

ValeSauer picture ValeSauer  Â·  3Comments

kumarandena picture kumarandena  Â·  3Comments