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! |
Join this webcast, to learn how the Rational Process Library can help with compliance issues, drive process improvement, and assist in service-oriented architecture (SOA) or Agile development. We will take a peek into the Rational Process Library with content around software and systems engineering (including RUP), operations and systems management, program and portfolio management, and asset and SOA governance. FREE! Go There Now!
|
|
|
|
As businesses grow increasingly dependent upon Web applications to provide services to customers, employees and partners, these complex applications become more difficult to secure. Although traditional security solutions protect Internet infrastructure layers, they do not guard against HTTP and HTML attacks. Many organizations that conduct security testing still deploy applications that allow attackers to manipulate their logic and wreak havoc on their business. To mitigate this risk, development and delivery teams must address Web application security throughout the lifecycle, addressing the many layers detailed in this paper. FREE! Go There Now!
|
|
|
|
Poor Requirements Management capabilities in an Enterprise have been linked to excessive project failures, escalating IT costs, and failure to deliver competitive advantage into the marketplace. Join Brianna M Smith from IBM Rational and learn about how successful organizations align IT and Business stakeholders through collaborative processes and tools for effective requirements management, and how an integrated approach across the IT lifecycle can provide unparalleled visibility and traceability to ensure that project teams are delivering on the business vision by "doing the right things" and "doing things right." FREE! Go There Now!
|
|
|
|
Build secure Web services with transport-level security using IBM Rational Application Developer V7 and IBM WebSphere Application Server V6.1. Follow this three-part series for step-by-step instructions about how to develop Web services and clients, configure HTTP basic authentication, and configure HTTP over SSL (HTTPS). This first part of the series walks you through building a Web service for a simple calculator application. You generate and test two different types of Web services clients: a Java Platform, Enterprise Edition (Java EE) client and a stand-alone Java client. You also handle user-defined exceptions in Web services. FREE! Go There Now!
|
|
|
|
CakePHP is a stable production-ready, rapid-development aid for building Web sites in PHP. This "Cook up Web sites fast with CakePHP" series shows you how to build an online product catalog using CakePHP. FREE! Go There Now!
|
|
|
|
Download a free trial version of IBM Rational Developer for System i V7.1, which provides a complete development environment for traditional i5/OS application development. IBM Rational Developer for System i is a new eclipse-based workstation offering for i5/OS application development that provides a comprehensive Integrated Development Environment for edit/compile/debug of traditional RPG/COBOL/C/C++ i5/OS applications. FREE! Go There Now!
|
|
|
|
XML has become a common way of storing business data as flat files and many data server vendors including IBM have provided ways to store this data within relational database systems. Increasingly collections of XML files are accessed like databases using an xQuery and other XML standard mechanisms. Businesses find the need to combine the traditional tabular structured data with XML formatted data. In this webcast, you’ll learn about IBM’s WebSphere Federation Server technology, which provides users with the ability to integrate these two data formats. 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!
|
|
|
|
Whether you are creating new applications or modifying existing ones, managing integration of new components with traditional z/OS elements is a critical part of building and deploying modern applications. Listen to this webcast to see how IBM can help you optimize your development process using an IDE like Rational Developer for System z that integrates with management tools, such as ClearCase to manage your application development on mainframes. FREE! Go There Now!
|
|
|
|
In this webcast, you'll get an introduction to the eXtreme Transaction Processing (XTP) features of WebSphere Extended Deployment and the common architectural traits required by XTP applications. See how WebSphere Extended Deployment's ObjectGrid feature provides a state-of-the-art infrastructure for hosting XTP applications. FREE! Go There Now!
|
|
|
|
All FREE IBM® developerWorks Tools! |