PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → [WB18]Sending http link to PDF Document
[WB18]Sending http link to PDF Document
Débuté par Ericus, 17 sep. 2014 09:17 - 6 réponses
Posté le 17 septembre 2014 - 09:17
Good morning

Instead of sending out PDF documents from my accounting system, I would like to send a link to the document so that the recipient can click on that link and open a page containing that document.

At the same time I would like to add other functionality to that page i.e the recipient can leave a comment etc. etc.

Is that possible and have somebody maybe done something like that.

Thanks in advance for any assistance.



Ericus Steyn
Posté le 17 septembre 2014 - 11:15
If you send one link to your app with parameters just use PageParameter in the int code of the project and proceed according with the value of the parameter.

Just check PageParameter in the help
http://doc.windev.com/en-US/…

If you want you can use some technics to shorten the url, check Pete Halsted site to see one example
<a class="ExternalLink" rel="nofollow" target="_blank" href="http://www.thenextage.com/wordpress/uncle-petes-corner-writing-a-url-shortener-with-webdev/#more-2060">http://www.thenextage.com/wordpress/uncle-petes-corner-writing-a-url-shortener-with-webdev/&hellip;</a>
Posté le 17 septembre 2014 - 11:42
Thanks Paulo

However when the PDF is printed the name of the file should be something like InuSHSDFgffdhdsdfh632gfsdg which I then include in a link.

But how do I get that PDF name? If I say iDestination(PDF) it creates the PDF with the same name as the report. I don't want to use the document number because users can then change the http to open any other document if they wanted to.

What would you typically do with the PDF file. Save it in a DB where you can flag whether the user have opened it so that once in a while you can delete all these old files?

Regards


Ericus steyn
Posté le 17 septembre 2014 - 12:37
The name of the PDF files isn't important for the link.

You can generate any value you want for the parameter as long as you can know in your app the meaning of that value.

When you read the parameter you can redirect the user to one page with one link/button to download the PDF and the possibility to add comments as needed.
you can even generate the PDF only when the user uses the link you sent, you don't need to generate the PDF in advance.
Posté le 17 septembre 2014 - 12:44
Ericus,

The correct technique is as follows;

1) Send the user a URL, with one or more parameters, and which loads a script (not the PDF file)

2) The server-side script uses the parameters to know what PDF file is required and, optionally, who the caller of the script is, the user.

3) Read the PDF file in and stream it out to the user

In this way, no temp files are created, no temp files need to be cleaned up, no special web-accesible folder is required, no information about your server is revealed (e.g. PDF file locations), and the user cannot access any other PDF file without a valid URL.
Posté le 17 septembre 2014 - 21:08
Hi Ericus,

you can specify the pdf-name as second parameter:

iDestination(iGenericPDF, FileName)
Posté le 17 septembre 2014 - 21:51
Thanks for the help guys.

This is going to work well and hopefully a good new feature to have.

Every time I struggle with something I am surprised at how easy it is if you just ask, and get to knowWebdev.



Ericus Steyn