I need to find out if I am using the Insert from URL script correctly. I need to get a PDF off a website, and the web developer sent me a link to download the pdf. The link comes to me like this,
I figured out that I needed to first run the subsititue to get the address looking right, then i do the insert from URL and then I do a Base64Decode/Encode otherwise the PDF is not viewable in the container. ImageLink is the web address that I get sent from the website.
Set Variable [ $url ; Value: Substitute ( LocalInvHead::ImageLink ; ["\/" ; "/"] ; ["[" ; "" ] ; ["]" ; "" ] ; [ "\"" ; "" ] ; [ ".html" ; "" ]) ]
Insert from URL [ Select ; With dialog: Off ; LocalInvHead::ImageContainer ; $url ; Do not automatically encode URL ]
Insert from URL [ Select ; With dialog: Off ; LocalInvHead::ImageContainer ; Substitute ( LocalInvHead::ImageLink ; ["\/" ; "/"] ; ["[" ; "" ] ; ["]" ; "" ] ; [ "\"" ; "" ] ; [ ".html" ; "" ]) ]
Set Field [ LocalInvHead::ImageContainer ; Base64Decode ( Base64Encode ( LocalInvHead::ImageContainer ) ; GetAsText ( LocalInvHead::ImageContainer ) ) ]
The issue i am having is that at random times, the Insert from URL step will fail with 1631 Connection failed and then I run the same script step a few times, and then it pulls through the PDF, but now and again it will add .html to the end of the PDF.
I can't figure out why it is doing this. Sometimes it works perfectly, other times it says connection failed the first time, but goes through the second or third, and then lastly, for some or other reason it adds .html to the end of the line.
What am I missing??