Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9084021
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T20:54:31+00:00 2026-06-16T20:54:31+00:00

I thought I would be able to find a plugin for this but there’s

  • 0

I thought I would be able to find a plugin for this but there’s doesn’t seem to be one.

This is the required process:

The user fills in a form on the site (preferably cforms!)
The data from the form populates the empty cells of a pdf on the sever

Then, well once I get that far then I’ll worry about the next steps!

Generating the pdf is not an option as it’s a legal document.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T20:54:32+00:00Added an answer on June 16, 2026 at 8:54 pm

    Ok, I’ve worked out how to do this, it seems to be a bit messy, shame there is not a simpler way!

    The two plug-ins I’m using are cforms (www.deliciousdays.com/cforms-plugin) and a plug-in which loads the Zend framework (h6e.net/wordpress/plugins/zend-framework) this is needed for it’s pdf writing abilities.

    With both plug-ins activated locate the file in the cforms plug-in directory called my-functions.php and download to your computer. Most of this file is commented out so you need to uncomment the function

    function my_cforms_action($cformsdata) {
    
    }
    

    Anything in this function will run when the submit button is pressed (see the cforms API documentation for more details). You can test this is working but echoing something in the this function. You can also test the Zend framework has been loaded using

    if (defined('WP_ZEND_FRAMEWORK') && constant('WP_ZEND_FRAMEWORK')) {
          echo 'Zend is working!';
      }
    

    The form fields come in an array so we need to print that out first to work out the names of the fields (replacing “5” with whichever form you are using):

    $formID = $cformsdata['id'];
    $form   = $cformsdata['data'];
    
    if ( $formID == '5' ) {
        print_r($form);
    }
    

    Once you have your field names this is the full code to write to the pdf

    //Get the ID of the current form and all the data that's been submitted
    $formID = $cformsdata['id'];
    $form   = $cformsdata['data'];
    
    //run this code only if it's the form with this ID
    if ( $formID == '5' ) {
    
            //Loads the Zend pdf code
        require_once 'Zend/Pdf.php';
    
        //Set the path of the pdf (in the root of my wordpress installation)
        $fileName = 'c100-eng2.pdf';
    
        //loads the pdf 
        $pdf = Zend_Pdf::load($fileName);
    
            //Selects the page to write to
        $page = $pdf->pages[0];
           //Selects which font to use
        $font = Zend_Pdf_Font::fontWithName(Zend_Pdf_Font::FONT_HELVETICA);
        $page->setFont($font, 12);
    
    
        //Writes the text from the field 'Your name' 210 points from the left and 420 points from the bottom of the selected page
        $page->drawText($form['cf_form5_Your name'], 210, 420);
    
    
        //for some reason there is no way to wrap text using Zend_pdf so we have to do it ourselves for any paragraphs...
        //starting 600 points from the bottom of the page
        $startPos = 600;
        //we're using the form field "About you"
        $paragraph = $form['cf_form5_About you'];
        //sets the width of the paragraph to 30 characters 
        $paragraph = wordwrap( $paragraph, 30, '\n');
        //breaks paragraph into lines
            $paragraphArray = explode('\n', $paragraph);
        //writes out the lines starting 200 points from the left with a line height of 12 points
            foreach ($paragraphArray as $line) {
                $line = ltrim($line);
                $page->drawText($line, 200, $startPos);
                $startPos = $startPos - 12;
            }
    
     //saves the pdf
    $pdf->save('new.pdf');
    

    I had problems to start with as the pdf I was using wasn’t the right type, you can check that your code is correct by creating a pdf using Zend pdf as that should always work (find out how to do that here: framework.zend.com/manual/1.12/en/zend.pdf.html).

    I use Photoshop to work out the exact locations I want to write at by setting the ruler to ‘points’

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I thought this would be a common problem, but I haven't been able to
I thought this would be a common question, but I didn't find it anywhere...
I thought it would be easy, but I'm not being able to find how
Is there a destructor for Java? I don't seem to be able to find
I thought I heard that in .net 4 we would be able to reference
This is what I thought would be a simple select clause, however the following
I haven't been able to find a good answer to this issue. I'm trying
This maybe a noob question, however, I haven't been able to find a suitable
This problem is so simple and common but I still haven't been able to
I was wondering how we would be able to find the current location of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.