Solved

HTML to PDF conversion on the fly

Posted on 2004-08-02
8
328 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
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
groupSumClump challenge 9 125
simplest php form 3 81
Identify two keyboard codes and how to enter them 9 56
Programming Codes 2 21
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…
This is about my first experience with programming Arduino.
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 …

860 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