Scheduling PDF Creation

I have been able to get html2pdf.js - npm to create a PDF using onClick events.
The problem is that at HH:MM everyday I need to get this PDF email and/or saved to a third party.
I’d like this to happen automagically with no user interaction. I also use XANO, which does have a scheduler/crontab.

Questions:
1a) What is the recommended way to get PDF created automatically at a scheduled time?
1b) Should be using html2pdf?
2a) Should I just do this in Xano and/or some other API service?
2b) Which API service do you think I should look at for this?

You are going to need to use a chron utility like Xano. If you are currently using Xano for your backend, then that makes sense to use it for this task also. WeWeb cannot schedule jobs like you are looking for.

1b. The documentation says that you can’t use html2pdf in a non-browser environment. If you want to create the pdf in Xano you need another library or an external service.

Thanks, I did not see this.

1 Like

@peteletkemansst How did you manage to get html2pdf to work by the way? I would really need this for my app but not sure where to start. Thanks in advance!

2 Likes

Hello @aeynaud,

You need to include the JS Library and publish the page.

I have this

var makepdf = document.getElementById("makepdf");
html2pdf().from(makepdf).save();

Where I have a div/control with an ID of makepdf.
As stated, this requires the client to press a button or do some action and cannot be scripted.

There are other tool/libraries which can be used.
I’ve found this to be a good one

Using makePDF is a possible workaround for my use case for client side PDF generation.

Is it already possible to use the NPM extension for this? Is there working example? And should the app also be published to test out implementations using the NPM extension?

1 Like

Hello! Could you please tell me what instance name you used for html2pds lib?

3 Likes