creating pdf

This is a discussion on "creating pdf" within the PHP Forum section. This forum, and the thread "creating pdf are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Aug 14th, 2007, 10:24
Junior Member
Join Date: Jun 2007
Location: IRan
Age: 19
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to bahy Send a message via Yahoo to bahy
creating pdf

hi
i have a code for creating pdf in php. but it don't work. i don't know why.
would you give me a code for doing this ?
creating a pdf file or pdf showing.
thnx.
missing your answer.
Reply With Quote

  #2 (permalink)  
Old Aug 14th, 2007, 10:54
1840dsgn's Avatar
SuperMember

SuperMember
Join Date: Jun 2007
Location: Canterbury
Age: 19
Posts: 719
Thanks: 0
Thanked 0 Times in 0 Posts
Re: creating pdf

Ok...for the seocnd time today I have to say that we are not a free scripting service. Why not post your code up here and we can take a look and maybe help you out - also why not learn PHP and maybe you could give fixing it a shot.

If you want a script out the box then you'll need to buy it like evreyrone else.
Reply With Quote
  #3 (permalink)  
Old Aug 14th, 2007, 11:24
Junior Member
Join Date: Jun 2007
Location: IRan
Age: 19
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to bahy Send a message via Yahoo to bahy
Re: creating pdf

hi, i don't need to learn php az a beginner. it's second my post which has no answer til now.
ok
my code i here :
Quote:
<?php
// Declare pdf File
$pdf = pdf_new();
pdf_open_file($pdf);
// Set Document Properties
pdf_set_info($pdf, "author", "Alexander Pas");
pdf_set_info($pdf, "title", "pdf by PHP Example");
pdf_set_info($pdf, "creator", "Alexander Pas");
pdf_set_info($pdf, "subject", "Testing Code");
// Get fonts to use
pdf_set_parameter($pdf, "FontOutline", "Arial=arial.ttf"); // get a custom font
$font1 = pdf_findfont($pdf, "Helvetica-Bold", "winansi", 0); // declare default font
$font2 = pdf_findfont($pdf, "Arial", "winansi", 1); // declare custom font & embed into file
/*
You can use the following Fontypes 14 safely (the default fonts)
Courier, Courier-Bold, Courier-Oblique, Courier-BoldOblique
Helvetica, Helvetica-Bold, Helvetica-Oblique, Helvetica-BoldOblique
Times-Roman, Times-Bold, Times-Italic, Times-BoldItalic
Symbol, ZapfDingbats
*/
// make the images
$image1 = pdf_open_image_file($pdf, "gif", "image.gif"); //supported filetypes are: jpeg, tiff, gif, png.
//Make First Page
pdf_begin_page($pdf, 450, 450); // page width and height.
$bookmark = pdf_add_bookmark($pdf, "Front"); // add a top level bookmark.
pdf_setfont($pdf, $font1, 12); // use this font from now on.
pdf_show_xy($pdf, "First Page!", 5, 225); // show this text measured from the left top.
pdf_place_image($pdf, $image1, 255, 5, 1); // last number will schale it.
pdf_end_page($pdf); // End of Page.
//Make Second Page
pdf_begin_page($pdf, 450, 225); // page width and height.
$bookmark1 = pdf_add_bookmark($pdf, "Chapter1", $bookmark); // add a nested bookmark. (can be nested multiple times.)
pdf_setfont($pdf, $font2, 12); // use this font from now on.
pdf_show_xy($pdf, "Chapter1!", 225, 5);
pdf_add_bookmark($pdf, "Chapter1.1", $bookmark1); // add a nested bookmark (already in a nested one).
pdf_setfont($pdf, $font1, 12);
pdf_show_xy($pdf, "Chapter1.1", 225, 5);
pdf_end_page($pdf);

// Finish the pdf File

pdf_close($pdf); // End Of pdf-File.
$output = pdf_get_buffer($pdf); // assemble the file in a variable.
// Output Area
header("Content-type: application/pdf"); //set filetype to pdf.
header("Content-Length: ".strlen($output)); //content length
header("Content-Disposition: attachment; filename=test.pdf"); // you can use inline or attachment.
echo $output; // actual print area!
// Cleanup
pdf_delete($pdf);
?>
firned your aren't forced to answer me if the question is so difficult !
maybe impossible for someone !
and yourself ?
please help me in this code if you can.
thanx a lot.
Reply With Quote
  #4 (permalink)  
Old Aug 14th, 2007, 11:25
Junior Member
Join Date: Jun 2007
Location: IRan
Age: 19
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to bahy Send a message via Yahoo to bahy
Re: creating pdf

i take this code from php.net
Reply With Quote
  #5 (permalink)  
Old Aug 14th, 2007, 14:36
c010depunkk's Avatar
SuperMember

SuperMember
Join Date: Apr 2007
Location: Willich, Germany
Age: 20
Posts: 593
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to c010depunkk
Re: creating pdf

Has this code ever worked for you. I got a ton of errors when I tried to run it. Check through your code again using this as reference.

Start with the 'pdf_open_file' function on the first line: it needs two parameters, not one. Also make sure that the script is finding all the font and image files.

If you have more specific questions about any errors you are getting, feel free to ask.
Reply With Quote
  #6 (permalink)  
Old Aug 15th, 2007, 23:26
sannbe's Avatar
SuperMember

SuperMember
Join Date: Dec 2006
Location: San Francisco
Age: 57
Posts: 1,567
Blog Entries: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Re: creating pdf

Quote:
Check through your code again using this as reference.
Excellent link....I don't need it at this moment but I am saving the link. Good job.
Last Blog Entry: More Sara Blogging (Nov 29th, 2007)
Reply With Quote
  #7 (permalink)  
Old Aug 15th, 2007, 23:30
1840dsgn's Avatar
SuperMember

SuperMember
Join Date: Jun 2007
Location: Canterbury
Age: 19
Posts: 719
Thanks: 0
Thanked 0 Times in 0 Posts
Re: creating pdf

Bookmarked for the future!
Reply With Quote
  #8 (permalink)  
Old Aug 18th, 2007, 00:37
Junior Member
Join Date: Jul 2007
Location: Los Angeles
Age: 31
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts
Re: creating pdf

If your hosting provider either doesn't have the PDF lib installed or won't install it we've found this work around:


http://www.ros.co.nz/pdf/



___________________________

Imagn Design: Los Angeles Web Design Firm
Reply With Quote
Reply

Tags
pdf

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
re-creating this WDH Web Page Design 4 Feb 14th, 2008 07:46
Creating a CMS and Blog... marSoul Website Planning 12 Jan 3rd, 2008 00:56
Creating a sum with ASP Andrew1986 Classic ASP 4 Aug 1st, 2007 10:09
Creating a nav bar like this davva Web Page Design 22 Aug 30th, 2006 20:33
how would i go about creating this ? protein82 Graphics and 3D 4 May 9th, 2006 15:05


All times are GMT. The time now is 02:08.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43