Forum How do I...?

Accessing a page after form launch

iguy_one
Hello,

What element "launches" the pdf conversion ?

I need to transfer a pdf a page requiring number of parameters sent by a form.

So, I have a page "mypage" with some <input hidden> elements, and a javascript function launching the form on the onload event, to "mypageresults".

But if I ask to Prince to convert "mypage", I finally want to convert "mypageresults", and not "mypage". I cannot ask to convert "mypageresults", because this page needs the elements.

On server-side, if I have a response.redirect in ASP, from "mypage" to "mypageredirect", Prince converts fine "mypageredirect".

Is there a way to ask to Prince to convert the html render AFTER the page submitting ?

Regards,

Iguy
mikeday
Prince cannot POST forms, so if Prince is running on the client you will need to post the form yourself, retrieve the generated HTML, and run Prince on that.

However, if Prince is running on the server, and the client is submitting the form with a field indicating it wishes to return a PDF back, then the server can generate the HTML it would normally return, pass that to Prince, get back the PDF, and return that to the client.
iguy_one
Yes, the purpose is to run Prince on the server, but with the wrapper I can just enter an url...

But this url must be reached with form information... Actually, I have a page receiving this, and the Internet Printing is launched... But you know all bullshit problems about that.

If I understand you well, its possible to wait that the client launches the form, and get back the HTML on the client page, and pass that to Prince ? How is it possible ? I have to store the html content in a VB string ? If its your idea, it will be a very long work, so I prefer change the POST on GET arguments to retrieve my info...

My idea was not to ask Prince to send form, but a way to avoid that Prince converts the page before the POST redirection, just as the same way than Prince does not convert a page before the ASP redirection.

Thanks for reply :)
mikeday
Two options: make the page you want to convert to PDF accessible using a GET request and point Prince at the URL of the page, or capture the HTML in a buffer inside your ASP code, and pass that directly to Prince. If the printing is triggered by a POST, the second option will be easiest.
iguy_one
Everything is triggered by post requests, but I prefer to add a request functions, retrieving POST or GET in function of the argument.

But I don't understand why Prince waits with an ASP redirection, but does not wait with an html redirection. I suppose Prince waits to found any element (html renders I guess), and I was searching how to "cheat", for example if you hide the <html> tag, your browser will correctly send the form, but the render not recognized as a page...

Thanks for your support, anyway.