Welcome Guest, Not a member yet? Register   Sign In
Generate a PDF from a Form - How to do it???
#1

[eluser]Alex91[/eluser]
Hi guys,

I'm new to CodeIgniter, and have a question.
I'm building a site for a client.
Now he asked me to make a form with different textfields and memofields.

But what is the best way to do it?

I searched this for for a anwser, but only found how to create static PDF files by using DOMPDF.

For example the for have this fields:
- Name
- E-mail
- Message (It can have multiple lines)

Thanks for your help.
#2

[eluser]hardik[/eluser]
you can use tcpdf or dompdf

this is the post which will help you i guess

http://ellislab.com/forums/viewthread/45118/
#3

[eluser]Alex91[/eluser]
I tried different things to get DOMPDF working.
But it's not working here for me...

The most important thing is to get DOMPDF working.
I put the question in the other topic, so this one got's to wait.
#4

[eluser]rogierb[/eluser]
Have you checked out http://codeigniter.com/wiki/PDF_generati...ng_dompdf/?
When implemented correctly, this works like a dream.
#5

[eluser]eric cumbee[/eluser]
i had to build a web app that fills out a government form(voter registration). i took a image of the form, used GD to add the text and then sent them to tcpdf, overall it works pretty good.
#6

[eluser]Alex91[/eluser]
When i'll try that, i'll get this error:
Code:
A PHP Error was encountered
Severity: Notice

Message: Undefined variable: data

Filename: controllers/test.php

Line Number: 16


Fatal error: Class 'DOMPDF' not found in C:\xampp\htdocs\alex91\system\plugins\to_pdf_pi.php on line 6

Controller:
Code:
<?php

class Test extends Controller {

        function Test()
        {
                parent::Controller();

                $this->load->helper('file');
        }

        function pdf()
        {
                $this->load->plugin('to_pdf');
                // page info here, db calls, etc.
                $html = $this->load->view('home', $data, true);
                pdf_create($html, 'filename');
        }
}

/* End of file home.php */
/* Location: ./system/application/controllers/home.php */

View
Code:
<div class="content">
  <p>Content info</p>
  </div>

What do I wrong?
#7

[eluser]eric cumbee[/eluser]
i do not see where you have declared what is in the data var?
#8

[eluser]Alex91[/eluser]
Yeah, that's is also what i saw.
Only, where to put the $dat what's going in to the PDF?

Thanks so far.
#9

[eluser]Alex91[/eluser]
Somebody that can help me?
#10

[eluser]Andy Ingham[/eluser]
Hi Alex,

Did you manage to fix your problem? I've installed dompdf recently, so might be able to help.

You should have the 'to_pdf_pi.php' file in your plugins folder. You should then have a 'dompdf' folder in your plugins folder which contains 'dompdf.php' and 'dompdf_config.inc' (and possibly some other files).

If you look in your 'plugins\to_pdf_pi.php' file at line 6, it should have a line something like the following:

Code:
require_once("dompdf/dompdf_config.inc.php");

Does this sound to be consistent with how you've got things set up?




Theme © iAndrew 2016 - Forum software by © MyBB