Solved

HTML to PDF conversion on the fly

Posted on 2004-08-02
8
315 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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

744 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now