Want your customer to save your article, product catalog, or just a document to PDF format? PDF is very easy document format because it's portable, they can print it anywhere.
By : hermawan
<?php
/*
* Save2PDF
* Author : Hermawan Haryanto
* License : GPL
* Create date : 04/12/2001
*/
//set something usefull information for your pdf document.
$author ="Hermawan Haryanto"; //author name (optional)
$title ="hermawan.com"; //title of the pdf page (optional)
$creator ="Hermawan Haryanto"; //creator (optional)
$subject ="News Article"; //Subject (optional)
//end set
//start info taken from the database ( i like mysql)
$headline="HEADLINE OF THE NEWS";
$reporter="Reporter";
$postdate="04/15/2001";
$article.="This is the sample article line 1 \n";
$article.="This is the sample article line 2 \n";
$article.="This is the sample article line 3 \n";
$article.="This is the sample article line 4 \n";
$article.="This is the sample article line 5 \n";
$article.="This is the sample article line 6 \n";
$article.="This is the sample article line 7 \n";
$article.="This is the sample article line 8 \n";
//end database.
//merging all info to one text
$text.=$headline."\n";
$text.=$postdate."\n\n";
$text.=$article."\n";
$text.=$reporter;
//end merging
//start creating pdf on the fly
$pdf = PDF_open();
pdf_set_info_author($pdf, $author);
PDF_set_info_title($pdf, $title);
pdf_set_info_creator($pdf, $creator);
pdf_set_info_subject($pdf, $subject);
PDF_begin_page($pdf, 450, 450);
pdf_set_font($pdf, "Helvetica-Bold" , 12, winansi);
pdf_set_text_rendering($pdf, 0);
PDF_show_boxed($pdf, $text, 50, 100, 400, 300, "left");
pdf_stroke($pdf);
PDF_end_page($pdf);
PDF_close($pdf);
//end creating pdf
?>
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |
More Miscellaneous Code Articles
More By Codewalkers
developerWorks - FREE Tools! |
Hear how IBM Rational Project and Portfolio Management integrated solutions help teams put the right tools and processes in place to maximize the effectiveness and efficiency of project teams and ensure that the business vision is being executed correctly. Learn how to automate and integrate requirements prioritization, top-down project planning, communications and controls, and methodology deployment to keep your scope, costs, and schedules under control. Tackle with an end-to-end approach the management of scope and scope changes, usage of methodology to control and empower project teams, and optimization of resources to align activity costs with the overall project plan. FREE! Go There Now!
|
|
|
|
You probably have thousands of lines of COBOL code loaded with business intelligence and being used to run your business, along with an army of developers maintaining these applications. Learn how to prepare your applications and developers so you can keep that competitive edge and move to a service-oriented architecture with the IBM Rational Enterprise Modernization solutions. Replay is available for 9 months. FREE! Go There Now!
|
|
|
|
Download a free trial version of IBM DB2 9.5 for Linux, UNIX, and Windows. DB2 9 is the result of a five-year development project that transformed traditional (static) database technology into an interactive data server that merges the high performance and ease of use of DB2 with the self-describing benefits of XML. FREE! Go There Now!
|
|
|
|
In this tutorial, you can learn how to install and configure the IBM Rational Asset Manager Eclipse client, explore the different views in the Asset Management perspective, learn various search techniques, work with existing assets, and submit a new asset. FREE! Go There Now!
|
|
|
|
This webcast outlines the best practices that must be instituted to gain the maximum benefit from SOA while maintaining high quality of service. Whether you are deploying new applications or managing and monitoring your existing infrastructure, learn how you can ensure high quality of services with SOA based solutions from IBM. All registrants who attend this live Web Seminar will receive complimentary access to a white paper titled “Maintaining QoS in an SOA Environment”. FREE! Go There Now!
|
|
|
|
This whitepaper provides areas to consider when evaluating any software configuration management solution. It addresses how the IBM solutions (Rational ClearCase and Rational ClearQuest) meet the needs and requirements of both project leaders and developers to provide successful Software Change and Configuration Management. FREE! Go There Now!
|
|
|
|
Get a free trial download of IBM Lotus Forms V3.0 (formerly Workplace Forms), which provides a zero-footprint eForms solution to help you automate and move forms-based business processes off the desktop and onto the Web. With Lotus Forms, you can extend applications beyond the firewall by creating a single electronic form document ready for use in both thick and Web 2.0 thin client format. FREE! Go There Now!
|
|
|
|
Get a free trial download of the latest version of IBM Rational Method Composer V7.2 which helps you deliver customized yet consistent process guidance to your project teams and IT organization, and includes the latest version of IBM Rational Unified Process (RUP), which has provided process guidance to teams since 1996. FREE! Go There Now!
|
|
|
|
Visit IBM developerWorks to try the IBM SOA Sandbox for process. The SOA Sandbox for process focuses on providing a trial environment with the necessary tooling and components required to gain a better understanding of business processes and how to best improve existing business processes to derive value quickly. FREE! Go There Now!
|
|
|
|
Explore how Rational and WebSphere software enable enterprise documentation in SOA environments. Specifically, a new integration between IBM WebSphere® Business Modeler and IBM Rational® Method Composer software can help technical writers more easily keep enterprise operations manuals in sync with changes that are made to business processes, resulting in more accurate and timely documentation that benefits the entire enterprise. FREE! Go There Now!
|
|
|
|
All FREE IBM® developerWorks Tools! |