Redirect on task completion

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ChrisRChamberlain
Forum Newbie
Posts: 4
Joined: Thu Dec 19, 2013 12:38 am

Redirect on task completion

Post by ChrisRChamberlain »

Hi all

PHP newbie so please be gentle :D

Apologies for posting a link rather than code, but you will see there is a lot of it.

http://www.fpdf.org/en/script/script36.php

Would like to redirect once the .pdf is displayed in the browser as the purpose of the script is to print the .pdf not necessarily view it.

Have tried the obvious but the redirect kicks in without executing the script.

TIA
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Redirect on task completion

Post by requinix »

To print the PDF the user must be able to see the PDF. There is no way around that.
ChrisRChamberlain
Forum Newbie
Posts: 4
Joined: Thu Dec 19, 2013 12:38 am

Re: Redirect on task completion

Post by ChrisRChamberlain »

requinix

Thanks for your reply - I appreciate the .pdf has to display in order to be printed.

I was hoping that it would be possible for the printer to be called and the .pdf to be displayed momentarily before the redirect kicks in.

Is there no way of stopping the execution of the script at that point?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Redirect on task completion

Post by requinix »

It might be possible but I wouldn't suspect so. When the PDF opens it will show the print dialog; if you are able to redirect in the first place (using embedded Javascript in the PDF) then the user might lose the ability to print (since the document isn't there anymore).
ChrisRChamberlain
Forum Newbie
Posts: 4
Joined: Thu Dec 19, 2013 12:38 am

Re: Redirect on task completion

Post by ChrisRChamberlain »

requinix

Ignoring the javascript that brings up the printer dialog, the script does allow the option of outputting the .pdf to a string.

So if the string were to be printed, would the .pdf have to display in the browser?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Redirect on task completion

Post by requinix »

"Printing" in PHP means outputting to the browser, not printing like to a user's printer. Getting the PDF as a string just means that you don't have to use a file (on the server) to hold the contents, which affords you a bit more flexibility in terms of what you do with it. However that doesn't impact the ability to have it printed for the user.
ChrisRChamberlain
Forum Newbie
Posts: 4
Joined: Thu Dec 19, 2013 12:38 am

Re: Redirect on task completion

Post by ChrisRChamberlain »

requinix

Thanks for the further explanation. :)
Post Reply