Any good new way to do this without just using the windows print command. I’d like to save a table or form as pdf with a specified name, then email it to a client. Currently, I have to do this manually and would love to automate the process using wappler. any update on whether this functionality will be possible in Wappler soon?
I would imagine there would be some Adobe licensing hurdles to overcome to be able to add that to Wappler? It’s not Open Source so it may not be able to be done.
thanks, very intrigued with APi2Pdf as it does seem to be a cost effective answer to what I want. Can’t get it work at the moment so asking their support people for help. I do think there is something here worth looking at. Just can’t understand their documentation.
great. I’m just trying to get started and installing it. I copied the files to my server and then tried a very simple case to test it out using their documentation but I don’t see anything happening. The support people weren’t much help. Perhaps you can steer me in the right direction. I’m just trying to get a url to be saved and displayed as a pdf. Here is the code I’m trying to use:
In a nutshell, I open a modal on the front end that triggers a server action that performs the api call to create the pdf. The modal shows a “your report is being prepared” message during creation, and then displays a link the pdf once finished.
Make sure you use the Define API Schema option when building your server action, so the results of the api are exposed to the front end.
Front end Modal:
The server connect is triggered to load when the modal opens (User clicks “Download report” button and the modal opens to start the process.) The link element is hidden while the server connect is executing, and dynamically sets the link value based on the results of the server connect:
I use a border spinner to let the user know something is happening during the server connect execution:
thank you so much. I’m trying to follow this to test. I created the server action as you stated. For my JSON data, I put
{
“url”: “https://www.marsalstudios.com/admin/edit-proposal-sheet.php”,
“inlinePdf”: true,
“fileName”: “testing.pdf”,
“options”: “”
}
would that create a pdf file named testing.pdf located in my root folder from the url shown at the top?
For the modal I was confused by the link data. you had the link value as create_rpt.data.pdf.data.pdf
Is that the correct syntax, seems weird. It didn’t work so wondering if that’s the issue.
I’m so happy that you are willing to work with me here. I really need this to work. It will be so useful.
thanks again,
Rick
I didn’t go with inlinepdf. I just have the api produce a link, and I present that to the user. The pdf never comes to my server. I’m neck deep trying to start a couple mobile apps, so I’m sorry I can mock up the inline scenario for you!
And yes, that is the correct syntax – just seems odd given the names I used match the api names.
A few weeks ago you tried to help me but you were in the middle of some mobile projects and couldn’t help. Just checking to see if your workload is better and you could provide some guidance. I put api2pdf on hold as I couldn’t get the api to work in serverconnect. If you have a chance, I’d still like to conquer this. Basically, I would like to have a server connect which allows me to send a url and have it saved as pdf and emailed to someone. Ideally, I’d like to store it as well on my server but I could also have it download to my computer. Any help would be greatly appreciated.
Hi @marsalstudios, You’ll need to use PHP to download the PDF from the api url. Something like this will download the file from the URL, save to your directory and return a success message. You can always change the directory if needed.
<?php
// Initialise a file URL
$url = 'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf';
// Use basename() function to return the name of file
$file_name = basename($url);
// Use file_get_contents() function to get the file from URL and
// use file_put_contents() function to save the file by using the name
if(file_put_contents( $file_name,file_get_contents($url))) {
echo "File downloaded successfully";
}
else {
echo "File downloading failed.";
}
?>
I should also add that the download will override any existing file. So if your file is called invoice.pdf and there is already a file called the same in your directory it will override that one.