Solved

HTML to PDF conversion on the fly

Posted on 2004-08-02
8
327 Views
Last Modified: 2010-04-17
Hi All

We re developping a web app with php4x under Linux/Apache. We need to generate pdf documents on the fly from current html screrens without too much coding. The free libs are taking too much time to develop. I would appreciate if you can share your experiences. I m not expecting coding courses but some indication of solutions that might help us to go to the right direction. Both proprietary and open source libs are wellcome.

Many thanks
regs
Tuncay
0
Comment
Question by:tgunduz
8 Comments
 
LVL 3

Expert Comment

by:pYrania
ID: 11693570
With the pdflib wrapper that's builtin in php it's fairly easy to create your pdf files.

http://www.php.net/manual/en/ref.pdf.php

<?php
$pdf = pdf_new();
pdf_open_file($pdf, "test.pdf");
pdf_set_info($pdf, "Author", "Markus Nigbur");
pdf_set_info($pdf, "Title", "Test for PHP wrapper of PDFlib 2.0");
pdf_set_info($pdf, "Creator", "See Author");
pdf_set_info($pdf, "Subject", "Testing");
pdf_begin_page($pdf, 595, 842);
pdf_add_outline($pdf, "Page 1");
$font = pdf_findfont($pdf, "Times New Roman", "winansi", 1);
pdf_setfont($pdf, $font, 10);
pdf_set_value($pdf, "textrendering", 1);
pdf_show_xy($pdf, "############# YOUR TEXT HERE #########", 50, 750);
pdf_moveto($pdf, 50, 740);
pdf_lineto($pdf, 330, 740);
pdf_stroke($pdf);
pdf_end_page($pdf);
pdf_close($pdf);
pdf_delete($pdf);
?>
0
 

Author Comment

by:tgunduz
ID: 11693986
Hi,

Sorry If I could not express myself correctly.

I am afraid it is not suitable to our needs. As far as my knowledge goes, this option requires continious coding  to build the entire document. What I'm looking for is to "wrap" an existing html page and generate a pdf document on the fly.

Thank you
Regs
Tuncay  
0
 
LVL 2

Expert Comment

by:Caiapfas
ID: 11697093
How about a browse feautre that lets users select a .doc file and translate it in pdf.

how could you do this?
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
LVL 18

Accepted Solution

by:
JR2003 earned 25 total points
ID: 11697268
Just install a freeware PDF printer driver. Either cutePDF or PDFCreator. These are both PDF printer drivers, but they only work from Windows OS not Linux - this is the VB forum though!

All you do is load your HTML document into a web browser control and then print it to the PDF printer driver.
cutePDF has a programmable version (not freeware) where you can set the filename of the output PDF file in the registry.

Go to the following sites to download:
http://sourceforge.net/projects/pdfcreator/
http://www.cutepdf.com/
0
 

Author Comment

by:tgunduz
ID: 11701089
Thank you for your comments.

What I am looking is a server side pdf generation. The users are remote users . We can not expect them to install pdf drivers to generate the pdf documents

Basically the best solution would be server side html to pdf conversion on the fly with either open source or proprietrary tools.

many thanks


 
0
 
LVL 5

Assisted Solution

by:8riaN
8riaN earned 25 total points
ID: 11776424
This looks like it will do what you need, provided that the HTML isn't horribly complicated:

http://html2fpdf.sourceforge.net/
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question