Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-15-2012, 04:36 PM   PM User | #1
EricN8886
New to the CF scene

 
Join Date: Dec 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
EricN8886 is an unknown quantity at this point
Question Create a Wizard That generates a Custom PDF

I have a really specific question, that I had originally posted in the JS foru, but I now understand this can't be done in JS. I need to create a wizard where a user would answer a series of multiple choice questions, and based on the selections they choose, certain PDFs would be pulled into one custom PDF (based on their answers).

So, for example, if the user answers choice b on question 2 of the wizard, the wizard would pull PDF pages 1, 5, 7, and 8. When they submit their answers, it would pull all of the PDFs that are "tied" to the answers and spit out a custom PDF for them to download and/or print. The wizard will have stitched together this custom PDF in the background.

The PDF pages will already exist. I will create about 20-30 of them, and would like to "tie" each page to a certain answer.

I really hope this can be done with php. I also don't know anything beyond really basic HTML and some javascript.
EricN8886 is offline   Reply With Quote
Old 12-15-2012, 05:51 PM   PM User | #2
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
This code looks good:
PHP Code:
$fileArray= array("name1.pdf","name2.pdf","name3.pdf","name4.pdf");

$datadir "save_path/";
$outputName $datadir."merged.pdf";

$cmd "gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=$outputName ";
//Add each pdf file to the end of the command
foreach($fileArray as $file) {
    
$cmd .= $file." ";
}
$result shell_exec($cmd); 
but I cannot advise you beyond this. Someone else may have experience of doing this.

But if you have no experience with PHP then you will probably need to hire someone.
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS
AndrewGSW is offline   Reply With Quote
Old 12-18-2012, 03:16 AM   PM User | #3
EricN8886
New to the CF scene

 
Join Date: Dec 2012
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
EricN8886 is an unknown quantity at this point
Thanks, AndrewGSW! I think I do understand this code - I am just having difficulty connecting it with the first part, which is to have the array actually be something that is defined by the user based on the answers to their questions. In the code you posted, I see that the array is static and defined - how can I have the array refer to their answers?
EricN8886 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:07 AM.


Advertisement
Log in to turn off these ads.