واضح آرشیو وب فارسی:سایت ریسک: كمك در ساخت pdf :Mohsen: 10 آبان 1386, 09:44سلام دوستان چجوري ميشه يه فايل pdf ساخت دوم اينكه چجوري ميشه فايل wordرو به pdf تبديل كرد parsmizban 10 آبان 1386, 12:33Use PHP to Create Dynamic pdf Files - Creating the pdfs on the Fly Firstly let’s find the extension that is needed for this exercise. If you installed php on a windows platform, then the php_pdf.dll, on my computer it is located at C:PHPphp-4.3.1-Win32extensions. If you are using a linux platform, believe you’ll need to download this dll file. Now, in your php.ini file remove the “;” character in front of the extension=php_pdf.dll line. Since we updated the ini file, we must restart the apache web server so that the web server can reinitialize the php with the php_pdf library included. Create a php file with the following code, <html> <head> <title>Name Entry Level</title> </head> <body> <table border="0" width="100%" height="100%"> <tr> <td valign="middle" align="center"> <form method="POST" action="pdf_file.php"> <p> <font size="3" face="Arial"> Enter your name here please => <input type="text" name="userName" size="20" maxlength="20"> </font> </p> <p> <input type="submit" value="Submit" name="B 1"> <input type="reset" value="Reset" name="B 2"> </p> </form> </td> </tr> </table> </body> </html> Now we will grab the post information. That is, the page we take the user information ($user) will be added to the hyperlink and pdf file. $user = $["userName"]; Now, we are ready to start. Firstly let’s create a blank pdf file, say bennyboy.pdf. To do this we set a object, say $pdf, to handle pdf manipulations. <?php $pdf = pdf_new(); Pass the object at the first position in all of the PHP pdf functions when required for that page. To open the file, code we use the pdf_open_file function. pdf_open_file($pdf, "C:ennyboy.pdf"); This should create a blank new pdf file size 0kb. The new file has no properties, so let’s assign some. You’ll need to use the pdf_set_info function for this. pdf_set_info($pdf, "Author", "Ben Shepherd"); pdf_set_info($pdf, "Title", "Creating a pdf"); pdf_set_info($pdf, "Creator", "Ben Shepherd"); pdf_set_info($pdf, "Subject", "Creating a pdf"); Now we have all the particulars taken care of let’s do some pdf manipulation. Top begin we need to use the pdf_begin_page function. The parameters, apart from the first which is always $pdf, are measures in of the width and height respectively. A 4 is 595 x 842, Letter is 612 x 792 and Legal is 612 x 1008. pdf_begin_page($pdf, 595, 842); Now it is time to assign a text font for the information to be displayed. Simply use the pdf_findfont and pdf_setfont to do this. I choose the Arial font type with size of 14. $arial = pdf_findfont($pdf, "Arial", "host", 1); pdf_setfont($pdf, $arial, 14); Now we have set the font type, it is time to use it. To display text in the pdf file you must use the pdf_show_xy function. The x-values (i.e. the third parameter), start from the left hand side of the page and move to the right. The y-values start from the bottom of the page and work towards the top. So, it is said that, when you work with the pdf_show_xy function the page starts at the bottom left hand corner of the page. So if we wish to type some text 50 units from the left of the page and 400 units from the bottom of the page you would type the following. pdf_show_xy($pdf, "<Type your info here>",50, 400); But you may not want just text on a page. If you are creating a pdf document for a client you may wish to display a logo. There are functions like pdf_open_gif and pdf_open_jpeg that will open up images and assign them to an object to use in the document. $gif_image = pdf_open_gif($pdf, "baseball.gif"); To put the object onto the pdf file you use the pdf_place_image function with the parameter being pdf file, image file, x-value, y-value and scale repectively. pdf_place_image($pdf, $gif_image, 200, 300, 1.0); You must close the image to put it out of use. pdf_close_image($pdf, $gif_image); Let’s end the pdf manipulation process by using the pdf_end_page and the pdf_close functions. pdf_end_page($pdf); pdf_close($pdf); Now to view your pdf file, simply create a link to open the pdf in a new window. echo "<A HREF="C:ennyboy.pdf" TARGET="_blank">Open pdf in a new window $user</A>" ?> bluepelikan 14 آبان 1386, 11:32دوست عزیز اگر سئوالتون در زمینه وب و صفحات وب ، من زیاد سر رشته ندارم ولی در حد سوادم میدونم برای تبدیل فایلهای ورد و بقیه فایلهای نمایشی می تونید از نرم افزارهای پی دی اف ساز مثل adob acrobot (نسخه پروفشنال) machin pdf , pdf factory solid pdf استفاده کنید .با یکم گشتن تو اینترنت راحت پیداشون میکنی.به شخصه از adob acrobot professinal 6 خیلی راضیم. امیدوارم کمک کرده باشم bahy_my 14 آبان 1386, 14:51parsmizban جان من هزار تا تاپیک در زمینه ی pdf زدم. که هیچ جوابی نگرفتم.کجا بودی نبودی.. این کد مال ورژن 4 هستش. توی 5 یه کتابخونه درست شده. توی 5 کدش چیه ؟ ممنون میشم بدی. parsmizban 14 آبان 1386, 16:19سلام یه آموزش نوشتم
این صفحه را در گوگل محبوب کنید
[ارسال شده از: سایت ریسک]
[مشاهده در: www.ri3k.eu]
[تعداد بازديد از اين مطلب: 456]