How To: Create PDF With Php - Create on-the-fly PDF on the web server

Pages: 1, 2
free web hosting
Free Web Hosting > Computers & Tech > How-To's and Tutorials > Programming > PHP

How To: Create PDF With Php - Create on-the-fly PDF on the web server

vmkrightpoint
Omg,

i was looking for something like this for a while!!

thank you

Reply

Avinash Raut Nagpur(india)
QUOTE(FeedBacker @ Dec 12 2007, 04:24 AM) *
Question actually.
I have problems at GEN02.Php:
The function PDF_open_image_file (I also tried with PDF_load_image)
Always return 0.

I tried a lot of things (SearchPath, different type of pictures, different pictures...) but still return 0.

Please help!

Tks,

Ferasse.

-Mr. Tea


*******************************************************************
Hello
here is the solution
<?php
$mypdf = PDF_new();
PDF_open_file($mypdf, "");
PDF_begin_page($mypdf, 595, 842);
$myfont = PDF_findfont($mypdf, "Times-Roman", "host", 0);
PDF_setfont($mypdf, $myfont, 10);
//PDF_show_xy($mypdf, "Sample PDF, constructed by PHP in real-time.", 50, 750);
//PDF_show_xy($mypdf, "Made with the PDF libraries for PHP.", 50, 730);
//PDF_show_xy($mypdf, "A JPEG image, on 60 % of its original size.", 50, 710);
//$myimage = PDF_open_image_file($mypdf, "jpeg", "trump.jpg");
$myimage = PDF_load_image($mypdf, "jpeg", "D:\wamp\www\srms_test\pdf\a.jpg", "");
//PDF_place_image($mypdf, $myimage, 50, 650, 0.6);
PDF_fit_image($mypdf, $myimage, 0, 700, "boxsize {200 100} fitmethod meet");
PDF_end_page($mypdf);
PDF_close($mypdf);
$mybuf = PDF_get_buffer($mypdf);
$mylen = strlen($mybuf);
header("Content-type: application/pdf");
header("Content-Length: $mylen");
header("Content-Disposition: inline; filename=gen02.pdf");
print $mybuf;
PDF_delete($mypdf);
?>

 

 

 


Reply

iGuest
Font weight and style
How To: Create PDF With Php

How do make text bold or italic, and such?
Thanks a lot for the tutorial, it's very helpful!

Philippe Alves

Reply

Quatrux
I needed to create a printable version of a html application form with PHP, due to printing the html from a browser was quite lame, so I thought to use PDF generation and really found a great class which doesn't require any extra libs like in the tutorial and it works with PHP4 and PHP5, there are two different versions for support for both of them..

the class is called TCPDF, you'll find it through google, as I know a lot of PHP apps are using it to generate PDF files and it's really powerful, there are ~22 examples in the package how would you need to create them, at first it was quite hard for me, but in a couple of hours I got myself a PHP script to generate PDF files I wanted.. before that I tried fpdf, I think tcpdf is written the way fpdf is, but tcpdf has much more features and the main thing it has UTF-8 support, fpdf doesn't support UTF-8, thats why I had problems with some Lithuanian letters and found TCPDF, really a great class! wink.gif

FPDF: http://www.fpdf.org/
TCPDF: http://www.tecnick.com/public/code/cp_dpag...?aiocp_dp=tcpdf

Reply

FirefoxRocks
This is a very good tutorial nonetheless lengthy. I personally do not see much use for PDF documents unless you are scanning things in and converting those to PDF files.

This method can be useful if you are trying to convert Word documents into PDF and you do not have access to certain PDF software or OpenOffice.org.

I may decide to try this sometime when I need it.

Reply

iGuest
Euro Symbol with pdflib
How To: Create PDF With Php

How Can I print the euro symbol in a pdf document generated with pdflib???
I try print it by different ways but I can't do it.

Anyone can help me???

Thank in advance.

-reply by Jorge Roman

Reply

alex198555
Interesting tutorial! Do you know if it is possible to convert the PDF File into content management system. This is the thing I would like to know about it,

Let's say, I have a PDF file on my local drive, and I want to convert that file into my database, or using CMS editor to do so, and this file will automatically will be added to my database, by parts, chapters and so on.


Reply

iGuest
contents from MySQL
How To: Create PDF With Php

How can I generate contents in the pdf using data coming from MySQL database ??

-reply by Mohamed badr

Reply

rockarolla
Hei,,whats the script you'r using for your singature...a kind of impressed - am totally unfamiliar with ada ..

thanks

Reply


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Pages: 1, 2
Recent Queries:-
  1. php create pdf - 0.09 hr back. (3)
  2. how to creat pdf in php - 1.95 hr back. (1)
  3. generate pdf on the fly on web - 4.65 hr back. (1)
  4. php generate pdf - 5.24 hr back. (1)
  5. create pdf from html php - 5.31 hr back. (1)
  6. create pdf php - 6.73 hr back. (3)
  7. php pdf creation - 10.04 hr back. (1)
  8. how to create pdf file from form post with php - 12.15 hr back. (1)
  9. php generate .pdf - 12.62 hr back. (1)
  10. generating pdfs on the fly - 12.88 hr back. (1)
  11. php create a pdf on the fly and send via email - 12.91 hr back. (1)
  12. create pdf with php - 12.21 hr back. (2)
  13. "create pdf" php - 13.65 hr back. (1)
  14. create pdf via php - 14.44 hr back. (1)
Similar Topics

Keywords : howto, create, pdf, php, create, fly, pdf, web, server

  1. Setting Up Your Php Server
    a small introduction on server setup. (0)


      Looking for howto, create, pdf, php, create, fly, pdf, web, server

Searching Video's for howto, create, pdf, php, create, fly, pdf, web, server
advertisement




How To: Create PDF With Php - Create on-the-fly PDF on the web server



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE