Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Dec 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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.

  • #2
    Senior Coder
    Join Date
    Apr 2011
    Location
    London, England
    Posts
    2,120
    Thanks
    15
    Thanked 354 Times in 353 Posts
    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

  • #3
    New to the CF scene
    Join Date
    Dec 2012
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •