Turn a URL into a base64 encoded jpg, png, bmp or pdf.
grab an API key from convertio.io for free (25 conversion minutes per day)
send a url using the “convert url to image process”
wait a few seconds then push the id to the “get image” action for the image to return as “content”
You can use the get data from external api to “check status” for either status ok or “step_percent” upto 100.
** also when you set the filename you must include the extention ie. snapshot.jpg & when choosing output format leave the full stop out - jpg
I will add the direct file convert function in the coming days too. could be handy if you want all user profile pics to be in the same format among other things.
File = the url you want to convert - by the looks that will be your internal invoice page.
Filename = the name of the file your creating (must include the extension as you have done)
Output format = must be png, jpg, bmp or pdf (without the full stop as you have done)
now run the workflow, that is a request to convert the url. after a few seconds you can then allow either a create data action to save the id that is returned or set the state of something with the id with the intention of having it put into the field of ID for the get image action.
the image will show you what I mean although you cant do it like that as the file would not have generated before it try’s to get it.
one thing I will mention though is if you give that same id to the “get data from external api - convertio status” you can check to see if “step” is “finish” or “step_percent” is “100”
ok, firstly it takes a couple of seconds for the document to be ready so your most likely getting the error because your “get image” is asking for the document to soon after sending the “convert url to image”
also what you get back from the server is base64. so in your case when you navigate to an external page to say download the invoice make the destination url look exactly like this -->>
for pdf: data:application/pdf;base64,YOUR-RETURNED-CONTENT
for images: data:image/png;base64,YOUR-RETURNED-CONTENT
you may find it better to have the "content of the action get image create a database entry then call it up with a button to that there is more of a delay.
Thanks for this, Jarrad! One question–I assume the URL has to be public for Convertio to reach it, which presents a problem if running an app on https and/or including data privacy rules to prevent anonymous users from, for example, accessing the invoice pages for your user’s company. Is there a way around this? Or is it is simple as the fact that you’ve granted access to Convertio via an API key enough to ensure their server can hit the page?
I see what your getting at, I just tested something then. all you would need to do is hide the major group that the whole invoice sits in and set when getdatafrompageurl’s code is <your_code> its visable. meaning its a blank page when ever someone would try to land on it. you also have the option of programming a kind of on switch as you start the workflow starts to create the convert request and off swith when its finished getting the pdf. the other thing you could do it create a new temp-invoice on the way through making that page have that invoice avail. then deleting it after the get converted pdf runs. personally I would just make a stupid long parameter ie.
@jarrad great plug-in works flawlessly. In addition to converting a URL to the three graphic formats or a PDF… Are the other formats (available on Convertio website) accessible through the API? I tried with no luck.
thanks! i think for the other ones your looking at direct upload from file if you want to stick with the api… not a bad service though, over 12,000 conversion types…