Looking for help with PHP, MySQL and particularly PDFtk function to fill pdf forms. Willing to dicuss code coaching or code generation help.
For those of you who find this of interest, I have found some PHP code that I believe with a little adjustment, can serve my purpose. But due to my limited knowledge and coding comfort level, I know I need the guidance and help. If this sounds like something that fits you, I’d appreciate the help
Perhaps you should provide details on the compensation you are offering and how many hours you are looking for.
Well, I just do it in HTML and save the HTML version in a variable. Then, use a library called DOMpdf.
This is all the code you need to use to covert the HTML page into a PDF. Simple and can be saved as
a .PDF file or just outputted to the page for a download. Works extremely well for me. The library is
free from Github here: DOM-PDF
Here is a sample of the code including how to save the file or send it to the browser…
Hope this helps…
-<?PHP
// reference the Dompdf namespace
use Dompdf\Dompdf;
use Dompdf\Options;
require_once ‘lib/dompdf/autoload.inc.php’;
// instantiate and use the dompdf class
$dompdf = new Dompdf();
$dompdf->loadHtml($form1html); // $form1html is the HTML version of a printable form
// (Optional) Setup the paper size and orientation
$dompdf->setPaper(‘A4’, ‘portrait’);
// Render the HTML as PDF
$dompdf->render();
// Output the generated PDF to Browser
//$dompdf->stream();
// Save to file
$pdf_gen = $dompdf->output();
file_put_contents(“form1.pdf”, $pdf_gen);
echo $dompdf->output();
?>
ErnieAlex, that code generates a pdf output… In my case I’d like to take mysql data and fill in an existing pdf form, not just take data and create a pdf form for printing or download… but thanks anyway for your effort.
As for Benanamen, I did say I was looking for a coach, someone to help me fine tune what I already have… my intention was to have someone take a look at what i have and then tell me what would be the best way to move forward. With that said, I’ve received a message from someone else who has shown interest to do just that so thanks anyway for the initial interest.
Benanamen, I did say I was looking for a coach, someone to help me fine tune what I already have… my intention was to have someone take a look at what i have and then tell me what would be the best way to move forward. With that said, I’ve received a message from someone else who has shown interest to do just that so thanks anyway for the initial interest.
Correct me if I am wrong…
You posted in the Freelancing forum which is the “Looking to hire someone” forum but you had no intention of paying anyone?
Never said I had NO intention of paying…but I’m not looking to get had either. If I can do a lump of the work and have someone guide me to complete the rest, I’m willing to compensate that persons for thier efforts. But I’m not going to just let someone tell me 20k for 2 months of work when all its gonna take is a few days. Sorry, but I been on this ride before.
Aside from the paying of services, you mentioned filling in PDF forms, but, you did not explain how you access the forms. I gave you a way to create outputs in just a few lines of code. If you want to add in data into a PDF, that is handled in a similar manner. You have to capture the form and then fill in your answers and post the form back to the server.
Posting forms back to servers is very easy, you just need to know the form’s layout and have the correct access to the server to be able to send it back to them. I did not understand your original questions. Thought it was a problem with PDF’s, not posting to other websites!
To fill someone else’s web-forms, you can load them into a variable and fill in the data and then submit the page to their site. But, this is really, kind of , a hacker code… What are you really attempting to do?
Maybe if you are clear on what you really need, we can help you out!