Welcome to ComponentOne PDF for .NET

Untitled Document ComponentOne PDF for .NET Untitled Document E-mail sent to documentation@componentone.com is for documentation feedback only. We welcome any suggestions to help improve our documentation.

Welcome to ComponentOne PDF for .NET

Welcome to ComponentOne PDF™ for .NET. C1PDF allows you to create PDF documents from your applications.

ComponentOne has a user-friendly distribution policy. We want every programmer to obtain a copy of PDF for .NET to try for as long as they wish. Those who like the product and find it useful may buy a license for a reasonable price. The only restriction is that unlicensed copies of C1PDF will display a ComponentOne banner every time they are loaded to remind developers to license the product.

We are confident that you'll like C1PDF. If you have any suggestions or ideas for new features that you'd like to see included in a future version, or ideas about new components, please call us or write:

Corporate Headquarters

ComponentOne LLC
201 South Highland Avenue
3rd Floor
Pittsburgh, PA 15206 • USA
412.681.4343
412.681.4384 (Fax)

http://www.componentone.com

Overview

What's New in ComponentOne PDF for .NET

Installing PDF for .NET

END-USER LICENSE AGREEMENT FOR COMPONENTONE SOFTWARE

Licensing FAQs

Technical Support

Redistributable Files

Namespaces

Creating a .NET Project

Adding the ComponentOne PDF for .NET Component to the Toolbox

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Overview

Overview

ComponentOne PDF for .NET is a library that allows you to create PDF documents from your applications.

The PDF (Portable Document Format) format was created by Adobe in 1993 and has since become the industry standard for the representation of printed material in electronic systems. PDF is popular because it is high-quality, portable, device-independent, and because there are many tools available for creating, manipulating, and viewing PDF documents. These tools include the free multi-platform document viewer Adobe Acrobat. The portability and high quality of the PDF documents make PDF an excellent choice for Web publishing. For more information on the PDF format and PDF utilities from Adobe and other sources, visit the Adobe Web site (www.adobe.com).

C1PDF supports most of the advanced features included in the PDF specification, including security, compression, outlining, hyperlinking, and attachments.

But the main feature in C1PDF is ease of use. The commands provided for adding content to documents are similar to the ones available in the .NET Graphics class. If you know how to display text and graphics in .NET, you already know how to use C1PDF.

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


What's New in ComponentOne PDF for .NET

What's New in ComponentOne PDF for .NET

This documentation was last revised on June 6, 2005.

Overview of What's New in ComponentOne PDF for .NET

A new class member has been added to PDF for .NET that allows the user more flexibility. The latest addition aids in improving compatibility with Graphics object model. PDF for .NET now contains Task-Based Help in the documentation to help aid in specific tasks. Task-Based Help is similar to tutorials by the detailed step by step explanation on how to do a task except that it focuses on one task instead of a group of tasks. This makes it easier for developers to find information on one specific topic.

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Feature Overview

Feature Overview

There are no new features in PDF for .NET at this time.

For your reference, a few major features that have been recently added to PDF for .NET are included below:

FillRectangle method

The additions were updated on February 17, 2005.

Fills the interior of a rectangle specified by a System.Drawing.RectangleF structure. The improved FillRectangle method now supports non-solid brushes (gradients, textures, etc).

Line-Breaking Logic

The additions were updated on November 1, 2004.

C1PDF has improved line-breaking logic to deal with lines that are wider than the page.

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Class Members

Class Members

Below is the most recent method added to the C1PDF component (the additions were updated on 5/25/2005):

C1PdfDocument Class | Description
DrawString | Overloaded. Draws the specified text string in the specified rectangle with the specified System.Drawing.Brush and System.Drawing.Font objects

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Task-Based Help Overview

Task-Based Help Overview

The new Task-Based Help section uses several important features of the PDF for .NET component to create richly formatted documents. The additions were updated on June 6, 2005. The following topics have been added to the task based help for PDF for .NET:

Task-Based Help | Description
Print PDF files | This topic illustrates how to add print functionality to PDF files.
Write C1PDF content in web applications | This topic shows you how to write C1PDF content directly into a web page's output buffer with no temporary files.
Add C1FlexGrid data into C1PDF | This topic demonstrates how to add C1FlexGrid data into C1PDF.
Create a PDF from a report rendered by VSPrinter | This topic shows you how to convert documents created with the VSPrinter ActiveX control to PDF.
Remove PDF bookmarks from a C1Report document | This topic explains how to remove PDF bookmarks from a C1Report document using the OutlineRootLevel property.

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Installing PDF for .NET

Installing PDF for .NET

This section describes the setup files and system requirements for PDF for .NET. It also explains how to install demonstration versions of ComponentOne products and uninstall PDF for .NET.

PDF for .NET Setup Files

System Requirements

Installing Demonstration Versions

Uninstalling PDF for .NET

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PDF for .NET Setup Files

PDF for .NET Setup Files

The installation program will create the directory C:\Program Files\ComponentOne Studio.NET, which contains the following subdirectories:

bin | Contains copies of all binaries (DLLs, EXEs) in the ComponentOne Visual Studio.NET package.
Common | Contains support and data files that are used by many of the demo programs.
Help | Contains online documentation for all Studio components.
C1PDF | Contains samples and tutorials for the C1PDF component.
Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


System Requirements

System Requirements

· Operating Systems:

· Windows 2000

· Windows 2003 Server

· Windows NT 4

· Windows XP, SP1, SP2

· Environments:

· .NET Framework 1.0

· .NET Framework1.1

· C# .NET

· Delphi

· Visual Basic .NET

· Hard Disk Space: 9 MB

· Disc Drive: CD or DVD-ROM drive if installing from CD

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Installing Demonstration Versions

Installing Demonstration Versions

If you wish to try PDF for .NET or any of our other products and do not have a registration key, follow the steps through the installation wizard and use the default serial number.

The only difference between unregistered (demonstration) and registered (purchased) versions of our products is that registered versions will stamp every application you compile so a ComponentOne banner will not appear when your users run the applications.

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Uninstalling PDF for .NET

Uninstalling PDF for .NET

To uninstall PDF for .NET, open the Control Panel and select the Add or Remove Programs. Select PDF for .NET and click the Remove button.

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


END-USER LICENSE AGREEMENT FOR COMPONENTONE SOFTWARE

END-USER LICENSE AGREEMENT FOR COMPONENTONE SOFTWARE

IMPORTANT-READ CAREFULLY: This End User License Agreement (this "EULA") contains the terms and conditions regarding your use of the SOFTWARE (as defined below). This EULA contains material limitations to your rights in that regard. You should read this EULA carefully and treat it as valuable property.

I. THIS EULA.

1. Software Covered by this EULA. This EULA governs your use of the ComponentOne, LLC ("C1") software product(s) enclosed or otherwise accompanied herewith (individually and collectively, the "SOFTWARE"). The term "SOFTWARE" includes, to the extent provided by C1: 1) any revisions, updates and/or upgrades thereto; 2) any data, image or executable files, databases, data engines, computer software, or similar items customarily used or distributed with computer software products; 3) anything in any form whatsoever intended to be used with or in conjunction with the SOFTWARE; and 4) any associated media, documentation (including physical, electronic and on-line) and printed materials (the "Documentation").

2. This EULA is a Legally Binding Agreement Between You and C1. If you are acting as an agent of a company or another legal person, such as an officer or other employee acting for your employer, then "you" and "your" mean your principal, the entity or other legal person for whom you are acting. However, importantly, even if you are acting as an agent for another, you may still be personally liable for violation of federal and State laws, such as copyright infringement.

3. This EULA is a legally binding agreement between you and C1. You intend to be legally bound to this EULA to the same extent as if C1 and you physically signed this EULA. By installing, copying, or otherwise using the SOFTWARE, you agree to be bound by the terms and conditions contained in this EULA. If you do not agree to all of the terms and conditions contained in this EULA, you may not install or use the SOFTWARE. If, for whatever reason, installation has begun or has been completed, you should cancel installation or un-install the SOFTWARE, as the case may be. (You may click on the "exit" button or its equivalent to immediately abort installation.) If you do not agree to all of these terms and conditions, then you must promptly return the SOFTWARE to the place of business from which you obtained it in accordance with any return policies of such place of business. Return policies may vary between or among resellers, and you must comply with your particular reseller's return policies as agreed at the point of purchase. If the place of business from which you purchased the SOFTWARE does not honor a complete refund for a period of thirty (30) days from the date of proof of purchase, then you may return the SOFTWARE directly to C1 for a period of thirty (30) days from the date of your purchase. To return the product directly to C1, you must obtain a C1 Return Authorization Number by contacting C1, and you must forward all items purchased, including the proof of purchase, directly to C1. The return must be postage-prepaid, and post-marked within thirty (30) days from the proof of purchase, time being of the essence. The return option to C1 is only available to the original purchaser of an unopened factory packaged item.

II. YOUR LICENSE TO DEVELOP AND TO DISTRIBUTE.

As provided in more detail below, this EULA grants you two licenses: 1) a license to use the SOFTWARE to develop other software products (the "Development License"); and 2) a license to use and/or distribute the Developed Software (the "Distribution License"). Both of these licenses (individually and collectively, the "Licenses") are explained and defined in more detail below.

1. Definitions. The following terms have the respective meanings as used in this EULA:

"Network Server" means a computer with one or more computer central processing units (CPU's) that operates for the purpose of serving other computers logically or physically connected to it, including, but not limited to, other computers connected to it on an internal network, intranet or the Internet. "Web Server" means a type of Network Server that serves other computers more particularly connected to it over an intranet or the Internet.

"Developed Software" means those computer software products that are developed by or through the use of the SOFTWARE. "Developed Web Server Software" means those Developed Software products that reside logically or physically on at least one Web Server and are operated (meaning the computer software instruction set is carried out) by the Web Server's central processing unit(s) (CPU). "Developed Legacy Software" means those Developed Software products that are not Developed Web Server Software, including, for example, stand-alone applications and applications accessed by a file server only. "Redistributable Files" means the SOFTWARE files or other portions of the SOFTWARE that are provided by C1 and are identified as such in the Documentation for distribution by you with the Developed Software. "Developer" means a human being or any other automated device using the SOFTWARE in accordance with the terms and conditions of this EULA.

"Developer Seat License" means that each Developer using or otherwise accessing the programmatic interface or the SOFTWARE must obtain the right to do so by purchasing a separate End User License.

“Source Code” shall mean computer software code or programs in human readable format, such as a printed listing of such a program written in a high-level computer language. The term "Source Code" includes, but is not limited to, documents and materials in support of the development effort of the SOFTWARE, such as flow charts, pseudo code and program notes.

2. Your Development License. You are hereby granted a limited, royalty-free, non-exclusive right to use the SOFTWARE to design, develop, and test Developed Software, on the express condition that, and only for so long as, you fully comply with all terms and conditions of this EULA.

The SOFTWARE is licensed to you on a Developer Seat License basis.

The Developer Seat License means that you may perform an installation of the SOFTWARE for use in designing, testing and creating Developed Software by a single Developer on one or more computers, each with a single set of input devices, so long as such computer/computers is/are used only by one single Developer at any given time and not concurrently. Conversely, you may not install or use the SOFTWARE on a computer that is a network server or a computer at which the SOFTWARE is used by more than one Developer. You may not network the SOFTWARE or any component part of it, where it is or may be used by more than one Developer unless you purchase an additional Development License for each Developer. You must purchase another separate license to the SOFTWARE in order to add additional developer seats, whether the additional developers are accessing the SOFTWARE in a stand-alone environment or on a computer network.

In all cases, you may not use C1's name, logo, or trademarks to market your Developed Software without the express written consent of C1; (b) you must include the following C1 copyright notice in your Developed Software documentation and/or in the "About Box" of your Developed Software, and wherever the copyright/rights notice is located in the Developed Software (“Portions Copyright © ComponentOne, LLC 1991-2002. All Rights Reserved.”); (c) agree to indemnify, hold harmless, and defend C1, its suppliers and resellers, from and against any claims or lawsuits, including attorney's fees that may arise from the use or distribution of your Developed Software; (d) you may use the SOFTWARE only to create Developed Software that is significantly different than the SOFTWARE.

3. Your Distribution License.

License to Distribute Developed Software. Subject to the terms and conditions in this EULA, you are granted the license to use and to distribute Developed Software on a royalty-free basis, provided that the Developed Software incorporates the SOFTWARE as an integral part of the Developed Software in machine-language compiled format (customarily an ".exe", or ".dll", etc.). You may not distribute, bundle, wrap or subclass the SOFTWARE as Developed Software which, when used in a "designtime" development environment, exposes the programmatic interface of the SOFTWARE. You may distribute, on a royalty-free basis, Redistributable Files with Developed Software only.

4. Specific Product Limitations. Notwithstanding anything in this EULA to the contrary, if the license you have purchased is for any of the following products, then the following additional limitations will apply:

a. ComponentOne Reports for .NET Designer Edition. ComponentOne Reports for .NET Designer Edition includes at least: 1) one dynamic link library (c1.win.c1reportdesigner.dll) file known as C1ReportDesigner Component, 2) one executable (ReportDesigner.exe) file known as C1ReportDesigner Application and, 3) the Source Code of the C1ReportDesigner Application. The C1ReportDesigner Component is subject to the general terms and restrictions set forth in this EULA. The C1ReportDesigner Application is an executable file used to design and prepare reports; the C1ReportDesigner Application may be distributed, free of royalties, only in conjunction with the Developed Software.

Subject to the terms and conditions in this EULA, C1 hereby grants you the right to use the C1ReportDesigner Application Source Code. You are hereby also granted the right to modify such Source Code and to create derivative works that are based on the licensed Source Code. You may distribute the derivative works that you develop, solely in object code format and exclusively in conjunction with and/or as a part of the Developed Software. You are expressly not granted the right to distribute, disclose or otherwise make available to any third party the licensed Source Code, any modified version, derivative work, or any portion thereof, in source code format.

C1 shall retain all right, title and interest in and to the licensed Source Code, and all C1 updates, modifications or enhancements thereof. Nothing herein shall be deemed to transfer any ownership or title rights in and to the licensed Source Code from C1 to you.

SOURCE CODE IS LICENSED TO YOU AS IS. C1 DOES NOT AND SHALL NOT PROVIDE YOU WITH ANY TECHNICAL SUPPORT FOR YOUR SOURCE CODE LICENSE.

b. VSView Reporting Edition. VSView Reporting Edition includes at least one executable file listed as “VSRptX.exe” (where X indicates the version number i.e.7,8, etc.), known as “Designer.” The file "VSRptX.exe”, or any upgrade or future versions of the Designer, are subject to the restrictions set forth in this EULA and may not be distributed with your Developed Software or in any other way.

c. Doc-to-Help and ComponentOne Natural Search. You may use Doc-To-Help to create online help, manuals or other documentation in electronic or printed format (the "Output Documents"). You may distribute and incorporate in such Output Documents those files identified in the documentation as Redistributable Files. Except for those specific Redistributable Files, you MAY NOT distribute the SOFTWARE, in any format, to others.

d. Studio Products. You may not share the component parts of the Studio Products licensed to you with other Developers, nor may you allow the use and/or installation of such components by other Developers.

e. ComponentOne Response and SOAP Channel. ComponentOne Response is intended to be installed on a Network Server. C1 grants to you the following rights to the SOFTWARE: a) Installation: You may install one copy of the SOFTWARE on a single Network Server; b) Use: When installed and initialized, the SOFTWARE creates a database file which contains the embodiment of a solution knowledge base (the database hereinafter referred to as the "Knowledge Base").

You may use the SOFTWARE to create Knowledge Bases on one Network Server only. To create or to operate Knowledge Bases in more than one Network Server, you must purchase one additional SOFTWARE license for each additional Network Server.

5. Updates/Upgrades; Studio Subscription. Subject to the terms and conditions of this EULA, the Licenses are perpetual. Updates and upgrades to the SOFTWARE may be provided by C1 from time-to-time, and, if so provided by C1, are provided upon the terms and conditions offered at that time by C1 in its sole discretion. C1 may provide updates and upgrades to the SOFTWARE for free or for any charge, at any time or never, and through its chosen manner of access and distribution, all in C1's sole and complete discretion.

C1 licenses certain of its separately-licensed products bundled together in a product suite, called the C1 "Studio" product line (the "Studio Products"). The exact separately-licensed products that are bundled into the Studio Products may change from time-to-time in C1's sole discretion. If the SOFTWARE is identified as a C1 "Studio" product, then the SOFTWARE is one of the Studio Products. The SOFTWARE and the Studio Products are revised from time-to-time (meaning, for example, revised with updates, upgrades and, in the case of Studio products, possibly changes to which specific products are included in the bundle). For you to be entitled to receive any such revisions to the SOFTWARE or the Studio Products, as the case may be, you must have a valid SOFTWARE license or a valid Studio subscription. The original purchaser of the SOFTWARE or of a Studio product receives a one-year subscription from the date of purchase of the SOFTWARE. After one year, the Studio subscription and/or the SOFTWARE license must be renewed to continue to be entitled to receive the SOFTWARE and/or the Studio Products revisions as the case may be.

6. Serial Number. Within the packaging of the SOFTWARE, a unique serial number (the "Serial Number") is included, which allows for the registration of the SOFTWARE. The Serial Number is subject to the restrictions set forth in this EULA and may not be disclosed or distributed either with your Developed Software or in any other way. The disclosure or distribution of the Serial Number shall constitute a breach of this EULA, the effect of which shall be the automatic termination and revocation of all the rights granted herein.

7. Evaluation Copy. If you are using an "evaluation copy" or similar version, specifically designated as such by C1 on its website or otherwise, then the Licenses are limited as follows: a) you are granted a license to use the SOFTWARE for a period of thirty (30) days counted from the day of installation (the "Evaluation Period"); b) upon completion of the Evaluation Period, you shall either i) delete the SOFTWARE from the computer containing the installation, or you may ii) contact C1 or one of its authorized dealers to purchase a license of the SOFTWARE, which is subject to the terms and limitations contained herein; and c) any Developed Software may not be distributed or used for any commercial purpose.

III. INTELLECTUAL PROPERTY.

1. Copyright. You agree that all right, title, and interest in and to the SOFTWARE (including, but not limited to, any images, photographs, animations, video, audio, music, text, and “applets” incorporated into the SOFTWARE), and any copies of the SOFTWARE, and any copyrights and other intellectual properties therein or related thereto are owned exclusively by C1, except to the limited extent that C1 may be the rightful license holder of certain third-party technologies incorporated into the SOFTWARE. The SOFTWARE is protected by copyright laws and international treaty provisions. The SOFTWARE is licensed to you, not sold to you. C1 reserves all rights not otherwise expressly and specifically granted to you in this EULA.

2. Backups. You may either: (a) copy the SOFTWARE solely for backup or archival purposes; or (b) install the SOFTWARE on a single computer, provided you keep the original solely for backup or archival purposes. Notwithstanding the foregoing, you may not copy the Documentation.

3. General Limitations. You may not reverse engineer, decompile, or disassemble the SOFTWARE, except and only to the extent that applicable law expressly permits such activity notwithstanding this limitation.

4. Software Transfers. You may not rent or lease the SOFTWARE. You may transfer the SOFTWARE to another computer, provided that it is completely removed from the computer from which it was transferred. You may permanently transfer all of your rights under the EULA, provided that you retain no copies, that you transfer all the SOFTWARE (including all component parts, the media and printed materials, any dates, upgrades, this EULA and, if applicable, the Certificate of Authenticity), and that the recipient agrees to the terms and conditions of this EULA as provided herein. If the SOFTWARE is an update or upgrade, any transfer must include all prior versions of the SOFTWARE.

5. Termination. Without prejudice to any other rights it may have, C1 may terminate this EULA and the Licenses if you fail to comply with the terms and conditions contained herein. In such an event, you must destroy all copies of the SOFTWARE and all of its component parts.

6. Export Restrictions. You acknowledge that the SOFTWARE is of U.S. origin. You acknowledge that the license and distribution of the SOFTWARE is subject to the export control laws and regulations of the United States of America, and any amendments thereof, which restrict exports and re-exports of software, technical data, and direct products of technical data, including services and Developed Software. You agree that you will not export or re-export the SOFTWARE or any Developed Software, or any information, documentation and/or printed materials related thereto, directly or indirectly, without first obtaining permission to do so as required from the United States of America Department of Commerce's Bureau of Export Administration ("BXA"), or other appropriate governmental agencies, to any countries, end-users, or for any end-uses that are restricted by U.S. export laws and regulations, and any amendments thereof, which include, but are not limited to, the following:

Restricted Countries: Restricted Countries currently include, but are not necessarily limited to Cuba, Iran, Iraq, Libya, Montenegro, North Korea, Serbia, Sudan, and Syria.

Restricted End-Users: Any End-User whom you know or have reason to know will use SOFTWARE or Developed Software in the design, development, or production of missiles and missile technology, nuclear weapons and weapons technology, or chemical and biological weapons. Any national of any of the Restricted Countries, wherever located, who intends to transmit or transport the SOFTWARE or Developed Software to one of the Restricted Countries.

Restricted End-Uses: Any use of SOFTWARE and Developed Software related to the design, development, or production of missiles and missile technology, nuclear weapons and weapons technology, or chemical and biological weapons.

These restrictions change from time to time. You represent and warrant that neither the BXA nor any other United States federal agency has suspended, revoked or denied your export privileges. C1 acknowledges that it shall use reasonable efforts to supply you with all reasonably necessary information regarding the SOFTWARE and its business to enable you to fully comply with the provisions of this Section. If you have any questions regarding your obligations under United States of America export regulations, you should contact the Bureau of Export Administration, United States Department of Commerce, Exporter Counseling Division, Washington DC. U.S.A. (202) 482-4811, http://www.bxa.doc.gov.

7. U.S. Government Restricted Rights. The SOFTWARE and documentation are provided with RESTRICTED RIGHTS. For solicitations issued before December 1, 1995, by the United States of America, its agencies and/or instrumentalities (the "Government"), other than the Department of Defense, the use, duplication or disclosure of the software and documentation provided to the Government under this EULA shall be subject to the RESTRICTED RIGHTS as set forth in subparagraphs (c)(1) and (2) of the Commercial Computer Software - Restricted Rights clause at 48 CFR ch.1 52.227-19. For solicitations issued before September 29, 1995, by the Department of Defense, the use, duplication or disclosure of the software and documentation provided under this EULA shall be subject to the RESTRICTED RIGHTS as set forth in subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at 48 CFR ch.2 252.227-7013. You will comply with any requirements of the Government to obtain such RESTRICTED RIGHTS protection, including without limitation, the placement of any restrictive legends on the SOFTWARE, and any license agreement used in connection with the distribution of the SOFTWARE. Manufacturer is ComponentOne, LLC, 201 South Highland Avenue, 3rd Floor, Pittsburgh, Pennsylvania 15206 USA. For solicitations issued by the Government on or after December 1, 1995 and the Department of Defense on or after September 29, 1995, the only rights provided in the software and documentation provided herein shall be those contained in this EULA. Under no circumstances shall C1 be obligated to comply with any Governmental requirements regarding the submission of or the request for exemption from submission of cost or pricing data or cost accounting requirements. For any distribution of the SOFTWARE that would require compliance by C1 with the Government's requirements relating to cost or pricing data or cost accounting requirements, you must obtain an appropriate waiver or exemption from such requirements for the benefit of C1 from the appropriate Government authority before the distribution and/or license of the SOFTWARE to the Government.

IV. WARRANTIES AND REMEDIES.

1. Limited Warranty. C1 warrants that the original media, if any, are free from defects for ninety (90) days from the date of delivery of the SOFTWARE. EXCEPT AS OTHERWISE PROVIDED IN THE PRECEDING SENTENCE, AND TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, C1 EXPRESSLY DISCLAIMS ANY WARRANTY FOR THE SOFTWARE, DOCUMENTATION AND ANYTHING ELSE PROVIDED BY C1 HEREBY AND C1 PROVIDES THE SAME IN “AS IS” CONDITION WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE AND DOCUMENTATION REMAINS WITH YOU. THIS LIMITED WARRANTY GIVES YOU SPECIFIC LEGAL RIGHTS. YOU MAY HAVE OTHERS WHICH VARY FROM STATE TO STATE.

2. Limited Remedy. C1's entire liability and your exclusive remedy under this EULA shall be, at C1's sole option, either (a) return of the price paid for the SOFTWARE; (b) repair the SOFTWARE through updates distributed online or otherwise in C1's discretion; or (c) replace the SOFTWARE with SOFTWARE that substantially performs as described in the SOFTWARE documentation, provided that you return the SOFTWARE in the same manner as provided in Section I.2 for return of the SOFTWARE for non-acceptance of this EULA. Any media for any repaired or replacement SOFTWARE will be warranted for the remainder of the original warranty period or thirty (30) days, whichever is longer. THESE REMEDIES ARE NOT AVAILABLE OUTSIDE OF THE UNITED STATES OF AMERICA. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT SHALL C1 BE LIABLE FOR ANY DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFIT, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE, EVEN IF C1 HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. BECAUSE SOME STATES/JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES IN CERTAIN CASES, THE ABOVE LIMITATION MAY NOT APPLY TO YOU.

V. MISCELLANEOUS.

1. This is the Entire Agreement. This EULA (including any addendum or amendment to this EULA included with the SOFTWARE) is the final, complete and exclusive statement of the entire agreement between you and C1 relating to the SOFTWARE. This EULA supersedes any prior and contemporaneous proposals, purchase orders, advertisements, and all other communications in relation to the subject matter of this EULA, whether oral or written. No terms or conditions, other than those contained in this EULA, and no other understanding or agreement which in any way modifies these terms and conditions, shall be binding upon the parties unless entered into in writing executed between the parties, or by other non-oral manner of agreement whereby the parties objectively and definitively act in a manner to be bound (such as by continuing with an installation of the SOFTWARE, "clicking-through" a questionnaire, etc.) Employees, agents and other representatives of C1 are not permitted to orally modify this EULA.

2. You Indemnify C1. . You agree to indemnify, hold harmless, and defend C1 and its suppliers and resellers from and against any and all claims or lawsuits, including attorney's fees, which arise out of or result from your breach of any of the terms and conditions of this EULA.

3. Interpretation of this EULA. If for any reason a court of competent jurisdiction finds any provision of this EULA, or any portion thereof, to be unenforceable, that provision of this EULA will be enforced to the maximum extent permissible so as to effect the intent of the parties, and the remainder of this EULA will continue in full force and effect. Formatives of defined terms shall have the same meaning of the defined term. Failure by either party to enforce any provision of this EULA will not be deemed a waiver of future enforcement of that or any other provision. Except as otherwise required or superseded by law, this EULA is governed by the laws of the Commonwealth of Pennsylvania, without regard to its conflict of laws principles. The parties consent to the personal jurisdiction and venue of the Commonwealth of Pennsylvania, in the County of Allegheny, and agree that any legal proceedings arising out of this EULA shall be conducted solely in such Commonwealth. If the SOFTWARE was acquired outside the United States, then local law may apply.

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Licensing FAQs

Licensing FAQs

This section describes the main technical aspects of licensing. It may help the user to understand and resolve licensing problems he may experience when using ComponentOne .NET and ASP.NET products.

What is Licensing?

How does Licensing Work?

Common Scenarios

Troubleshooting

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


What is Licensing?

What is Licensing?

Licensing is a mechanism used to protect intellectual property by ensuring that users are authorized to use software products. Licensing is not only used to prevent illegal distribution of software products. Many software vendors, including ComponentOne, use licensing to allow potential users to test products before they decide to purchase them.

Without licensing, this type of distribution would not be practical for the vendor or convenient for the user. Vendors would either have to distribute evaluation software with limited functionality, or shift the burden of managing software licenses to customers, who could easily forget that the software being used is an evaluation version and has not been purchased.

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


How does Licensing Work?

How does Licensing Work?

ComponentOne uses a licensing model based on the standard set by Microsoft, which works with all types of components.

NOTE: The Compact Framework components use a slightly different mechanism for licensing than the other ComponentOne components due to platform differences.

When a user decides to purchase a product, he receives an installation program and a Serial Number. During the installation process, the user is prompted for the serial number that is saved on the system. (Users can also enter the serial number by clicking the "License" button on the About Box of any ComponentOne product.)

When a licensed component is added to a form or web page, Visual Studio asks the newly created component for licensing information. The component looks for licensing information stored in the system and generates a key, which Visual Studio saves in two files:

1. a "<projectName>.licenses" resource file which contains the actual key and

2. a "licenses.licx" file that contains references to those resources.

These files are automatically added to the project.

Note that the licenses.licx file is usually not shown in the Solution Explorer; it appears if you press the "Show All Files" button in the Solution Explorer's toolbox, or select "Project | Show All Files" from Visual Studio's main menu.

Later, when the component is created at run time, it gets passed the key that was created at design time and can decide whether to simply accept the key, to throw an exception and fail altogether, or to display some information reminding the user that the software has not been licensed.

All ComponentOne products are designed to display licensing information if the product is not licensed. None will throw licensing exceptions and prevent applications from running.

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Common Scenarios

Common Scenarios

Creating components at design time

Creating components at run time

Inheriting from licensed components

Using licensed components in console applications

Using licensed components in Visual C++ applications

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Creating components at design time

Creating components at design time

This is the most common scenario and also the simplest: the user adds one or more controls to the form, the licensing information is stored in the licenses.licx file, and the component works.

Note that the mechanism is exactly the same for Windows Forms and Web Forms (ASP.NET) projects.

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Creating components at run time

Creating components at run time

This is also a fairly common scenario. You do not need an instance of the component on the form, but would like to create one or more instances at run time.

In this case, the project will not contain a licenses.licx file (or the file will not contain an appropriate key for the component) and therefore licensing will fail.

To fix this problem, add an instance of the component to a form in the project. This will create the licenses.licx file and things will then work as expected. (The component can be removed from the form after the licenses.licx file has been created).

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Inheriting from licensed components

Inheriting from licensed components

If a component that inherits from a licensed component is created, the licensing information to be stored in the form is still needed. This can be done in two ways:

1. Add a LicenseProvider attribute to the component.

This will mark the component as licensed. When a component is added to a form, Visual Studio will create and manage the licenses.licx file, and the base class will handle the licensing process as usual. No additional work is needed. For example:

[LicenseProvider(typeof(LicenseProvider))]

class MyGrid: C1.Win.C1FlexGrid.C1FlexGrid

{

// ...

}

2. Add an instance of the base component to the form.

This will embed the licensing information into the licenses.licx file as in the previous scenario, and the base component will find it and use it. As before, the extra instance can be deleted after the licenses.licx file has been created.

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Using licensed components in console applications

Using licensed components in console applications

When building console applications, there are no forms to add components to, and therefore Visual Studio won't create a licenses.licx file.

In these cases, create a temporary Windows Forms application and add all the desired licensed components to a form. Then close the Windows Forms application and copy the licenses.licx file into the console application project.

Make sure the licensex.licx file is configured as an embedded resource. To do this, right-click the licenses.licx file in the Solution Explorer window and select Properties. In the property window, set the "Build Action" property to "Embedded Resource".

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Using licensed components in Visual C++ applications

Using licensed components in Visual C++ applications

It seems there is a bug in VC++ 2003. The licenses.licx is ignored during the build process, therefore the licensing information is not included in VC++ applications.

To fix this problem, extra steps must be taken to compile the licensing resources and link them to the project. Note the following:

1. Build the C++ project as usual. This should create an exe file and also a licenses.licx file with licensing information in it.

2. Copy the licenses.licx file from the app directory to the target folder (Debug or Release).

3. Copy the C1Lc.exe utility and the licensed dlls to the target folder. (Don't use the standard lc.exe, it has bugs.)

4. Use C1Lc.exe to compile the licenses.licx file. The command line should look like this:

c1lc /target:MyApp.exe /complist:licenses.licx /i:C1.Win.C1FlexGrid.dll

5. Link the licenses into the project. To do this, go back to Visual Studio, right-click the project, select properties, and go to the Linker/Command Line option. Enter the following:

/ASSEMBLYRESOURCE:Debug\MyApp.exe.licenses

6. Rebuild the executable to include the licensing information in the application.

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Troubleshooting

Troubleshooting

We try very hard to make the licensing mechanism as unobtrusive as possible, but problems may occur for a number of reasons.

Below is a description of the most common problems and their solutions.

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


I have a licensed version of a ComponentOne product but I still get the splash screen when I run my project.

I have a licensed version of a ComponentOne product but I still get the splash screen when I run my project.

If this happens, there must be a problem with the licenses.licx file in the project. It either doesn't exist, contains wrong information, or is not configured correctly.

First, try a full rebuild ("Rebuild All" from the Visual Studio Build menu). This will usually rebuild the correct licensing resources.

If that fails, follow these steps:

1. Open the project and go to the Solution Explorer window.

2. Click the "Show All Files" button on the top of the window.

3. Find the licenses.licx file and delete it.

4. Close the project and reopen it.

5. Open the main form and add an instance of each licensed control.

6. Check the Solution Explorer window, there should be a licenses.licx file there.

7. Rebuild the project using the "Rebuild All" option (not just "Rebuild").

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


I have a licensed version of a ComponentOne product on my web server but the components still behave as unlicensed.

I have a licensed version of a ComponentOne product on my web server but the components still behave as unlicensed.

There is no need to install any licenses on machines used as servers and not used for development.

The components must be licensed on the development machine, therefore the licensing information will be saved into the executable (exe or dll) when the project is built. After that, the application can be deployed on any machine, including web servers.

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


I downloaded a new build of a component that I have purchased, and now I'm getting the splash screen when I build my projects.

I downloaded a new build of a component that I have purchased, and now I'm getting the splash screen when I build my projects.

Make sure that the license key is still valid. If you licensed the component over a year ago, your subscription may have expired. In this case, you have two options:

Option 1 - Renew your subscription to get a new license key.

If you choose this option, you will receive a new key that you can use to license the new components (from the installation utility or directly from the About Box).

The new subscription will entitle you to a full year of upgrades and to download the latest maintenance builds directly from http://prerelease.componentone.com/.

Option 2 – Continue to use the components you have.

Subscriptions expire, products do not. You can continue to use the components you received or downloaded while your subscription was valid.

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Technical Support

Technical Support

ComponentOne PDF for .NET is developed and supported by ComponentOne LLC, a company formed by the merger of APEX Software Corporation and VideoSoft. You can obtain technical support using any of the following methods:

ComponentOne Web site

ComponentOne HelpCentral

Internet e-mail

Peer-to-Peer newsgroup

Documentation

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


ComponentOne Web site

ComponentOne Web site

The ComponentOne Web site at www.componentone.com provides a wealth of information and software downloads for ComponentOne PDF for .NET users, including:

· Descriptions of the various support options available through the ComponentOne Service Team.

· Answers to frequently asked questions (FAQ's) about our products, organized by functionality. Please consult the FAQ's before contacting us directly, as this can save you time and also introduce you to other useful information pertaining to our products.

· Free product updates, which provide you with bug fixes and new features.

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


ComponentOne HelpCentral

ComponentOne HelpCentral

ComponentOne HelpCentral is the new online resource for Visual Studio developers and Help authors. Visit HelpCentral to get information on ComponentOne products, view online demos, get Tech Tips and answers to frequently asked questions (FAQ's), search the ComponentOne knowledgebase and more!

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Internet e-mail

Internet e-mail

For technical support through the Internet, e-mail us at:

support.c1pdf.net@componentone.com

To help us provide you with the best support, please include the following information when contacting ComponentOne:

· Your ComponentOne product serial number.

· The version and name of your operating system.

· Your development environment and its version.

For more information on technical support, go to:

www.componentone.com/support

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Peer-to-Peer newsgroup

Peer-to-Peer newsgroup

ComponentOne also sponsors peer-to-peer newsgroups for users. ComponentOne does not offer formal technical support in this newsgroup, but instead sponsors it as a forum for users to post and answer each other's questions regarding our products. However, ComponentOne may monitor the newsgroups to ensure accuracy of information and provide comments when necessary. You can access the newsgroup from the ComponentOne Web site at http://helpcentral.componentone.com/Newsgroups.aspx.

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Documentation

Documentation

ComponentOne documentation is available with each of our products in HTML Help, Microsoft Help 2.0 (.NET, ASP.NET and Mobile Device products only), and PDF format. All of the PDFs are also available on our Web site. If you have suggestions on how we can improve our documentation, please email the Documentation team. Please note that e-mail sent to the Documentation team is for documentation feedback only. Technical Support and Sales issues should be sent directly to their respective departments.

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Redistributable Files

Redistributable Files

ComponentOne PDF for .NET is developed and published by ComponentOne LLC. You may use it to develop applications in conjunction with Microsoft Visual Studio or any other programming environment that enables the user to use and integrate the control(s). You may also distribute, free of royalties, the following Redistributable Files with any such application you develop to the extent that they are used separately on a single CPU on the client/workstation side of the network:

· C1.C1Pdf.dll

Site licenses are available for groups of multiple developers. Please contact Sales@ComponentOne.com for details.

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Namespaces

Namespaces

Namespaces organize the objects defined in an assembly. Assemblies can contain multiple namespaces, which can in turn contain other namespaces. Namespaces prevent ambiguity and simplify references when using large groups of objects such as class libraries.

The general namespace for ComponentOne Windows's products is C1.Win. The namespace for the C1PdfDocument component is C1.C1Pdf. The following code fragment shows how to declare a C1PdfDocument component using the fully qualified name for this class:

· Visual Basic

· C#

· Delphi

Namespaces address a problem sometimes known as namespace pollution, in which the developer of a class library is hampered by the use of similar names in another library. These conflicts with existing components are sometimes called name collisions.

For example, if you create a new class named C1PdfDocument, you can use it inside your project without qualification. However, the C1PDF assembly also implements a class called C1PdfDocument. So, if you want to use the C1PdfDocument class in the same project, you must use a fully qualified reference to make the reference unique. If the reference is not unique, Visual Studio .NET produces an error stating that the name is ambiguous. The following code snippet demonstrates how to declare these objects:

· Visual Basic

· C#

· Delphi

Fully qualified names are object references that are prefixed with the name of the namespace where the object is defined. You can use objects defined in other projects if you create a reference to the class (by choosing Add Reference from the Project menu) and then use the fully qualified name for the object in your code.

Fully qualified names prevent naming conflicts because the compiler can always determine which object is being used. However, the names themselves can get long and cumbersome. To get around this, you can use the Imports statement (using in C#) to define an alias — an abbreviated name you can use in place of a fully qualified name. For example, the following code snippet creates aliases for two fully qualified names, and uses these aliases to define two objects:

· Visual Basic

· C#

· Delphi

If you use the Imports statement without an alias, you can use all the names in that namespace without qualification provided they are unique to the project.

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Creating a .NET Project

Creating a .NET Project

This topic demonstrates how to create a new NET project.

1. From the File menu in .NET, select New and click Project. The New Project dialog box opens.

2. Under Project Types, choose either Visual Basic Projects or Visual C# Projects, and select .NET Windows Application from the list of Templates in the right pane.

3. Enter a name for your new application in the Name field or you can use the default name, WindowsApplication1. Click on the Browse button to the right of the Location field to specify the location of your new project and click OK.

A new Microsoft Visual Studio .NET project is created in the specified location. In addition, a new Form1 is displayed in the Designer view.

4. Double-click the C1PdfDocument component from the Toolbox to add it to Form1. For information on adding a component to the toolbox, see Adding the ComponentOne PDF for .NET Component to the Toolbox.

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Adding the ComponentOne PDF for .NET Component to the Toolbox

Adding the ComponentOne PDF for .NET Component to the Toolbox

When you install ComponentOne PDF for .NET, the following new component will appear in the Visual Studio’s toolbox customization dialog box:

· C1PdfDocument

To use the C1PdfDocument component, open the Visual Studio IDE (Microsoft Development Environment). Make sure the Toolbox is visible (select Toolbox in the View menu if necessary). Right-click the Toolbox to open the toolbox context menu.

If you want C1PdfDocument component to appear on its own tab in the Toolbox, select Add Tab from the context menu and type in the tab name, for example, “C1PDF”.

Select the tab where you want the component to appear. Right-click and select Customize Toolbox… from the context menu. The Customize Toolbox dialog box will open.

In the Customize Toolbox dialog box, go to the .NET Framework Components tab. Sort the list by Namespace (click the Namespace column header) and check the check box for the component belonging to namespace C1.C1Pdf. Note that there may be more than one component for each namespace, but there is only one for C1.C1Pdf.

Select the OK button from the Visual Studio’s toolbox customization dialog box. The C1PdfDocument component will appear in the toolbox under the C1PDF tab. You can add the C1PdfDocument component to your form via drag and drop or by double clicking the C1PdfDocument component.

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Using ComponentOne PDF for .NET

Using ComponentOne PDF for .NET

Creating Documents

Text

Images

Graphics

Pages and Overlays

Bookmarks and Annotations

Security and Permissions

Advanced Topics

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Creating Documents

Creating Documents

To create PDF documents using C1PDF, three steps are required:

1. Create a C1PdfDocument object.

2. Add content to the document. This usually involves calling the DrawString method.

3. Save the document to a file or to a stream using the Save method.

To follow tradition, here's how to create a "hello world" document using C1PDF:

· Visual Basic

· C#

· Delphi

Step 2 is the most interesting one. The code starts by retrieving the page rectangle, expressed in points. It then adds a one-inch margin around the page (72 points). Finally, the code creates a Font object and calls the DrawString method to write "Hello World!" on the page. This is exactly what you would do if you were writing to a Graphics object in .NET, and is what makes C1PDF so easy to use.

One important thing to remember is that C1PDF uses a point-based coordinate system with the origin at the top-left corner of the page. This is similar to the default coordinate system used by .NET, but is different from the default PDF coordinate system (where the origin is on the bottom-left corner of the page).

Because the coordinate system is based on points, rather than pixels, C1PDF uses RectangleF, SizeF, and PointF structures, which have members of type float, rather than Rectangle, Size, and Point, which have members of type int.

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Text

Text

Drawing Text

Measuring Text

Flowing Text

Drawing RTF text

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Drawing Text

Drawing Text

Adding text to C1PDF documents is easy, all the work is done by the DrawString method.

DrawString draws a given string at a specified location using a given font and brush. For example:

· Visual Basic

· C#

· Delphi

By default, DrawString will align the text to the left and to the top of the given rectangle, will wrap the string within the rectangle, and will not clip the output to the rectangle. You can change all these options by specifying a StringFormat parameter in the call to DrawString. The StringFormat has members that allow you to specify the horizontal alignment (Alignment), vertical alignment (LineAligmnent), and flags that control wrapping and clipping (FormatFlags).

For example, the code below creates a StringFormat object and uses it to align the text to the center of the rectangle, both vertically and horizontally:

· Visual Basic

· C#

· Delphi

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Measuring Text

Measuring Text

In many cases, you will need to check whether the string will fit on the page before you render it. You can use the MeasureString method for that. MeasureString returns a SizeF structure that contains the width and height of the string (in points) when rendered with a given font.

For example, the code below checks to see if a paragraph will fit on the current page, and creates a page break if it has to. This will keep paragraphs together on a page:

· Visual Basic

· C#

· Delphi

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Flowing Text

Flowing Text

The DrawString method returns an integer. This is the index of the first character that was not printed because it did not fit the output rectangle. You can use this value make text flow from page to page, or from one frame to another within a page. For example:

· Visual Basic

· C#

· Delphi

By combining the MeasureString and DrawString methods, you can develop rendering routines that provide extensive control over how paragraphs are rendered, including keeping paragraphs together on a page, keeping with the next paragraph, and controlling widows and orphans (single lines that render on the current or next page).

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Drawing RTF text

Drawing RTF text

DrawString provides all the functionality you need for rendering paragraphs using a single font and color.

If you want to render paragraphs with rich format, mixing fonts and colors, you should use the DrawStringRtf method instead. DrawStringRtf is similar to DrawString, except the string is interpreted as RTF.

For example, the code below renders a line of text with some bold and italic characters in it:

· Visual Basic

· C#

· Delphi

Notice that the string does not contain a full RTF document. It has no \rtf1 header, font or color tables. The DrawStringRtf method recognizes that and builds the necessary RTF header automatically, based on the Font and Brush parameters provided.

If the string contained a complete RTF header, that would be used in lieu of the font and brush parameters specified in the call to DrawStringRtf. This would be the case if the string were copied from a RichTextBox control or loaded from an RTF file.

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Images

Images

Adding images to C1PDF documents is also easy, all the work is done by the DrawImage method.

DrawImage draws a given image at a specified location and has parameters that provide control over the image alignment and scaling. For example, the code below draws the same image three times:

1. Stretched to fill the given rectangle,

2. Center-aligned within the rectangle, scaled to keep the aspect ratio, and

3. Aligned to the top-left corner of the rectangle, with the original size.

· Visual Basic

· C#

· Delphi

Notice that you can render any regular .NET Image object, including Metafiles. Metafiles are not converted into bitmaps, they are played into the document and thus retain the best possible resolution. If you want to add charts or technical drawings to your PDF document, Metafiles are better than bitmap images.

Bitmap images are managed automatically by C1PDF. If you render the same image several times (in a page header for example), only one copy of the image is saved into the PDF file. You can control the quality of the images using the ImageQuality property, which allows you to trade-off image quality versus file size.

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Graphics

Graphics

The C1PdfDocument class exposes several methods that allow you to add graphical elements to your documents, including lines, rectangles, ellipses, pies, arcs, rounded rectangles, polygons, Bezier curves, etc.

The methods are a subset of those found in the .NET Graphics class, and use the same Brush and Pen classes to control the color and style of the lines and filled areas.

It is important to remember that C1PDF uses a coordinate system based on points, with the origin located at the top left of the page. (The default coordinate system for the .NET Graphics class is pixel-based).

The example below illustrates how similar the graphics methods are between C1PDF and the.NET Graphics class. The sample declares a C1PdfDocument class called 'g' and calls methods to draw pies, splines, and other graphical elements.

The point of the sample is that if you replaced the C1PdfDocument class with a regular .NET Graphics object, you would be able to compile the code and get the same results:

· Visual Basic

· C#

· Delphi

Here is the resulting PDF document:

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Pages and Overlays

Pages and Overlays

You may have noticed that in the previous examples, we started adding content to the document right after creating the C1PdfDocument object. This is possible because when you create the C1PdfDocument, it automatically adds an empty page to the document, ready to receive any type of content.

When you are done filling up the first page, you can add a new one using the NewPage method.

By default, all pages in the document have the same size and orientation. These parameters can be specified in the C1PdfDocument constructor. You can also change the page size and orientation at any time by setting the PaperKind, PageSize, and Landscape properties. For example, the code below creates a document with all paper sizes defined by the PaperKind enumeration:

· Visual Basic

· C#

· Delphi

You are not restricted to writing on the last page that was added to the document. You can use the CurrentPage property to select which page you want to write to, then use the regular drawing commands as usual. This is useful for adding content to pages after you are done rendering a document. For example, the code below adds footers to each page containing the current page number and the total of pages in the document (page n of m):

· Visual Basic

· C#

· Delphi

Note that the code uses the Pages property to get the page count. Pages is a collection based on the ArrayList class, and has methods that allow you to count and enumerate pages, as well as add and remove pages at specific positions. You can use the Pages collection to remove pages from certain locations in the document and re-insert them elsewhere.

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Bookmarks and Annotations

Bookmarks and Annotations

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Bookmarks

Bookmarks

When you open a PDF document using Adobe's Acrobat Reader application, you will notice that most long documents contain an outline structure that is displayed on a pane on the left of the reader. The outline makes it easy to browse through a document's structure and find specific topics. The picture below shows a PDF document with an outline:

The outline entries are called Bookmarks, and you can add them to your C1PDF documents using the AddBookmark method. The AddBookmark method takes three parameters: the title of the outline entry, the outline level, and the 'y' position of the entry on the current page (measured in points from the top of the page).

For example, the routine below adds a paragraph to a document and optionally marks it as a level-zero outline entry:

· Visual Basic

· C#

· Delphi

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Links

Links

The PDF specification allows you to add several types of annotations to your documents. Annotations are often added by hand, as highlights and notes. But they can also be added programmatically. C1PdfDocument provides methods for adding hyperlinks, hyperlink targets, and file attachments to your PDF documents.

To add a hyperlink to your document, use the AddLink method. AddLink method takes two parameters: a string that specifies a url and a RectangleF that specifies the area on the current page that should behave as a link.

Note that the AddLink method does not add any visible content to the page, so you will usually need another command along with AddLink to specify some text or an image that the user can see. For example, the code below adds a string that says "Visit ComponentOne" and a link that takes the user to the ComponentOne home page:

· Visual Basic

· C#

· Delphi

You can also add local links, that when clicked take the user to another location within the same PDF document. This type of link is useful when you want to implement some type of cross-referencing within the document, such as a table of contents or an index.

Local links are identical to regular hyperlinks, except for two things:

1. The url parameter must start with a "#", and

2. You must specify the target location for the link using the AddTarget method. The AddTarget method takes the same parameters as AddLink, a string that specifies the name of the target and a rectangle that marks the area on the page that will be displayed when the user selects the link.

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Attachments

Attachments

Adding file attachments to PDF files is often a useful feature. Attachments can contain any kind of file, including spreadsheets with detailed information that would clutter the main document, multimedia files with movies and sound, sample code, etc.

Adding file attachments to your C1PDF documents is easy. All you have to do is call the AddAttachment method and specify which file you want to attach, what area of the page should contain the attachment, and optionally, the appearance of the attachment.

For example, the following code attaches all files in the application directory to the PDF document:

· Visual Basic

· C#

· Delphi

Here's what the PDF document looks like in Adobe's Acrobat Reader:

The attachments are displayed as icons (you can select from four predefined icons in the AttachmentIconEnum enumeration and you can also select the icon color). When the use moves the mouse over the attachment, the file name is displayed and the cursor changes to indicate there is an attachment available. The user can then right-click the mouse to open the attachment or save it to a file.

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Security and Permissions

Security and Permissions

By default, anyone can open, copy, print, and edit PDF files. If your PDF documents contain sensitive information, however, you can encrypt them so that only authorized users can access it.

There is a separate password for the owner of the document and for all other users. The user's access can be selectively restricted to allow only certain operations, such as viewing, printing, or editing the document.

C1PDF provides a Security property that returns a PdfSecurity object. This object has properties that allow you to specify the owner password (required to change passwords and permissions for the document) and the user password (required to open the document). Additionally, the PdfSecurity object allows you to specify what permissions a regular user should have. For example you may allow users to see the document but not to print or edit it.

To use the C1PDF security features, simply set the passwords before you save the document. For example:

· Visual Basic

· C#

· Delphi

Note that you can specify permissions and set only the owner password, leaving the user password empty. In this case, anyone will be allowed to open the document, but only the owner will be allowed to change the permissions.

Note also that the encryption scheme used by PDF is public and is not 100% secure. There are ways to crack encrypted PDF documents. The security provided is adequate to protect your documents from most casual attacks, but if your data is truly sensitive you should not rely on PDF encryption alone.

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Advanced Topics

Advanced Topics

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Metafiles

Metafiles

C1PDF makes is very easy to create documents, mainly because the object model mimics the well-known .NET Graphics model. However, not all methods available in the Graphics class are available in C1PDF. Plus, you may have existing code that draws to a Graphics object and that you do not want to rewrite even if most methods are very similar.

In these cases, you can reuse your existing .NET code by sending the drawing commands to a Metafile, then rendering the Metafile into C1PDF using the DrawImage command. This method allows you to expose any graphics you create as images or as PDF documents.

For example, suppose you have an application that generates documents using the PrintDocument pattern of drawing each page into a Graphics object. You could then use the same methods to create a collection of metafiles, one per page, then convert the list into a PDF document using the following code:

· Visual Basic

· C#

· Delphi

The code gets each metafile on the list, calculates its size in points (each page could have a different size), then draws the metafile into the page. The metafiles could be generated by a reporting engine, drawing or charting program, or any application that can create metafile images.

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


RTF

RTF

Another powerful feature of C1PDF is the ability to render RTF text using the DrawStringRtf method. This is an extremely useful feature mainly because there are so many tools for creating RTF, and it's easy to create templates in RTF and have your application customize, then render the RTF strings. This makes it easy to create richly formatted documents practically without writing any code.

For example, the code below uses an RTF template created with WordPad. It scans a directory and builds an RTF string based on the template, then renders the RTF using the DrawStringRtf method.

· Visual Basic

· C#

· Delphi

The code is very simple. The only complicated part is the RTF definition, but that was copied and pasted from an RTF file created with WordPad. The RTF template string contains tags (for example "<<NAME>>") that are then replaced with the actual contents.

When the RTF string is built, it is rendered into the PDF document using the DrawStringRtf command. The result looks like this:

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PDF Samples

C1PDF Samples

Please be advised that this ComponentOne software title is accompanied by various sample projects and/or demos, which may or not make use of other ComponentOne development tools. While the sample projects and/or demos included with the software are used to demonstrate and highlight the product’s features, and how the control may be integrated with the rest of the ComponentOne product line, some of the controls used in the demo/sample project may not be included with the purchase of certain individual products.

The ComponentOne Samples are also available at http://helpcentral.componentone.com/ProductResources.aspx.

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C# Samples

C# Samples

Charts | Creates a PDF document containing charts created with the C1Chart control. The sample creates metafiles for several 2 and 3D charts, then renders the metafiles into a PDF document using the DrawImage method. The charts are rendered as a sequence of graphics commands (they are not translated into bitmaps). As a result, the charts are rendered in a high-quality, resolution-independent way. This sample uses the C1PDFDocument, C1Chart and C1Chart3D controls.
CreatePdf | Creates several PDF documents that show different aspects of the C1Pdf library. This sample uses the C1PdfDocument control.
Metafile | Renders several metafiles into one PDF document. This sample uses the C1PdfDocument control.
Security | Creates a PDF document with password protection and permissions. This sample uses the C1PdfDocument control..

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PDF Task-Based Help

C1PDF Task-Based Help

The task-based help assumes that you are familiar with programming in Visual Basic.NET. By following the steps outlined in the help, you will be able to utilize the features of ComponentOne PDF for .NET.

Print PDF files

Write C1PDF content in web applications

Add C1FlexGrid data into C1PDF

Create a PDF from a report rendered by VSPrinter

Remove PDF bookmarks from a C1Report document

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Print PDF files

Print PDF files

The following code is an example of how to print PDF files.

· Visual Basic

· C#

· Delphi

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Write C1PDF content in web applications

Write C1PDF content in web applications

The following code is an example of how to write C1PDF content directly into a web page's output buffer with no temporary files.

· Visual Basic

· C#

· Delphi

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Add C1FlexGrid data into C1PDF

Add C1FlexGrid data into C1PDF

To add C1FlexGrid data into C1PDF, use C1FlexGrid's CreateImage method and render the images using c1pdf.DrawImage. The images created by the grid are metafiles.

For a complete sample, download the "PdfExport" project from http://helpcentral.componentone.com/ProductResources.aspx.

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Create a PDF from a report rendered by VSPrinter

Create a PDF from a report rendered by VSPrinter

To convert documents created with the VSPrinter ActiveX control to PDF, you can retrieve the page images using the VSPrinter.Picture property, then render the images into C1Pdf using the DrawImage method.

The code below creates a VSPrinter document and then converts it into PDF:

· Visual Basic

· C#

· Delphi

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


Remove PDF bookmarks from a C1Report document

Remove PDF bookmarks from a C1Report document

There are two ways to do this from C1Report. Either set the OutlineRootLevel property to -1 or create a PDF filter and disable the outline. The code below shows both alternatives.

· Visual Basic

· C#

· Delphi

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1.C1Pdf Assembly

C1.C1Pdf Assembly

Namespaces

C1.C1Pdf

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1.C1Pdf Namespace

C1.C1Pdf Namespace

C1.C1Pdf Hierarchy

Classes

Class | Description
C1PdfDocument | Provides methods to create and save Pdf documents.
C1PdfDocumentBase | Provides low-level methods to create and save Pdf documents.
PdfDocumentInfo | Contains information about the document. This information includes the document author, title, keywords, etc.
PdfPage | PdfPage
PdfPageCollection | A collection of PdfPage objects that make up the document.
PdfSecurity | Provides security and encryption services and manages permissions for C1PdfDocument objects.

Enumerations

Enumeration | Description
AttachmentIconEnum | Specifies the type of attachment icon to use.
CompressionEnum | Determines the level of compression used when saving the document.
FontTypeEnum | Determines how fonts are encoded in the document.
ImageQualityEnum | Determines the quality of bitmaps added to the document with the DrawImage (Image, RectangleF, ContentAlignment, ImageSizeModeEnum) method.
ImageSizeModeEnum | Specifies how to render images into a rectangle.

See Also

C1.C1Pdf Assembly

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


AttachmentIconEnum Enumeration

AttachmentIconEnum Enumeration

Specifies the type of attachment icon to use.

[Visual Basic]

Public Enum AttachmentIconEnum

[C#]

public enum AttachmentIconEnum

[Delphi]

type AttachmentIconEnum = (Graph, Paperclip, PushPin, Tag);

Namespace: C1.C1Pdf

Assembly: C1.C1Pdf (in c1.c1pdf.dll)

Members

Member name | Description
Graph | Graph attachment icon.
Paperclip | Paperclip attachment icon.
PushPin | Pushpin attachment icon.
Tag | Tag attachment icon.

See Also

C1.C1Pdf Namespace

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument Class

C1PdfDocument Class

Provides methods to create and save Pdf documents.

For a list of all members of this type, see C1PdfDocument Members.

System.Object

System.MarshalByRefObject

System.ComponentModel.Component

C1.C1Pdf.C1PdfDocumentBase

C1.C1Pdf.C1PdfDocument

[Visual Basic]

Public Class C1PdfDocument

Inherits C1PdfDocumentBase

[C#]

public class C1PdfDocument : C1PdfDocumentBase

[Delphi]

type C1PdfDocument = class (C1PdfDocumentBase);

Remarks

When you create an instance of the C1PdfDocument class, you get a Pdf document with a single blank page. You can then add content to the page using methods similar to those available in the .NET Graphics class (DrawRectangle (Pen, Single, Single, Single, Single), DrawString (String, Font, Brush, RectangleF, StringFormat), etc.).

You can add new pages using the NewPage method, and select the page size using the PaperKind or PageSize properties.

When the document is ready, you can save it to a file or a stream using the Save (String) method.

The coordinate system used by C1PdfDocument is based on points, with the origin located at the top left corner of the page. You can retrieve the page rectangle (measured in points) using the PageRectangle property.

Namespace: C1.C1Pdf

Assembly: C1.C1Pdf (in c1.c1pdf.dll)

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument Members

C1PdfDocument Members

C1PdfDocument overview

Public Constructors

C1PdfDocument Constructor

Creates a new instance of the C1PdfDocument class.

Public Properties

Compression (inherited from C1PdfDocumentBase) | Gets or sets the compression level to use when saving the document.
CurrentPage | Overriden. Gets or sets the index of the current page within the document.
DocumentInfo (inherited from C1PdfDocumentBase) | Gets the PdfDocumentInfo object that contains information about this document (author, etc).
FontType (inherited from C1PdfDocumentBase) | Gets or sets how fonts should be encoded when saving the document.
ImageQuality (inherited from C1PdfDocumentBase) | Gets or sets the image quality to use when saving the document.
Landscape | Gets or sets the default page orientation for the document.
PageRectangle (inherited from C1PdfDocumentBase) | Gets a rectangle that represents the surface of the current page (in points).
Pages (inherited from C1PdfDocumentBase) | Gets the collection of PdfPage objects that make up the document.
PageSize | Overriden. Gets or sets the default page size for the document (in points).
PaperKind | Gets or sets the default page size for the document.
Security (inherited from C1PdfDocumentBase) | Gets the PdfSecurity object that manages security for this document (passwords, etc).

Public Methods

AddAttachment | Overloaded. Adds a file attachment to the current page.
AddBookmark | Adds a bookmark to the current page.
AddLink | Adds a hyperlink to the current page.
AddTarget | Overloaded. Adds a hyperlink target to the current page.
Clear (inherited from C1PdfDocumentBase) | Restores the document to its initial state.
DrawArc | Draws an arc defined by an ellipse specified by a System.Drawing.RectangleF structure and two radial lines.
DrawBezier | Draws a B騷ier spline defined by four System.Drawing.PointF structures.
DrawBeziers | Draws a series of B騷ier splines from an array of System.Drawing.PointF structures.
DrawEllipse | Overloaded. Draws an ellipse defined by a bounding rectangle specified by a System.Drawing.RectangleF structure.
DrawImage | Overloaded. Draws the specified System.Drawing.Image object at the specified location, stretching it to fit the destination rectangle.
DrawLine | Overloaded. Draws a line connecting two System.Drawing.PointF structures.
DrawLines | Draws a series of line segments that connect an array of System.Drawing.PointF structures.
DrawPie | Draws a pie shape defined by an ellipse specified by a System.Drawing.RectangleF structure and two radial lines.
DrawPolygon | Draws a polygon defined by an array of System.Drawing.PointF structures.
DrawRectangle | Overloaded. Draws a rectangle specified by a System.Drawing.RectangleF structure.
DrawString | Overloaded. Draws the specified text string at the specified point with the specified System.Drawing.Brush and System.Drawing.Font objects.
DrawStringRtf | Draws the specified Rtf string in the specified rectangle with the specified System.Drawing.Brush and System.Drawing.Font objects.
FillArc | Fills an arc defined by an ellipse specified by a System.Drawing.RectangleF structure and two radial lines.
FillEllipse | Overloaded. Fills the interior of an ellipse defined by a bounding rectangle specified by a System.Drawing.RectangleF structure.
FillPie | Fills a pie shape defined by an ellipse specified by a System.Drawing.RectangleF structure and two radial lines.
FillPolygon | Overloaded. Fills a polygon defined by an array of System.Drawing.PointF structures.
FillRectangle | Overloaded. Fills the interior of a rectangle specified by a System.Drawing.RectangleF structure.
MeasureString | Overloaded. Measures the specified string when drawn with the specified System.Drawing.Font object.
MeasureStringRtf | Measures the specified Rtf string when drawn with the specified System.Drawing.Font object into a rectangle with the specified width.
NewPage (inherited from C1PdfDocumentBase) | Starts a new page.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument Constructor

C1PdfDocument Constructor

Overload List

Creates a new instance of the C1PdfDocument class.

[Visual Basic] Public Function New()

[C#] public C1PdfDocument();

[Delphi] public constructor Create(); overload;

Creates a new instance of the C1PdfDocument class.

[Visual Basic] Public Function New(PaperKind)

[C#] public C1PdfDocument(PaperKind);

[Delphi] public constructor Create(PaperKind); overload;

Creates a new instance of the C1PdfDocument class.

[Visual Basic] Public Function New(SizeF)

[C#] public C1PdfDocument(SizeF);

[Delphi] public constructor Create(SizeF); overload;

Creates a new instance of the C1PdfDocument class.

[Visual Basic] Public Function New(PaperKind, Boolean)

[C#] public C1PdfDocument(PaperKind, bool);

[Delphi] public constructor Create(PaperKind; Boolean); overload;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument Constructor ()

C1PdfDocument Constructor ()

Creates a new instance of the C1PdfDocument class.

[Visual Basic]

Public Function New()

[C#]

public C1PdfDocument()

[Delphi]

public constructor Create(); overload;

Remarks

The new document contains a single empty page, and the default page size is set to Letter (8.5 x 11 inches).

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument Constructor (PaperKind)

C1PdfDocument Constructor (PaperKind)

Creates a new instance of the C1PdfDocument class.

[Visual Basic]

Public Function New( _

ByVal paperKind As PaperKind _

)

[C#]

public C1PdfDocument(

PaperKind paperKind

);

[Delphi]

public constructor Create(

paperKind: PaperKind

); overload;

Parameters

paperKind

The default paper size for the document.

Remarks

The new document contains a single empty page, and the default page size is set to the value of the paperKind parameter.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument Constructor (SizeF)

C1PdfDocument Constructor (SizeF)

Creates a new instance of the C1PdfDocument class.

[Visual Basic]

Public Function New( _

ByVal pageSizeInPoints As SizeF _

)

[C#]

public C1PdfDocument(

SizeF pageSizeInPoints

);

[Delphi]

public constructor Create(

pageSizeInPoints: SizeF

); overload;

Parameters

pageSizeInPoints

The default paper size for the document, in points.

Remarks

The new document contains a single empty page, and the default page size is set to the value of the pageSizeInPoints parameter.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument Constructor (PaperKind, Boolean)

C1PdfDocument Constructor (PaperKind, Boolean)

Creates a new instance of the C1PdfDocument class.

[Visual Basic]

Public Function New( _

ByVal paperKind As PaperKind, _

ByVal landscape As Boolean _

)

[C#]

public C1PdfDocument(

PaperKind paperKind,

bool landscape

);

[Delphi]

public constructor Create(

paperKind: PaperKind;

landscape: Boolean

); overload;

Parameters

paperKind

The default paper size for the document.

landscape

The default paper orientation for the document.

Remarks

The new document contains a single empty page, and the default page size is set to the value of the paperKind and landscape parameters.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument Properties

C1PdfDocument Properties

The properties of the C1PdfDocument class are listed here. For a complete list of C1PdfDocument class members, see the C1PdfDocument Members topic.

Public Properties

Compression (inherited from C1PdfDocumentBase) | Gets or sets the compression level to use when saving the document.
CurrentPage | Overriden. Gets or sets the index of the current page within the document.
DocumentInfo (inherited from C1PdfDocumentBase) | Gets the PdfDocumentInfo object that contains information about this document (author, etc).
FontType (inherited from C1PdfDocumentBase) | Gets or sets how fonts should be encoded when saving the document.
ImageQuality (inherited from C1PdfDocumentBase) | Gets or sets the image quality to use when saving the document.
Landscape | Gets or sets the default page orientation for the document.
PageRectangle (inherited from C1PdfDocumentBase) | Gets a rectangle that represents the surface of the current page (in points).
Pages (inherited from C1PdfDocumentBase) | Gets the collection of PdfPage objects that make up the document.
PageSize | Overriden. Gets or sets the default page size for the document (in points).
PaperKind | Gets or sets the default page size for the document.
Security (inherited from C1PdfDocumentBase) | Gets the PdfSecurity object that manages security for this document (passwords, etc).

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.CurrentPage Property

C1PdfDocument.CurrentPage Property

Gets or sets the index of the current page within the document.

[Visual Basic]

Overrides Public Property CurrentPage As Integer

[C#]

override public int CurrentPage {get;set;}

[Delphi]

public property CurrentPage: Int32 read get_CurrentPage write set_CurrentPage;

Remarks

The CurrentPage property determines which page of the document should receive the output from the methods that generate content (e.g. DrawString (String, Font, Brush, RectangleF, StringFormat)).

The value is an integer ranging from ・ (no active page) to Pages.System.Collections.ArrayList.Count-1.

You rarely have to use the CurrentPage property while creating a document. When a C1PdfDocument object is created, a blank page is automatically added and becomes the current page, so you can immediately start adding content to it. When the NewPage method is invoked, a new page is added to the document and becomes the current page.

The CurrentPage property is useful when you want to reopen pages that have already been generated and add content to them (for example, page headers and footers).

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.Landscape Property

C1PdfDocument.Landscape Property

Gets or sets the default page orientation for the document.

[Visual Basic]

Public Property Landscape As Boolean

[C#]

public bool Landscape {get;set;}

[Delphi]

public property Landscape: Boolean read get_Landscape write set_Landscape;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.PageSize Property

C1PdfDocument.PageSize Property

Gets or sets the default page size for the document (in points).

[Visual Basic]

Overrides Public Property PageSize As SizeF

[C#]

override public SizeF PageSize {get;set;}

[Delphi]

public property PageSize: SizeF read get_PageSize write set_PageSize;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.PaperKind Property

C1PdfDocument.PaperKind Property

Gets or sets the default page size for the document.

[Visual Basic]

Public Property PaperKind As PaperKind

[C#]

public PaperKind PaperKind {get;set;}

[Delphi]

public property PaperKind: PaperKind read get_PaperKind write set_PaperKind;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument Methods

C1PdfDocument Methods

The methods of the C1PdfDocument class are listed here. For a complete list of C1PdfDocument class members, see the C1PdfDocument Members topic.

Public Methods

AddAttachment | Overloaded. Adds a file attachment to the current page.
AddBookmark | Adds a bookmark to the current page.
AddLink | Adds a hyperlink to the current page.
AddTarget | Overloaded. Adds a hyperlink target to the current page.
Clear (inherited from C1PdfDocumentBase) | Restores the document to its initial state.
DrawArc | Draws an arc defined by an ellipse specified by a System.Drawing.RectangleF structure and two radial lines.
DrawBezier | Draws a B騷ier spline defined by four System.Drawing.PointF structures.
DrawBeziers | Draws a series of B騷ier splines from an array of System.Drawing.PointF structures.
DrawEllipse | Overloaded. Draws an ellipse defined by a bounding rectangle specified by a System.Drawing.RectangleF structure.
DrawImage | Overloaded. Draws the specified System.Drawing.Image object at the specified location, stretching it to fit the destination rectangle.
DrawLine | Overloaded. Draws a line connecting two System.Drawing.PointF structures.
DrawLines | Draws a series of line segments that connect an array of System.Drawing.PointF structures.
DrawPie | Draws a pie shape defined by an ellipse specified by a System.Drawing.RectangleF structure and two radial lines.
DrawPolygon | Draws a polygon defined by an array of System.Drawing.PointF structures.
DrawRectangle | Overloaded. Draws a rectangle specified by a System.Drawing.RectangleF structure.
DrawString | Overloaded. Draws the specified text string at the specified point with the specified System.Drawing.Brush and System.Drawing.Font objects.
DrawStringRtf | Draws the specified Rtf string in the specified rectangle with the specified System.Drawing.Brush and System.Drawing.Font objects.
FillArc | Fills an arc defined by an ellipse specified by a System.Drawing.RectangleF structure and two radial lines.
FillEllipse | Overloaded. Fills the interior of an ellipse defined by a bounding rectangle specified by a System.Drawing.RectangleF structure.
FillPie | Fills a pie shape defined by an ellipse specified by a System.Drawing.RectangleF structure and two radial lines.
FillPolygon | Overloaded. Fills a polygon defined by an array of System.Drawing.PointF structures.
FillRectangle | Overloaded. Fills the interior of a rectangle specified by a System.Drawing.RectangleF structure.
MeasureString | Overloaded. Measures the specified string when drawn with the specified System.Drawing.Font object.
MeasureStringRtf | Measures the specified Rtf string when drawn with the specified System.Drawing.Font object into a rectangle with the specified width.
NewPage (inherited from C1PdfDocumentBase) | Starts a new page.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.AddAttachment Method

C1PdfDocument.AddAttachment Method

Overload List

Adds a file attachment to the current page.

[Visual Basic] Overloads Public Sub AddAttachment(String, RectangleF)

[C#] public AddAttachment(string, RectangleF);

[Delphi] public procedure AddAttachment(String; RectangleF); overload;

Adds a file attachment to the current page.

[Visual Basic] Overloads Public Sub AddAttachment(String, RectangleF, AttachmentIconEnum, Color)

[C#] public AddAttachment(string, RectangleF, AttachmentIconEnum, Color);

[Delphi] public procedure AddAttachment(String; RectangleF; AttachmentIconEnum; Color); overload;

Adds a file attachment to the document.

[Visual Basic] Overloads Public Sub AddAttachment(String, RectangleF, Integer, AttachmentIconEnum, Color)

[C#] public AddAttachment(string, RectangleF, int, AttachmentIconEnum, Color);

[Delphi] public procedure AddAttachment(String; RectangleF; Int32; AttachmentIconEnum; Color); overload;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.AddAttachment Method (String, RectangleF)

C1PdfDocument.AddAttachment Method (String, RectangleF)

Adds a file attachment to the current page.

[Visual Basic]

Overloads Public Sub AddAttachment( _

ByVal fileName As String, _

ByVal rc As RectangleF _

)

[C#]

public void AddAttachment(

string fileName,

RectangleF rc

);

[Delphi]

public procedure AddAttachment(

fileName: String;

rc: RectangleF

); overload;

Parameters

fileName

Name of the file that will be included as an attachment.

rc

Area of the page that will contain the attachment (in points measured from the top-left corner of the page).

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.AddAttachment Method (String, RectangleF, AttachmentIconEnum, Color)

C1PdfDocument.AddAttachment Method (String, RectangleF, AttachmentIconEnum, Color)

Adds a file attachment to the current page.

[Visual Basic]

Overloads Public Sub AddAttachment( _

ByVal fileName As String, _

ByVal rc As RectangleF, _

ByVal icon As AttachmentIconEnum, _

ByVal iconColor As Color _

)

[C#]

public void AddAttachment(

string fileName,

RectangleF rc,

AttachmentIconEnum icon,

Color iconColor

);

[Delphi]

public procedure AddAttachment(

fileName: String;

rc: RectangleF;

icon: AttachmentIconEnum;

iconColor: Color

); overload;

Parameters

fileName

Name of the file that will be included as an attachment.

rc

Area of the page that will contain the attachment (in points measured from the top-left corner of the page).

icon

AttachmentIconEnum value that determines the appearance of the attachment icon.

iconColor

System.Drawing.Color of the attachment icon.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.AddAttachment Method (String, RectangleF, Int32, AttachmentIconEnum, Color)

C1PdfDocument.AddAttachment Method (String, RectangleF, Int32, AttachmentIconEnum, Color)

Adds a file attachment to the document.

[Visual Basic]

Overloads Public Sub AddAttachment( _

ByVal fileName As String, _

ByVal rc As RectangleF, _

ByVal page As Integer, _

ByVal icon As AttachmentIconEnum, _

ByVal iconColor As Color _

)

[C#]

public void AddAttachment(

string fileName,

RectangleF rc,

int page,

AttachmentIconEnum icon,

Color iconColor

);

[Delphi]

public procedure AddAttachment(

fileName: String;

rc: RectangleF;

page: Int32;

icon: AttachmentIconEnum;

iconColor: Color

); overload;

Parameters

fileName

Name of the file that will be included as an attachment.

rc

Area of the page that will contain the attachment (in points measured from the top-left corner of the page).

page

Index of the page that contains the attachment.

icon

AttachmentIconEnum value that determines the appearance of the attachment icon.

iconColor

System.Drawing.Color of the attachment icon.

Remarks

When the user moves the mouse over an area of the page that contains an attachment, the mouse pointer and tool tip change to indicate that the user can retrieve the attachment. The user can right-click the attachment area to open or save the attachment.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.AddBookmark Method

C1PdfDocument.AddBookmark Method

Adds a bookmark to the current page.

[Visual Basic]

Overridable Public Sub AddBookmark( _

ByVal text As String, _

ByVal level As Integer, _

ByVal y As Single _

)

[C#]

virtual public void AddBookmark(

string text,

int level,

Single y

);

[Delphi]

public procedure AddBookmark(

text: String;

level: Int32;

y: Single

); virtual;

Parameters

text

Text that appears on the outline tree.

level

Outline level (zero is the top level).

y

Position on the current page where the outline entry is located (in points).

Remarks

Most long Pdf documents contain an outline structure that is displayed on a pane on the left of the reader. The outline makes it easy to browse through a document's structure and find specific topics. The AddBookmark method allows you to build this outline structure by adding outline entries (bookmarks).

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.AddLink Method

C1PdfDocument.AddLink Method

Adds a hyperlink to the current page.

[Visual Basic]

Public Sub AddLink( _

ByVal url As String, _

ByVal rc As RectangleF _

)

[C#]

public void AddLink(

string url,

RectangleF rc

);

[Delphi]

public procedure AddLink(

url: String;

rc: RectangleF

);

Parameters

url

Link destination (can be a url, a file name, or a local link destination).

rc

Area on the page that will behave as a link (expressed in points, from the top-left corner of the page).

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.AddTarget Method

C1PdfDocument.AddTarget Method

Overload List

Adds a hyperlink target to the document.

[Visual Basic] Overloads Public Sub AddTarget(String, Integer, RectangleF)

[C#] public AddTarget(string, int, RectangleF);

[Delphi] public procedure AddTarget(String; Int32; RectangleF); overload;

Adds a hyperlink target to the current page.

[Visual Basic] Overloads Public Sub AddTarget(String, RectangleF)

[C#] public AddTarget(string, RectangleF);

[Delphi] public procedure AddTarget(String; RectangleF); overload;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.AddTarget Method (String, Int32, RectangleF)

C1PdfDocument.AddTarget Method (String, Int32, RectangleF)

Adds a hyperlink target to the document.

[Visual Basic]

Overloads Public Sub AddTarget( _

ByVal name As String, _

ByVal page As Integer, _

ByVal rc As RectangleF _

)

[C#]

public void AddTarget(

string name,

int page,

RectangleF rc

);

[Delphi]

public procedure AddTarget(

name: String;

page: Int32;

rc: RectangleF

); overload;

Parameters

name

Name of the target (used in the AddLink method).

page

Index of the page that will contain the hyperlink target.

rc

Area on the page that will behave as a target (in points from the top-left corner of the page).

Remarks

This method is used to add targets for local hyperlinks. See the AddLink method for details and an example.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.AddTarget Method (String, RectangleF)

C1PdfDocument.AddTarget Method (String, RectangleF)

Adds a hyperlink target to the current page.

[Visual Basic]

Overloads Public Sub AddTarget( _

ByVal name As String, _

ByVal rc As RectangleF _

)

[C#]

public void AddTarget(

string name,

RectangleF rc

);

[Delphi]

public procedure AddTarget(

name: String;

rc: RectangleF

); overload;

Parameters

name

Name of the target (used in the AddLink method).

rc

Area on the page that will behave as a target (in points from the top-left corner of the page).

Remarks

This method is used to add targets for local hyperlinks. See the AddLink method for details and an example.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.DrawArc Method

C1PdfDocument.DrawArc Method

Draws an arc defined by an ellipse specified by a System.Drawing.RectangleF structure and two radial lines.

[Visual Basic]

Public Sub DrawArc( _

ByVal pen As Pen, _

ByVal rc As RectangleF, _

ByVal startAngle As Single, _

ByVal sweepAngle As Single _

)

[C#]

public void DrawArc(

Pen pen,

RectangleF rc,

Single startAngle,

Single sweepAngle

);

[Delphi]

public procedure DrawArc(

pen: Pen;

rc: RectangleF;

startAngle: Single;

sweepAngle: Single

);

Parameters

pen

System.Drawing.Pen object that determines the color, width, and style of the arc.

rc

System.Drawing.RectangleF structure that represents the bounding rectangle of the ellipse that contains the arc.

startAngle

Angle measured in degrees clockwise from the x-axis to the first side of the pie shape.

sweepAngle

Angle measured in degrees clockwise from the startAngle parameter to the second side of the pie shape.

Remarks

All coordinates are expressed in points, measured from the upper-left corner of the page.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.DrawBezier Method

C1PdfDocument.DrawBezier Method

Draws a B騷ier spline defined by four System.Drawing.PointF structures.

[Visual Basic]

Public Sub DrawBezier( _

ByVal pen As Pen, _

ByVal start As PointF, _

ByVal ctl1 As PointF, _

ByVal ctl2 As PointF, _

ByVal end As PointF _

)

[C#]

public void DrawBezier(

Pen pen,

PointF start,

PointF ctl1,

PointF ctl2,

PointF end

);

[Delphi]

public procedure DrawBezier(

pen: Pen;

start: PointF;

ctl1: PointF;

ctl2: PointF;

end: PointF

);

Parameters

pen

System.Drawing.Pen object that determines the color, width, and style of the B騷ier spline.

start

System.Drawing.PointF structure that represents the starting point of the curve.

ctl1

System.Drawing.PointF structure that represents the first control point for the curve.

ctl2

System.Drawing.PointF structure that represents the second control point for the curve.

end

System.Drawing.PointF structure that represents the ending point of the curve.

Remarks

All coordinates are expressed in points, measured from the upper-left corner of the page.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.DrawBeziers Method

C1PdfDocument.DrawBeziers Method

Draws a series of B騷ier splines from an array of System.Drawing.PointF structures.

[Visual Basic]

Public Sub DrawBeziers( _

ByVal pen As Pen, _

ByVal points As PointF() _

)

[C#]

public void DrawBeziers(

Pen pen,

PointF[] points

);

[Delphi]

public procedure DrawBeziers(

pen: Pen;

points: array of PointF

);

Parameters

pen

System.Drawing.Pen object that determines the color, width, and style of the B騷ier splines.

points

Array of System.Drawing.PointF structures that represent the points that determine the curve.

Remarks

The first spline requires four points, and each additional spline requires three additional points (it starts from the last point in the previous spline). Therefore, the points array must contain at least four points, and the total length minus one must be a multiple of three.

All coordinates are expressed in points, measured from the upper-left corner of the page.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.DrawEllipse Method

C1PdfDocument.DrawEllipse Method

Overload List

Draws an ellipse defined by a bounding rectangle specified by a System.Drawing.RectangleF structure.

[Visual Basic] Overloads Public Sub DrawEllipse(Pen, RectangleF)

[C#] public DrawEllipse(Pen, RectangleF);

[Delphi] public procedure DrawEllipse(Pen; RectangleF); overload;

Draws an ellipse defined by a bounding rectangle specified by a coordinate pair, a width, and a height.

[Visual Basic] Overloads Public Sub DrawEllipse(Pen, Single, Single, Single, Single)

[C#] public DrawEllipse(Pen, Single, Single, Single, Single);

[Delphi] public procedure DrawEllipse(Pen; Single; Single; Single; Single); overload;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.DrawEllipse Method (Pen, RectangleF)

C1PdfDocument.DrawEllipse Method (Pen, RectangleF)

Draws an ellipse defined by a bounding rectangle specified by a System.Drawing.RectangleF structure.

[Visual Basic]

Overloads Public Sub DrawEllipse( _

ByVal pen As Pen, _

ByVal rc As RectangleF _

)

[C#]

public void DrawEllipse(

Pen pen,

RectangleF rc

);

[Delphi]

public procedure DrawEllipse(

pen: Pen;

rc: RectangleF

); overload;

Parameters

pen

System.Drawing.Pen object that determines the color, width, and style of the rectangle.

rc

System.Drawing.RectangleF structure that specifies the bounding rectangle.

Remarks

All coordinates are expressed in points, measured from the upper-left corner of the page.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.DrawEllipse Method (Pen, Single, Single, Single, Single)

C1PdfDocument.DrawEllipse Method (Pen, Single, Single, Single, Single)

Draws an ellipse defined by a bounding rectangle specified by a coordinate pair, a width, and a height.

[Visual Basic]

Overloads Public Sub DrawEllipse( _

ByVal pen As Pen, _

ByVal x As Single, _

ByVal y As Single, _

ByVal width As Single, _

ByVal height As Single _

)

[C#]

public void DrawEllipse(

Pen pen,

Single x,

Single y,

Single width,

Single height

);

[Delphi]

public procedure DrawEllipse(

pen: Pen;

x: Single;

y: Single;

width: Single;

height: Single

); overload;

Parameters

pen

System.Drawing.Pen object that determines the color, width, and style of the ellipse.

x

x-coordinate of the upper-left corner of the bounding rectangle.

y

x-coordinate of the upper-left corner of the bounding rectangle.

width

Width of the bounding rectangle.

height

Height of the bounding rectangle.

Remarks

All coordinates are expressed in points, measured from the upper-left corner of the page.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.DrawImage Method

C1PdfDocument.DrawImage Method

Overload List

Draws the specified System.Drawing.Image object at the specified location, stretching it to fit the destination rectangle.

[Visual Basic] Overloads Public Sub DrawImage(Image, RectangleF)

[C#] public DrawImage(Image, RectangleF);

[Delphi] public procedure DrawImage(Image; RectangleF); overload;

Draws the specified System.Drawing.Image object at the specified location, clipping the output to the given clipping rectangle.

[Visual Basic] Overloads Public Sub DrawImage(Image, RectangleF, RectangleF)

[C#] public DrawImage(Image, RectangleF, RectangleF);

[Delphi] public procedure DrawImage(Image; RectangleF; RectangleF); overload;

Draws the specified System.Drawing.Image object at the specified location, adjusting the image size as specified by the align and mode parameters.

[Visual Basic] Overloads Public Sub DrawImage(Image, RectangleF, ContentAlignment, ImageSizeModeEnum)

[C#] public DrawImage(Image, RectangleF, ContentAlignment, ImageSizeModeEnum);

[Delphi] public procedure DrawImage(Image; RectangleF; ContentAlignment; ImageSizeModeEnum); overload;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.DrawImage Method (Image, RectangleF)

C1PdfDocument.DrawImage Method (Image, RectangleF)

Draws the specified System.Drawing.Image object at the specified location, stretching it to fit the destination rectangle.

[Visual Basic]

Overloads Public Sub DrawImage( _

ByVal img As Image, _

ByVal rc As RectangleF _

)

[C#]

public void DrawImage(

Image img,

RectangleF rc

);

[Delphi]

public procedure DrawImage(

img: Image;

rc: RectangleF

); overload;

Parameters

img

System.Drawing.Image object to draw.

rc

System.Drawing.RectangleF structure that specifies the location of the drawn image, in points from the top left corner of the page.

Remarks

The DrawImage (Image, RectangleF, ContentAlignment, ImageSizeModeEnum) method can be used to render bitmaps and metafiles. When used with metafiles, it enumerates the drawing commands in the metafile and translates them into low-level drawing primitives. This results in resolution-independent images.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.DrawImage Method (Image, RectangleF, RectangleF)

C1PdfDocument.DrawImage Method (Image, RectangleF, RectangleF)

Draws the specified System.Drawing.Image object at the specified location, clipping the output to the given clipping rectangle.

[Visual Basic]

Overloads Public Sub DrawImage( _

ByVal img As Image, _

ByVal rcImage As RectangleF, _

ByVal rcClip As RectangleF _

)

[C#]

public void DrawImage(

Image img,

RectangleF rcImage,

RectangleF rcClip

);

[Delphi]

public procedure DrawImage(

img: Image;

rcImage: RectangleF;

rcClip: RectangleF

); overload;

Parameters

img

System.Drawing.Image object to draw.

rcImage

System.Drawing.RectangleF structure that specifies the location of the drawn image, in points from the top left corner of the page.

rcClip

System.Drawing.RectangleF structure that specifies a clipping rectangle on the page. No part of the image is drawn outside the clipping rectangle.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.DrawImage Method (Image, RectangleF, ContentAlignment, ImageSizeModeEnum)

C1PdfDocument.DrawImage Method (Image, RectangleF, ContentAlignment, ImageSizeModeEnum)

Draws the specified System.Drawing.Image object at the specified location, adjusting the image size as specified by the align and mode parameters.

[Visual Basic]

Overloads Public Sub DrawImage( _

ByVal img As Image, _

ByVal rc As RectangleF, _

ByVal align As ContentAlignment, _

ByVal mode As ImageSizeModeEnum _

)

[C#]

public void DrawImage(

Image img,

RectangleF rc,

ContentAlignment align,

ImageSizeModeEnum mode

);

[Delphi]

public procedure DrawImage(

img: Image;

rc: RectangleF;

align: ContentAlignment;

mode: ImageSizeModeEnum

); overload;

Parameters

img

System.Drawing.Image object to draw.

rc

System.Drawing.RectangleF structure that specifies the location of the drawn image, in points from the top left corner of the page.

align

System.Drawing.ContentAlignment value that specifies how the image should be aligned within the rectangle.

mode

ImageSizeModeEnum value that specifies how the image should be sized to fit the rectangle.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.DrawLine Method

C1PdfDocument.DrawLine Method

Overload List

Draws a line connecting two System.Drawing.PointF structures.

[Visual Basic] Overloads Public Sub DrawLine(Pen, PointF, PointF)

[C#] public DrawLine(Pen, PointF, PointF);

[Delphi] public procedure DrawLine(Pen; PointF; PointF); overload;

Draws a line connecting the two points specified by coordinate pairs.

[Visual Basic] Overloads Public Sub DrawLine(Pen, Single, Single, Single, Single)

[C#] public DrawLine(Pen, Single, Single, Single, Single);

[Delphi] public procedure DrawLine(Pen; Single; Single; Single; Single); overload;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.DrawLine Method (Pen, PointF, PointF)

C1PdfDocument.DrawLine Method (Pen, PointF, PointF)

Draws a line connecting two System.Drawing.PointF structures.

[Visual Basic]

Overloads Public Sub DrawLine( _

ByVal pen As Pen, _

ByVal pt1 As PointF, _

ByVal pt2 As PointF _

)

[C#]

public void DrawLine(

Pen pen,

PointF pt1,

PointF pt2

);

[Delphi]

public procedure DrawLine(

pen: Pen;

pt1: PointF;

pt2: PointF

); overload;

Parameters

pen

System.Drawing.Pen object that determines the color, width, and style of the line.

pt1

The first point.

pt2

The second point.

Remarks

All coordinates are expressed in points, measured from the upper-left corner of the page.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.DrawLine Method (Pen, Single, Single, Single, Single)

C1PdfDocument.DrawLine Method (Pen, Single, Single, Single, Single)

Draws a line connecting the two points specified by coordinate pairs.

[Visual Basic]

Overloads Public Sub DrawLine( _

ByVal pen As Pen, _

ByVal x1 As Single, _

ByVal y1 As Single, _

ByVal x2 As Single, _

ByVal y2 As Single _

)

[C#]

public void DrawLine(

Pen pen,

Single x1,

Single y1,

Single x2,

Single y2

);

[Delphi]

public procedure DrawLine(

pen: Pen;

x1: Single;

y1: Single;

x2: Single;

y2: Single

); overload;

Parameters

pen

System.Drawing.Pen object that determines the color, width, and style of the line.

x1

x-coordinate of the first point.

y1

y-coordinate of the first point.

x2

x-coordinate of the second point.

y2

y-coordinate of the second point.

Remarks

All coordinates are expressed in points, measured from the upper-left corner of the page.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.DrawLines Method

C1PdfDocument.DrawLines Method

Draws a series of line segments that connect an array of System.Drawing.PointF structures.

[Visual Basic]

Public Sub DrawLines( _

ByVal pen As Pen, _

ByVal points As PointF() _

)

[C#]

public void DrawLines(

Pen pen,

PointF[] points

);

[Delphi]

public procedure DrawLines(

pen: Pen;

points: array of PointF

);

Parameters

pen

System.Drawing.Pen object that determines the color, width, and style of the line segments.

points

Array of System.Drawing.PointF structures that represent the points to connect.

Remarks

All coordinates are expressed in points, measured from the upper-left corner of the page.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.DrawPie Method

C1PdfDocument.DrawPie Method

Draws a pie shape defined by an ellipse specified by a System.Drawing.RectangleF structure and two radial lines.

[Visual Basic]

Public Sub DrawPie( _

ByVal pen As Pen, _

ByVal rc As RectangleF, _

ByVal startAngle As Single, _

ByVal sweepAngle As Single _

)

[C#]

public void DrawPie(

Pen pen,

RectangleF rc,

Single startAngle,

Single sweepAngle

);

[Delphi]

public procedure DrawPie(

pen: Pen;

rc: RectangleF;

startAngle: Single;

sweepAngle: Single

);

Parameters

pen

System.Drawing.Pen object that determines the color, width, and style of the pie shape.

rc

System.Drawing.RectangleF structure that represents the bounding rectangle of the ellipse that contains the pie shape.

startAngle

Angle measured in degrees clockwise from the x-axis to the first side of the pie shape.

sweepAngle

Angle measured in degrees clockwise from the startAngle parameter to the second side of the pie shape.

Remarks

All coordinates are expressed in points, measured from the upper-left corner of the page.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.DrawPolygon Method

C1PdfDocument.DrawPolygon Method

Draws a polygon defined by an array of System.Drawing.PointF structures.

[Visual Basic]

Public Sub DrawPolygon( _

ByVal pen As Pen, _

ByVal points As PointF() _

)

[C#]

public void DrawPolygon(

Pen pen,

PointF[] points

);

[Delphi]

public procedure DrawPolygon(

pen: Pen;

points: array of PointF

);

Parameters

pen

System.Drawing.Pen object that determines the color, width, and style of the polygon.

points

Array of System.Drawing.PointF structures that represent the vertices of the polygon.

Remarks

All coordinates are expressed in points, measured from the upper-left corner of the page.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.DrawRectangle Method

C1PdfDocument.DrawRectangle Method

Overload List

Draws a rectangle specified by a System.Drawing.RectangleF structure.

[Visual Basic] Overloads Public Sub DrawRectangle(Pen, RectangleF)

[C#] public DrawRectangle(Pen, RectangleF);

[Delphi] public procedure DrawRectangle(Pen; RectangleF); overload;

Draws a rounded rectangle specified by System.Drawing.RectangleF and System.Drawing.SizeF structures.

[Visual Basic] Overloads Public Sub DrawRectangle(Pen, RectangleF, SizeF)

[C#] public DrawRectangle(Pen, RectangleF, SizeF);

[Delphi] public procedure DrawRectangle(Pen; RectangleF; SizeF); overload;

Draws a rectangle specified by a coordinate pair, a width, and a height.

[Visual Basic] Overloads Public Sub DrawRectangle(Pen, Single, Single, Single, Single)

[C#] public DrawRectangle(Pen, Single, Single, Single, Single);

[Delphi] public procedure DrawRectangle(Pen; Single; Single; Single; Single); overload;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.DrawRectangle Method (Pen, RectangleF)

C1PdfDocument.DrawRectangle Method (Pen, RectangleF)

Draws a rectangle specified by a System.Drawing.RectangleF structure.

[Visual Basic]

Overloads Public Sub DrawRectangle( _

ByVal pen As Pen, _

ByVal rc As RectangleF _

)

[C#]

public void DrawRectangle(

Pen pen,

RectangleF rc

);

[Delphi]

public procedure DrawRectangle(

pen: Pen;

rc: RectangleF

); overload;

Parameters

pen

System.Drawing.Pen object that determines the color, width, and style of the rectangle.

rc

A System.Drawing.RectangleF structure that represents the rectangle to draw.

Remarks

All coordinates are expressed in points, measured from the upper-left corner of the page.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.DrawRectangle Method (Pen, RectangleF, SizeF)

C1PdfDocument.DrawRectangle Method (Pen, RectangleF, SizeF)

Draws a rounded rectangle specified by System.Drawing.RectangleF and System.Drawing.SizeF structures.

[Visual Basic]

Overloads Public Sub DrawRectangle( _

ByVal pen As Pen, _

ByVal rc As RectangleF, _

ByVal corners As SizeF _

)

[C#]

public void DrawRectangle(

Pen pen,

RectangleF rc,

SizeF corners

);

[Delphi]

public procedure DrawRectangle(

pen: Pen;

rc: RectangleF;

corners: SizeF

); overload;

Parameters

pen

System.Drawing.Pen object that determines the color, width, and style of the rectangle.

rc

A System.Drawing.RectangleF structure that represents the rectangle to draw.

corners

A System.Drawing.SizeF structure that contains the radius of the rectangle corners.

Remarks

All coordinates are expressed in points, measured from the upper-left corner of the page.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.DrawRectangle Method (Pen, Single, Single, Single, Single)

C1PdfDocument.DrawRectangle Method (Pen, Single, Single, Single, Single)

Draws a rectangle specified by a coordinate pair, a width, and a height.

[Visual Basic]

Overloads Public Sub DrawRectangle( _

ByVal pen As Pen, _

ByVal x As Single, _

ByVal y As Single, _

ByVal width As Single, _

ByVal height As Single _

)

[C#]

public void DrawRectangle(

Pen pen,

Single x,

Single y,

Single width,

Single height

);

[Delphi]

public procedure DrawRectangle(

pen: Pen;

x: Single;

y: Single;

width: Single;

height: Single

); overload;

Parameters

pen

System.Drawing.Pen object that determines the color, width, and style of the rectangle.

x

x-coordinate of the upper-left corner of the rectangle to draw.

y

x-coordinate of the upper-left corner of the rectangle to draw.

width

Width of the rectangle to draw.

height

Height of the rectangle to draw.

Remarks

All coordinates are expressed in points, measured from the upper-left corner of the page.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.DrawString Method

C1PdfDocument.DrawString Method

Overload List

Draws the specified text string at the specified point with the specified System.Drawing.Brush and System.Drawing.Font objects.

[Visual Basic] Overloads Public Function DrawString(String, Font, Brush, PointF) As Integer

[C#] public int DrawString(string, Font, Brush, PointF);

[Delphi] public function DrawString(String; Font; Brush; PointF) : Int32; overload;

Draws the specified text string in the specified rectangle with the specified System.Drawing.Brush and System.Drawing.Font objects.

[Visual Basic] Overloads Public Function DrawString(String, Font, Brush, RectangleF) As Integer

[C#] public int DrawString(string, Font, Brush, RectangleF);

[Delphi] public function DrawString(String; Font; Brush; RectangleF) : Int32; overload;

Draws the specified text string at the specified point with the specified System.Drawing.Brush and System.Drawing.Font objects using the formatting attributes of the specified System.Drawing.StringFormat object.

[Visual Basic] Overloads Public Function DrawString(String, Font, Brush, PointF, StringFormat) As Integer

[C#] public int DrawString(string, Font, Brush, PointF, StringFormat);

[Delphi] public function DrawString(String; Font; Brush; PointF; StringFormat) : Int32; overload;

Draws the specified text string in the specified rectangle with the specified System.Drawing.Brush and System.Drawing.Font objects using the formatting attributes of the specified System.Drawing.StringFormat object.

[Visual Basic] Overloads Public Function DrawString(String, Font, Brush, RectangleF, StringFormat) As Integer

[C#] public int DrawString(string, Font, Brush, RectangleF, StringFormat);

[Delphi] public function DrawString(String; Font; Brush; RectangleF; StringFormat) : Int32; overload;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.DrawString Method (String, Font, Brush, PointF)

C1PdfDocument.DrawString Method (String, Font, Brush, PointF)

Draws the specified text string at the specified point with the specified System.Drawing.Brush and System.Drawing.Font objects.

[Visual Basic]

Overloads Public Function DrawString( _

ByVal text As String, _

ByVal font As Font, _

ByVal brush As Brush, _

ByVal pt As PointF _

) As Integer

[C#]

public int DrawString(

string text,

Font font,

Brush brush,

PointF pt

);

[Delphi]

public function DrawString(

text: String;

font: Font;

brush: Brush;

pt: PointF

): Int32; overload;

Parameters

text

String to draw.

font

System.Drawing.Font object that defines the appearance and size of the drawn text.

brush

System.Drawing.Brush object that defines the color of the drawn text.

pt

System.Drawing.PointF structure that specifies the location of the drawn text, in points

from the top left corner of the page.

Return Value

The index of first character that was not printed because it did not fit in the specified rectangle.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.DrawString Method (String, Font, Brush, RectangleF)

C1PdfDocument.DrawString Method (String, Font, Brush, RectangleF)

Draws the specified text string in the specified rectangle with the specified System.Drawing.Brush and System.Drawing.Font objects.

[Visual Basic]

Overloads Public Function DrawString( _

ByVal text As String, _

ByVal font As Font, _

ByVal brush As Brush, _

ByVal rc As RectangleF _

) As Integer

[C#]

public int DrawString(

string text,

Font font,

Brush brush,

RectangleF rc

);

[Delphi]

public function DrawString(

text: String;

font: Font;

brush: Brush;

rc: RectangleF

): Int32; overload;

Parameters

text

String to draw.

font

System.Drawing.Font object that defines the appearance and size of the drawn text.

brush

System.Drawing.Brush object that defines the color of the drawn text.

rc

System.Drawing.RectangleF structure that specifies the location of the drawn text,

in points from the top left corner of the page.

Return Value

The index of first character that was not printed because it did not fit in the specified rectangle.

Remarks

This overload renders strings aligned to the top left corner of the specified rectangle, wrapping text as needed within the rectangle, without clipping, and in the horizontal direction. To change any of these defaults, use the overload that allows you to specify a System.Drawing.StringFormat parameter.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.DrawString Method (String, Font, Brush, PointF, StringFormat)

C1PdfDocument.DrawString Method (String, Font, Brush, PointF, StringFormat)

Draws the specified text string at the specified point with the specified System.Drawing.Brush and System.Drawing.Font objects using the formatting attributes of the specified System.Drawing.StringFormat object.

[Visual Basic]

Overloads Public Function DrawString( _

ByVal text As String, _

ByVal font As Font, _

ByVal brush As Brush, _

ByVal pt As PointF, _

ByVal sf As StringFormat _

) As Integer

[C#]

public int DrawString(

string text,

Font font,

Brush brush,

PointF pt,

StringFormat sf

);

[Delphi]

public function DrawString(

text: String;

font: Font;

brush: Brush;

pt: PointF;

sf: StringFormat

): Int32; overload;

Parameters

text

String to draw.

font

System.Drawing.Font object that defines the appearance and size of the drawn text.

brush

System.Drawing.Brush object that defines the color of the drawn text.

pt

System.Drawing.PointF structure that specifies the location of the drawn text, in points

from the top left corner of the page.

sf

Return Value

The index of first character that was not printed because it did not fit in the specified rectangle.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.DrawString Method (String, Font, Brush, RectangleF, StringFormat)

C1PdfDocument.DrawString Method (String, Font, Brush, RectangleF, StringFormat)

Draws the specified text string in the specified rectangle with the specified System.Drawing.Brush and System.Drawing.Font objects using the formatting attributes of the specified System.Drawing.StringFormat object.

[Visual Basic]

Overloads Public Function DrawString( _

ByVal text As String, _

ByVal font As Font, _

ByVal brush As Brush, _

ByVal rc As RectangleF, _

ByVal sf As StringFormat _

) As Integer

[C#]

public int DrawString(

string text,

Font font,

Brush brush,

RectangleF rc,

StringFormat sf

);

[Delphi]

public function DrawString(

text: String;

font: Font;

brush: Brush;

rc: RectangleF;

sf: StringFormat

): Int32; overload;

Parameters

text

String to draw.

font

System.Drawing.Font object that defines the appearance and size of the drawn text.

brush

System.Drawing.Brush object that defines the color of the drawn text.

rc

System.Drawing.RectangleF structure that specifies the location of the drawn text, in points from the top left corner of the page.

sf

System.Drawing.StringFormat object that specifies formatting attributes applied to the drawn text.

Return Value

The index of first character that was not printed because it did not fit in the specified rectangle.

Remarks

The sf contains properties that specify formatting options. Use the System.Drawing.StringFormat.Alignment property to specify horizontal alignment and the System.Drawing.StringFormat.LineAlignment property to specify vertical alignment.

Use the System.Drawing.StringFormat.FormatFlags property to specify clipping and wrapping.

To render text in the vertical direction, use the System.Drawing.StringFormatFlags.DirectionVertical. By itself, this flag will cause text to render from the bottom to the top of the rectangle. Combined with the System.Drawing.StringFormatFlags.DirectionRightToLeft flags, it will cause text to render from the top to the bottom of the rectangle.

The DrawString (String, Font, Brush, RectangleF, StringFormat) method returns the index of the first character that was not printed because it did not fit the output rectangle. You can use this value make text flow from page to page, or from one frame to another within a page.

Example

The code below renders a long string into several pages, using the return value from the DrawString (String, Font, Brush, RectangleF, StringFormat) method to determine where to continue printing.

// render string spanning multiple pages

for (;;)

{

// render as much as will fit into the rectangle

int nextChar = _c1pdf.DrawString(text, font,

Brushes.Black, rcPage);

// break when done

if (nextChar >= text.Length)

break;

// get rid of the part that was rendered

text = text.Substring(nextChar);

// move on to the next page

_c1pdf.NewPage();

}

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.DrawStringRtf Method

C1PdfDocument.DrawStringRtf Method

Draws the specified Rtf string in the specified rectangle with the specified System.Drawing.Brush and System.Drawing.Font objects.

[Visual Basic]

Public Sub DrawStringRtf( _

ByVal text As String, _

ByVal font As Font, _

ByVal brush As Brush, _

ByVal rc As RectangleF _

)

[C#]

public void DrawStringRtf(

string text,

Font font,

Brush brush,

RectangleF rc

);

[Delphi]

public procedure DrawStringRtf(

text: String;

font: Font;

brush: Brush;

rc: RectangleF

);

Parameters

text

Rtf string to draw.

font

System.Drawing.Font object that defines the appearance and size of the drawn text.

brush

System.Drawing.Brush object that defines the color of the drawn text.

rc

System.Drawing.RectangleF structure that specifies the location of the drawn text, in points from the top left corner of the page.

Remarks

This method is similar to MeasureString (String, Font, Single, StringFormat), except it recognizes Rtf (Rich Text Format) strings like those used in the System.Windows.Forms.RichTextBox control.

There are two types of Rtf string:

1) Complete Rtf strings contain an Rtf header that specifies the fonts and colors used within the string. These strings can be obtained from a System.Windows.Forms.RichTextBox control using the System.Windows.Forms.RichTextBox.Rtf property, or from Rtf files saved to disk. In this case, the font and brush parameters are not used.

2) Partial Rtf strings contain embedded Rtf tags but no Rtf header. These strings are easy to build in code and can be used to render text with special attributes such as bold and italics (for example: "this text contains {\b BOLD} and {\i ITALICS}". In this case, the font and brush parameters are used to build the Rtf header automatically.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.FillArc Method

C1PdfDocument.FillArc Method

Fills an arc defined by an ellipse specified by a System.Drawing.RectangleF structure and two radial lines.

[Visual Basic]

Public Sub FillArc( _

ByVal brush As Brush, _

ByVal rc As RectangleF, _

ByVal startAngle As Single, _

ByVal sweepAngle As Single _

)

[C#]

public void FillArc(

Brush brush,

RectangleF rc,

Single startAngle,

Single sweepAngle

);

[Delphi]

public procedure FillArc(

brush: Brush;

rc: RectangleF;

startAngle: Single;

sweepAngle: Single

);

Parameters

brush

System.Drawing.Brush object that determines the color used to fill the arc.

rc

System.Drawing.RectangleF structure that represents the bounding rectangle of the ellipse that contains the pie shape.

startAngle

Angle measured in degrees clockwise from the x-axis to the first side of the pie shape.

sweepAngle

Angle measured in degrees clockwise from the startAngle parameter to the second side of the pie shape.

Remarks

All coordinates are expressed in points, measured from the upper-left corner of the page.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.FillEllipse Method

C1PdfDocument.FillEllipse Method

Overload List

Fills the interior of an ellipse defined by a bounding rectangle specified by a System.Drawing.RectangleF structure.

[Visual Basic] Overloads Public Sub FillEllipse(Brush, RectangleF)

[C#] public FillEllipse(Brush, RectangleF);

[Delphi] public procedure FillEllipse(Brush; RectangleF); overload;

Fills the interior of an ellipse defined by a bounding rectangle specified by a coordinate pair, a width, and a height.

[Visual Basic] Overloads Public Sub FillEllipse(Brush, Single, Single, Single, Single)

[C#] public FillEllipse(Brush, Single, Single, Single, Single);

[Delphi] public procedure FillEllipse(Brush; Single; Single; Single; Single); overload;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.FillEllipse Method (Brush, RectangleF)

C1PdfDocument.FillEllipse Method (Brush, RectangleF)

Fills the interior of an ellipse defined by a bounding rectangle specified by a System.Drawing.RectangleF structure.

[Visual Basic]

Overloads Public Sub FillEllipse( _

ByVal brush As Brush, _

ByVal rc As RectangleF _

)

[C#]

public void FillEllipse(

Brush brush,

RectangleF rc

);

[Delphi]

public procedure FillEllipse(

brush: Brush;

rc: RectangleF

); overload;

Parameters

brush

System.Drawing.Brush object that determines the color used to fill the ellipse.

rc

System.Drawing.RectangleF structure that specifies the bounding rectangle.

Remarks

All coordinates are expressed in points, measured from the upper-left corner of the page.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.FillEllipse Method (Brush, Single, Single, Single, Single)

C1PdfDocument.FillEllipse Method (Brush, Single, Single, Single, Single)

Fills the interior of an ellipse defined by a bounding rectangle specified by a coordinate pair, a width, and a height.

[Visual Basic]

Overloads Public Sub FillEllipse( _

ByVal brush As Brush, _

ByVal x As Single, _

ByVal y As Single, _

ByVal width As Single, _

ByVal height As Single _

)

[C#]

public void FillEllipse(

Brush brush,

Single x,

Single y,

Single width,

Single height

);

[Delphi]

public procedure FillEllipse(

brush: Brush;

x: Single;

y: Single;

width: Single;

height: Single

); overload;

Parameters

brush

System.Drawing.Brush object that determines the color used to fill the ellipse.

x

x-coordinate of the upper-left corner of the bounding rectangle.

y

x-coordinate of the upper-left corner of the bounding rectangle.

width

Width of the bounding rectangle.

height

Height of the bounding rectangle.

Remarks

All coordinates are expressed in points, measured from the upper-left corner of the page.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.FillPie Method

C1PdfDocument.FillPie Method

Fills a pie shape defined by an ellipse specified by a System.Drawing.RectangleF structure and two radial lines.

[Visual Basic]

Public Sub FillPie( _

ByVal brush As Brush, _

ByVal rc As RectangleF, _

ByVal startAngle As Single, _

ByVal sweepAngle As Single _

)

[C#]

public void FillPie(

Brush brush,

RectangleF rc,

Single startAngle,

Single sweepAngle

);

[Delphi]

public procedure FillPie(

brush: Brush;

rc: RectangleF;

startAngle: Single;

sweepAngle: Single

);

Parameters

brush

System.Drawing.Brush object that determines the color used to fill the pie shape.

rc

System.Drawing.RectangleF structure that represents the bounding rectangle of the ellipse that contains the pie shape.

startAngle

Angle measured in degrees clockwise from the x-axis to the first side of the pie shape.

sweepAngle

Angle measured in degrees clockwise from the startAngle parameter to the second side of the pie shape.

Remarks

All coordinates are expressed in points, measured from the upper-left corner of the page.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.FillPolygon Method

C1PdfDocument.FillPolygon Method

Overload List

Fills a polygon defined by an array of System.Drawing.PointF structures.

[Visual Basic] Overloads Public Sub FillPolygon(Brush, PointF())

[C#] public FillPolygon(Brush, PointF[]);

[Delphi] public procedure FillPolygon(Brush; array of PointF); overload;

Fills a polygon defined by an array of System.Drawing.PointF structures using the specified fill mode.

[Visual Basic] Overloads Public Sub FillPolygon(Brush, PointF(), FillMode)

[C#] public FillPolygon(Brush, PointF[], FillMode);

[Delphi] public procedure FillPolygon(Brush; array of PointF; FillMode); overload;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.FillPolygon Method (Brush, PointF[][])

C1PdfDocument.FillPolygon Method (Brush, PointF[][])

Fills a polygon defined by an array of System.Drawing.PointF structures.

[Visual Basic]

Overloads Public Sub FillPolygon( _

ByVal brush As Brush, _

ByVal points As PointF() _

)

[C#]

public void FillPolygon(

Brush brush,

PointF[] points

);

[Delphi]

public procedure FillPolygon(

brush: Brush;

points: array of PointF

); overload;

Parameters

brush

System.Drawing.Brush object that determines the color used to fill the polygon.

points

Array of System.Drawing.PointF structures that represent the vertices of the polygon.

Remarks

All coordinates are expressed in points, measured from the upper-left corner of the page.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.FillPolygon Method (Brush, PointF[][], FillMode)

C1PdfDocument.FillPolygon Method (Brush, PointF[][], FillMode)

Fills a polygon defined by an array of System.Drawing.PointF structures using the specified fill mode.

[Visual Basic]

Overloads Public Sub FillPolygon( _

ByVal brush As Brush, _

ByVal points As PointF(), _

ByVal fillMode As FillMode _

)

[C#]

public void FillPolygon(

Brush brush,

PointF[] points,

FillMode fillMode

);

[Delphi]

public procedure FillPolygon(

brush: Brush;

points: array of PointF;

fillMode: FillMode

); overload;

Parameters

brush

System.Drawing.Brush object that determines the color used to fill the polygon.

points

Array of System.Drawing.PointF structures that represent the vertices of the polygon.

fillMode

System.Drawing.Drawing2D.FillMode parameter that determines how to handle overlapping areas within the polygon.

Remarks

All coordinates are expressed in points, measured from the upper-left corner of the page.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.FillRectangle Method

C1PdfDocument.FillRectangle Method

Overload List

Fills the interior of a rectangle specified by a System.Drawing.RectangleF structure.

[Visual Basic] Overloads Public Sub FillRectangle(Brush, RectangleF)

[C#] public FillRectangle(Brush, RectangleF);

[Delphi] public procedure FillRectangle(Brush; RectangleF); overload;

Fills the interior of a rounded rectangle specified by System.Drawing.RectangleF and System.Drawing.SizeF structures.

[Visual Basic] Overloads Public Sub FillRectangle(Brush, RectangleF, SizeF)

[C#] public FillRectangle(Brush, RectangleF, SizeF);

[Delphi] public procedure FillRectangle(Brush; RectangleF; SizeF); overload;

Fills the interior of a rectangle specified by a coordinate pair, a width, and a height.

[Visual Basic] Overloads Public Sub FillRectangle(Brush, Single, Single, Single, Single)

[C#] public FillRectangle(Brush, Single, Single, Single, Single);

[Delphi] public procedure FillRectangle(Brush; Single; Single; Single; Single); overload;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.FillRectangle Method (Brush, RectangleF)

C1PdfDocument.FillRectangle Method (Brush, RectangleF)

Fills the interior of a rectangle specified by a System.Drawing.RectangleF structure.

[Visual Basic]

Overloads Public Sub FillRectangle( _

ByVal brush As Brush, _

ByVal rc As RectangleF _

)

[C#]

public void FillRectangle(

Brush brush,

RectangleF rc

);

[Delphi]

public procedure FillRectangle(

brush: Brush;

rc: RectangleF

); overload;

Parameters

brush

System.Drawing.Brush object that determines the color used to fill the rectangle.

rc

A System.Drawing.RectangleF structure that represents the rectangle to fill.

Remarks

All coordinates are expressed in points, measured from the upper-left corner of the page.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.FillRectangle Method (Brush, RectangleF, SizeF)

C1PdfDocument.FillRectangle Method (Brush, RectangleF, SizeF)

Fills the interior of a rounded rectangle specified by System.Drawing.RectangleF and System.Drawing.SizeF structures.

[Visual Basic]

Overloads Public Sub FillRectangle( _

ByVal brush As Brush, _

ByVal rc As RectangleF, _

ByVal corners As SizeF _

)

[C#]

public void FillRectangle(

Brush brush,

RectangleF rc,

SizeF corners

);

[Delphi]

public procedure FillRectangle(

brush: Brush;

rc: RectangleF;

corners: SizeF

); overload;

Parameters

brush

System.Drawing.Brush object that determines the color used to fill the rectangle.

rc

A System.Drawing.RectangleF structure that represents the rectangle to fill.

corners

A System.Drawing.SizeF structure that contains the radius of the rectangle corners.

Remarks

All coordinates are expressed in points, measured from the upper-left corner of the page.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.FillRectangle Method (Brush, Single, Single, Single, Single)

C1PdfDocument.FillRectangle Method (Brush, Single, Single, Single, Single)

Fills the interior of a rectangle specified by a coordinate pair, a width, and a height.

[Visual Basic]

Overloads Public Sub FillRectangle( _

ByVal brush As Brush, _

ByVal x As Single, _

ByVal y As Single, _

ByVal width As Single, _

ByVal height As Single _

)

[C#]

public void FillRectangle(

Brush brush,

Single x,

Single y,

Single width,

Single height

);

[Delphi]

public procedure FillRectangle(

brush: Brush;

x: Single;

y: Single;

width: Single;

height: Single

); overload;

Parameters

brush

System.Drawing.Brush object that determines the color used to fill the rectangle.

x

x-coordinate of the upper-left corner of the rectangle to fill.

y

x-coordinate of the upper-left corner of the rectangle to fill.

width

Width of the rectangle to fill.

height

Height of the rectangle to fill.

Remarks

All coordinates are expressed in points, measured from the upper-left corner of the page.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.MeasureString Method

C1PdfDocument.MeasureString Method

Overload List

Measures the specified string when drawn with the specified System.Drawing.Font object.

[Visual Basic] Overloads Public Function MeasureString(String, Font) As SizeF

[C#] public SizeF MeasureString(string, Font);

[Delphi] public function MeasureString(String; Font) : SizeF; overload;

Measures the specified string when drawn with the specified System.Drawing.Font object into a rectangle with the specified width.

[Visual Basic] Overloads Public Function MeasureString(String, Font, Single) As SizeF

[C#] public SizeF MeasureString(string, Font, Single);

[Delphi] public function MeasureString(String; Font; Single) : SizeF; overload;

Measures the specified string when drawn with the specified System.Drawing.Font object and formatted with the specified System.Drawing.StringFormat object.

[Visual Basic] Overloads Public Function MeasureString(String, Font, Single, StringFormat) As SizeF

[C#] public SizeF MeasureString(string, Font, Single, StringFormat);

[Delphi] public function MeasureString(String; Font; Single; StringFormat) : SizeF; overload;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.MeasureString Method (String, Font)

C1PdfDocument.MeasureString Method (String, Font)

Measures the specified string when drawn with the specified System.Drawing.Font object.

[Visual Basic]

Overloads Public Function MeasureString( _

ByVal text As String, _

ByVal font As Font _

) As SizeF

[C#]

public SizeF MeasureString(

string text,

Font font

);

[Delphi]

public function MeasureString(

text: String;

font: Font

): SizeF; overload;

Parameters

text

String to measure.

font

System.Drawing.Font object that defines the appearance and size of the text.

Return Value

The size of the string expressed in points.

Remarks

This overload returns the width and height of the string without wrapping. Unless the text parameter contains line break characters, the height returned corresponds to the font height.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.MeasureString Method (String, Font, Single)

C1PdfDocument.MeasureString Method (String, Font, Single)

Measures the specified string when drawn with the specified System.Drawing.Font object into a rectangle with the specified width.

[Visual Basic]

Overloads Public Function MeasureString( _

ByVal text As String, _

ByVal font As Font, _

ByVal width As Single _

) As SizeF

[C#]

public SizeF MeasureString(

string text,

Font font,

Single width

);

[Delphi]

public function MeasureString(

text: String;

font: Font;

width: Single

): SizeF; overload;

Parameters

text

String to measure.

font

System.Drawing.Font object that defines the appearance and size of the text.

width

Maximum width of the string.

Return Value

The size of the string expressed in points.

Remarks

This overload wraps the string to prevent any lines from getting wider than the width parameter. The value returned contains the given width and the height needed to render the entire string.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.MeasureString Method (String, Font, Single, StringFormat)

C1PdfDocument.MeasureString Method (String, Font, Single, StringFormat)

Measures the specified string when drawn with the specified System.Drawing.Font object and formatted with the specified System.Drawing.StringFormat object.

[Visual Basic]

Overloads Public Function MeasureString( _

ByVal text As String, _

ByVal font As Font, _

ByVal width As Single, _

ByVal sf As StringFormat _

) As SizeF

[C#]

public SizeF MeasureString(

string text,

Font font,

Single width,

StringFormat sf

);

[Delphi]

public function MeasureString(

text: String;

font: Font;

width: Single;

sf: StringFormat

): SizeF; overload;

Parameters

text

String to measure.

font

System.Drawing.Font object that defines the appearance and size of the text.

width

Maximum width of the string.

sf

A System.Drawing.StringFormat object that determines whether word wrapping is allowed.

Return Value

The size of the string expressed in points.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocument.MeasureStringRtf Method

C1PdfDocument.MeasureStringRtf Method

Measures the specified Rtf string when drawn with the specified System.Drawing.Font object into a rectangle with the specified width.

[Visual Basic]

Public Function MeasureStringRtf( _

ByVal text As String, _

ByVal font As Font, _

ByVal width As Single _

) As SizeF

[C#]

public SizeF MeasureStringRtf(

string text,

Font font,

Single width

);

[Delphi]

public function MeasureStringRtf(

text: String;

font: Font;

width: Single

): SizeF;

Parameters

text

String to measure.

font

System.Drawing.Font object that defines the appearance and size of the text.

width

Maximum width of the string.

Return Value

The size of the string expressed in points.

Remarks

This method is similar to MeasureString (String, Font, Single, StringFormat), except it recognizes Rtf (Rich Text Format) strings like those used in the System.Windows.Forms.RichTextBox control.

For details, see the DrawStringRtf method.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocumentBase Class

C1PdfDocumentBase Class

Provides low-level methods to create and save Pdf documents.

For a list of all members of this type, see C1PdfDocumentBase Members.

System.Object

System.MarshalByRefObject

System.ComponentModel.Component

C1.C1Pdf.C1PdfDocumentBase

C1.C1Pdf.C1PdfDocument

[Visual Basic]

MustInherit Public Class C1PdfDocumentBase

Inherits Component

[C#]

public abstract class C1PdfDocumentBase : Component

[Delphi]

type C1PdfDocumentBase = class abstract (Component);

Remarks

This is the base for the C1PdfDocument class.

Namespace: C1.C1Pdf

Assembly: C1.C1Pdf (in c1.c1pdf.dll)

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocumentBase Members

C1PdfDocumentBase Members

C1PdfDocumentBase overview

Public Properties

Compression | Gets or sets the compression level to use when saving the document.
CurrentPage | Gets or sets the index of the current page within the document.
DocumentInfo | Gets the PdfDocumentInfo object that contains information about this document (author, etc).
FontType | Gets or sets how fonts should be encoded when saving the document.
ImageQuality | Gets or sets the image quality to use when saving the document.
PageRectangle | Gets a rectangle that represents the surface of the current page (in points).
Pages | Gets the collection of PdfPage objects that make up the document.
PageSize | Gets or sets the default page size for the document (in points).
Security | Gets the PdfSecurity object that manages security for this document (passwords, etc).

Public Methods

Clear | Restores the document to its initial state.
NewPage | Starts a new page.
Save | Overloaded. Saves the Pdf document to a System.IO.Stream.
Write | Writes raw content into the Pdf stream for the current page.

Protected Methods

Ellipse | For internal use only. Draws an ellipse.
PieArc | For internal use only. Draws a pie slice or an arc.
Polygon | For internal use only. Draws a polygon.
RoundRect | For internal use only. Draws a rounded rectangle.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocumentBase Properties

C1PdfDocumentBase Properties

The properties of the C1PdfDocumentBase class are listed here. For a complete list of C1PdfDocumentBase class members, see the C1PdfDocumentBase Members topic.

Public Properties

Compression | Gets or sets the compression level to use when saving the document.
CurrentPage | Gets or sets the index of the current page within the document.
DocumentInfo | Gets the PdfDocumentInfo object that contains information about this document (author, etc).
FontType | Gets or sets how fonts should be encoded when saving the document.
ImageQuality | Gets or sets the image quality to use when saving the document.
PageRectangle | Gets a rectangle that represents the surface of the current page (in points).
Pages | Gets the collection of PdfPage objects that make up the document.
PageSize | Gets or sets the default page size for the document (in points).
Security | Gets the PdfSecurity object that manages security for this document (passwords, etc).

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocumentBase.Compression Property

C1PdfDocumentBase.Compression Property

Gets or sets the compression level to use when saving the document.

[Visual Basic]

Public Property Compression As CompressionEnum

[C#]

public CompressionEnum Compression {get;set;}

[Delphi]

public property Compression: CompressionEnum read get_Compression write set_Compression;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocumentBase.CurrentPage Property

C1PdfDocumentBase.CurrentPage Property

Gets or sets the index of the current page within the document.

[Visual Basic]

Overridable Public Property CurrentPage As Integer

[C#]

virtual public int CurrentPage {get;set;}

[Delphi]

public property CurrentPage: Int32 read get_CurrentPage write set_CurrentPage;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocumentBase.DocumentInfo Property

C1PdfDocumentBase.DocumentInfo Property

Gets the PdfDocumentInfo object that contains information about this document (author, etc).

[Visual Basic]

Public ReadOnly Property DocumentInfo As PdfDocumentInfo

[C#]

public PdfDocumentInfo DocumentInfo {get;}

[Delphi]

public property DocumentInfo: PdfDocumentInfo read get_DocumentInfo;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocumentBase.FontType Property

C1PdfDocumentBase.FontType Property

Gets or sets how fonts should be encoded when saving the document.

[Visual Basic]

Public Property FontType As FontTypeEnum

[C#]

public FontTypeEnum FontType {get;set;}

[Delphi]

public property FontType: FontTypeEnum read get_FontType write set_FontType;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocumentBase.ImageQuality Property

C1PdfDocumentBase.ImageQuality Property

Gets or sets the image quality to use when saving the document.

[Visual Basic]

Public Property ImageQuality As ImageQualityEnum

[C#]

public ImageQualityEnum ImageQuality {get;set;}

[Delphi]

public property ImageQuality: ImageQualityEnum read get_ImageQuality write set_ImageQuality;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocumentBase.PageRectangle Property

C1PdfDocumentBase.PageRectangle Property

Gets a rectangle that represents the surface of the current page (in points).

[Visual Basic]

Overridable Public ReadOnly Property PageRectangle As RectangleF

[C#]

virtual public RectangleF PageRectangle {get;}

[Delphi]

public property PageRectangle: RectangleF read get_PageRectangle;

Remarks

This property returns a System.Drawing.RectangleF located at point (0,0) with size equal to the size of the current page. It can be used as a starting point for building rectangles that will be used for drawing on the page.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocumentBase.Pages Property

C1PdfDocumentBase.Pages Property

Gets the collection of PdfPage objects that make up the document.

[Visual Basic]

Public ReadOnly Property Pages As PdfPageCollection

[C#]

public PdfPageCollection Pages {get;}

[Delphi]

public property Pages: PdfPageCollection read get_Pages;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocumentBase.PageSize Property

C1PdfDocumentBase.PageSize Property

Gets or sets the default page size for the document (in points).

[Visual Basic]

Overridable Public Property PageSize As SizeF

[C#]

virtual public SizeF PageSize {get;set;}

[Delphi]

public property PageSize: SizeF read get_PageSize write set_PageSize;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocumentBase.Security Property

C1PdfDocumentBase.Security Property

Gets the PdfSecurity object that manages security for this document (passwords, etc).

[Visual Basic]

Public ReadOnly Property Security As PdfSecurity

[C#]

public PdfSecurity Security {get;}

[Delphi]

public property Security: PdfSecurity read get_Security;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocumentBase Methods

C1PdfDocumentBase Methods

The methods of the C1PdfDocumentBase class are listed here. For a complete list of C1PdfDocumentBase class members, see the C1PdfDocumentBase Members topic.

Public Methods

Clear | Restores the document to its initial state.
NewPage | Starts a new page.
Save | Overloaded. Saves the Pdf document to a System.IO.Stream.
Write | Writes raw content into the Pdf stream for the current page.

Protected Methods

Ellipse | For internal use only. Draws an ellipse.
PieArc | For internal use only. Draws a pie slice or an arc.
Polygon | For internal use only. Draws a polygon.
RoundRect | For internal use only. Draws a rounded rectangle.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocumentBase.Clear Method

C1PdfDocumentBase.Clear Method

Restores the document to its initial state.

[Visual Basic]

Public Sub Clear()

[C#]

public void Clear()

[Delphi]

public procedure Clear();

Remarks

All current content is discarded, a single empty page is created, and the CurrentPage property is set to zero.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocumentBase.Ellipse Method

C1PdfDocumentBase.Ellipse Method

For internal use only. Draws an ellipse.

[Visual Basic]

Protected Sub Ellipse( _

ByVal rc As RectangleF _

)

[C#]

protected void Ellipse(

RectangleF rc

);

[Delphi]

strict protected procedure Ellipse(

rc: RectangleF

);

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocumentBase.NewPage Method

C1PdfDocumentBase.NewPage Method

Starts a new page.

[Visual Basic]

Public Sub NewPage()

[C#]

public void NewPage()

[Delphi]

public procedure NewPage();

Remarks

Adds a blank page to the document and sets the CurrentPage property to make it the currently active page.

The size of the new page is defined by the value of the PageSize property.

If you want the new page to have a different size than the rest of the document, create the new page first, then set the PageSize property.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocumentBase.PieArc Method

C1PdfDocumentBase.PieArc Method

For internal use only. Draws a pie slice or an arc.

[Visual Basic]

Protected Sub PieArc( _

ByVal rc As RectangleF, _

ByVal startAngle As Single, _

ByVal sweepAngle As Single, _

ByVal close As Boolean, _

ByVal clockwise As Boolean _

)

[C#]

protected void PieArc(

RectangleF rc,

Single startAngle,

Single sweepAngle,

bool close,

bool clockwise

);

[Delphi]

strict protected procedure PieArc(

rc: RectangleF;

startAngle: Single;

sweepAngle: Single;

close: Boolean;

clockwise: Boolean

);

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocumentBase.Polygon Method

C1PdfDocumentBase.Polygon Method

For internal use only. Draws a polygon.

[Visual Basic]

Protected Sub Polygon( _

ByVal points As PointF() _

)

[C#]

protected void Polygon(

PointF[] points

);

[Delphi]

strict protected procedure Polygon(

points: array of PointF

);

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocumentBase.RoundRect Method

C1PdfDocumentBase.RoundRect Method

For internal use only. Draws a rounded rectangle.

[Visual Basic]

Protected Sub RoundRect( _

ByVal rc As RectangleF, _

ByVal sz As SizeF _

)

[C#]

protected void RoundRect(

RectangleF rc,

SizeF sz

);

[Delphi]

strict protected procedure RoundRect(

rc: RectangleF;

sz: SizeF

);

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocumentBase.Save Method

C1PdfDocumentBase.Save Method

Overload List

Saves the Pdf document to a System.IO.Stream.

[Visual Basic] Overloads Public Sub Save(Stream)

[C#] public Save(Stream);

[Delphi] public procedure Save(Stream); overload;

Saves the Pdf document to a file.

[Visual Basic] Overloads Public Sub Save(String)

[C#] public Save(string);

[Delphi] public procedure Save(String); overload;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocumentBase.Save Method (Stream)

C1PdfDocumentBase.Save Method (Stream)

Saves the Pdf document to a System.IO.Stream.

[Visual Basic]

Overloads Public Sub Save( _

ByVal stream As Stream _

)

[C#]

public void Save(

Stream stream

);

[Delphi]

public procedure Save(

stream: Stream

); overload;

Parameters

stream

System.IO.Stream object to use for saving the document.

Remarks

Saving the Pdf document to a System.IO.Stream object is often used in Web scenarios, when you are creating a Response object or storing the document in the a cache, and don't want to create temporary files.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocumentBase.Save Method (String)

C1PdfDocumentBase.Save Method (String)

Saves the Pdf document to a file.

[Visual Basic]

Overloads Public Sub Save( _

ByVal fileName As String _

)

[C#]

public void Save(

string fileName

);

[Delphi]

public procedure Save(

fileName: String

); overload;

Parameters

fileName

Name of the Pdf file to create.

Remarks

Saving the Pdf document to a file requires that the file be available for writing. If the file already exists and is in use by an application (such as the Adobe Acrobat Reader), the method will throw an exception.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1PdfDocumentBase.Write Method

C1PdfDocumentBase.Write Method

Writes raw content into the Pdf stream for the current page.

[Visual Basic]

Public Sub Write( _

ByVal format As String, _

ByVal args As Object() _

)

[C#]

public void Write(

string format,

object[] args

);

[Delphi]

public procedure Write(

format: String;

args: array of Object

);

Parameters

format

Format string, as in System.Console.WriteLine.

args

Array of objects to write using format.

Remarks

This is a low-level method that allows you to insert Pdf commands directly into the page stream. It is intended for use by derived classes and requires knowledge of the Pdf document structure and syntax.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


CompressionEnum Enumeration

CompressionEnum Enumeration

Determines the level of compression used when saving the document.

[Visual Basic]

Public Enum CompressionEnum

[C#]

public enum CompressionEnum

[Delphi]

type CompressionEnum = (BestCompression, BestSpeed, Default, None);

Namespace: C1.C1Pdf

Assembly: C1.C1Pdf (in c1.c1pdf.dll)

Members

Member name | Description
BestCompression | Highest compression, slowest save.
BestSpeed | Low compression, fastest save.
Default | High compression, fast save.
None | No compression (useful for debugging).

See Also

C1.C1Pdf Namespace

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


FontTypeEnum Enumeration

FontTypeEnum Enumeration

Determines how fonts are encoded in the document.

[Visual Basic]

Public Enum FontTypeEnum

[C#]

public enum FontTypeEnum

[Delphi]

type FontTypeEnum = (Embedded, Standard, TrueType);

Namespace: C1.C1Pdf

Assembly: C1.C1Pdf (in c1.c1pdf.dll)

Members

Member name | Description
Embedded | Use embedded TrueType fonts.
Standard | Use only standard Pdf fonts (Helvetica, Times, Symbol).
TrueType | Use TrueType fonts, no embedding (viewer must have fonts installed).

See Also

C1.C1Pdf Namespace

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


ImageQualityEnum Enumeration

ImageQualityEnum Enumeration

Determines the quality of bitmaps added to the document with the DrawImage (Image, RectangleF, ContentAlignment, ImageSizeModeEnum) method.

[Visual Basic]

Public Enum ImageQualityEnum

[C#]

public enum ImageQualityEnum

[Delphi]

type ImageQualityEnum = (Default, High, Low, Medium);

Namespace: C1.C1Pdf

Assembly: C1.C1Pdf (in c1.c1pdf.dll)

Members

Member name | Description
Default | High quality, medium/large file size.
High | Highest quality, largest file size.
Low | Low quality, small file size.
Medium | Medium quality, medium file size.

See Also

C1.C1Pdf Namespace

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


ImageSizeModeEnum Enumeration

ImageSizeModeEnum Enumeration

Specifies how to render images into a rectangle.

[Visual Basic]

Public Enum ImageSizeModeEnum

[C#]

public enum ImageSizeModeEnum

[Delphi]

type ImageSizeModeEnum = (Clip, Scale, Stretch);

Namespace: C1.C1Pdf

Assembly: C1.C1Pdf (in c1.c1pdf.dll)

Members

Member name | Description
Clip | Image is clipped to the rectangle.
Scale | Image is scaled to fill as much of the rectangle as possible, while keeping the original aspect ratio.
Stretch | Image is stretched to fill the rectangle.

See Also

C1.C1Pdf Namespace

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfDocumentInfo Class

PdfDocumentInfo Class

Contains information about the document. This information includes the document author, title, keywords, etc.

For a list of all members of this type, see PdfDocumentInfo Members.

System.Object

C1.C1Pdf.PdfDocumentInfo

[Visual Basic]

Public Class PdfDocumentInfo

[C#]

public class PdfDocumentInfo

[Delphi]

type PdfDocumentInfo = class;

Remarks

You don't have to provide this information, it is optional. If provided, it is saved with the document and is available to the reader application.

Some reader applications may allow users to search documents by author, subject, or keyword.

The Adobe Acrobat Reader 5 does not provide such search mechanism, but it does allow users to view the document information.

Namespace: C1.C1Pdf

Assembly: C1.C1Pdf (in c1.c1pdf.dll)

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfDocumentInfo Members

PdfDocumentInfo Members

PdfDocumentInfo overview

Public Properties

Author | Gets or sets the name of the person that created the pdf document.
Creator | Gets or sets the name of the application that created the original document.
Keywords | Gets or sets keywords associated with the pdf document.
Producer | Gets or sets the name of the application that created the pdf document.
Subject | Gets or sets the subject of the pdf document.
Title | Gets or sets the title of the pdf document.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfDocumentInfo Properties

PdfDocumentInfo Properties

The properties of the PdfDocumentInfo class are listed here. For a complete list of PdfDocumentInfo class members, see the PdfDocumentInfo Members topic.

Public Properties

Author | Gets or sets the name of the person that created the pdf document.
Creator | Gets or sets the name of the application that created the original document.
Keywords | Gets or sets keywords associated with the pdf document.
Producer | Gets or sets the name of the application that created the pdf document.
Subject | Gets or sets the subject of the pdf document.
Title | Gets or sets the title of the pdf document.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfDocumentInfo.Author Property

PdfDocumentInfo.Author Property

Gets or sets the name of the person that created the pdf document.

[Visual Basic]

Public Property Author As String

[C#]

public string Author {get;set;}

[Delphi]

public property Author: String read get_Author write set_Author;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfDocumentInfo.Creator Property

PdfDocumentInfo.Creator Property

Gets or sets the name of the application that created the original document.

[Visual Basic]

Public Property Creator As String

[C#]

public string Creator {get;set;}

[Delphi]

public property Creator: String read get_Creator write set_Creator;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfDocumentInfo.Keywords Property

PdfDocumentInfo.Keywords Property

Gets or sets keywords associated with the pdf document.

[Visual Basic]

Public Property Keywords As String

[C#]

public string Keywords {get;set;}

[Delphi]

public property Keywords: String read get_Keywords write set_Keywords;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfDocumentInfo.Producer Property

PdfDocumentInfo.Producer Property

Gets or sets the name of the application that created the pdf document.

[Visual Basic]

Public Property Producer As String

[C#]

public string Producer {get;set;}

[Delphi]

public property Producer: String read get_Producer write set_Producer;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfDocumentInfo.Subject Property

PdfDocumentInfo.Subject Property

Gets or sets the subject of the pdf document.

[Visual Basic]

Public Property Subject As String

[C#]

public string Subject {get;set;}

[Delphi]

public property Subject: String read get_Subject write set_Subject;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfDocumentInfo.Title Property

PdfDocumentInfo.Title Property

Gets or sets the title of the pdf document.

[Visual Basic]

Public Property Title As String

[C#]

public string Title {get;set;}

[Delphi]

public property Title: String read get_Title write set_Title;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfPage Class

PdfPage Class

PdfPage

For a list of all members of this type, see PdfPage Members.

System.Object

C1.C1Pdf.PdfPage

[Visual Basic]

Public Class PdfPage

[C#]

public class PdfPage

[Delphi]

type PdfPage = class;

Namespace: C1.C1Pdf

Assembly: C1.C1Pdf (in c1.c1pdf.dll)

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfPage Members

PdfPage Members

PdfPage overview

Public Properties

Tag

Gets or sets an object associated with the page that contains data useful to the application.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfPage Properties

PdfPage Properties

The properties of the PdfPage class are listed here. For a complete list of PdfPage class members, see the PdfPage Members topic.

Public Properties

Tag

Gets or sets an object associated with the page that contains data useful to the application.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfPage.Tag Property

PdfPage.Tag Property

Gets or sets an object associated with the page that contains data useful to the application.

[Visual Basic]

Public Property Tag As Object

[C#]

public object Tag {get;set;}

[Delphi]

public property Tag: Object read get_Tag write set_Tag;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfPageCollection Class

PdfPageCollection Class

A collection of PdfPage objects that make up the document.

For a list of all members of this type, see PdfPageCollection Members.

System.Object

System.Collections.ArrayList

C1.C1Pdf.PdfPageCollection

[Visual Basic]

Public Class PdfPageCollection

Inherits ArrayList

Implements IList

[C#]

public class PdfPageCollection : ArrayList , IList

[Delphi]

type PdfPageCollection = class (ArrayList, IList);

Namespace: C1.C1Pdf

Assembly: C1.C1Pdf (in c1.c1pdf.dll)

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfPageCollection Members

PdfPageCollection Members

PdfPageCollection overview

Public Properties

Item

Gets or sets the PdfPage at a specific position in the document.

Public Methods

Add | Overloaded. Creates a new PdfPage and adds it to the end of the document.
AddRange | Overriden. Adds the elements of an System.Collections.ICollection to the end of the document.
Clear | Overriden. Removes all pages from the document.
Insert | Overloaded. Creates a new page and inserts it at a specific position in the document.
InsertRange | Overriden. Inserts the elements of an System.Collections.ICollection at a specified position in the document.
Remove | Removes a page from a document.
RemoveAt | Overriden. Removes a page at a specific position from the document.
RemoveRange | Overriden. Removes a range of pages from the document.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfPageCollection Properties

PdfPageCollection Properties

The properties of the PdfPageCollection class are listed here. For a complete list of PdfPageCollection class members, see the PdfPageCollection Members topic.

Public Properties

Item

Gets or sets the PdfPage at a specific position in the document.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfPageCollection.Item Property

PdfPageCollection.Item Property

Gets or sets the PdfPage at a specific position in the document.

[Visual Basic]

Public Default Property Item( _

ByVal index As Integer _

) As PdfPage

[C#]

public PdfPage this[

int index

] {get;set;}

[Delphi]

public property Item[

index: Int32

]: PdfPage read get_Item write set_Item;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfPageCollection Methods

PdfPageCollection Methods

The methods of the PdfPageCollection class are listed here. For a complete list of PdfPageCollection class members, see the PdfPageCollection Members topic.

Public Methods

Add | Overloaded. Creates a new PdfPage and adds it to the end of the document.
AddRange | Overriden. Adds the elements of an System.Collections.ICollection to the end of the document.
Clear | Overriden. Removes all pages from the document.
Insert | Overloaded. Creates a new page and inserts it at a specific position in the document.
InsertRange | Overriden. Inserts the elements of an System.Collections.ICollection at a specified position in the document.
Remove | Removes a page from a document.
RemoveAt | Overriden. Removes a page at a specific position from the document.
RemoveRange | Overriden. Removes a range of pages from the document.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfPageCollection.Add Method

PdfPageCollection.Add Method

Overload List

Creates a new PdfPage and adds it to the end of the document.

[Visual Basic] Overloads Public Function Add() As Integer

[C#] public int Add();

[Delphi] public function Add() : Int32; overload;

Creates a new PdfPage with the specified size and adds it to the end of the document.

[Visual Basic] Overloads Public Function Add(PaperKind) As Integer

[C#] public int Add(PaperKind);

[Delphi] public function Add(PaperKind) : Int32; overload;

Adds a page to the document.

[Visual Basic] Overloads Public Function Add(PdfPage) As Integer

[C#] public int Add(PdfPage);

[Delphi] public function Add(PdfPage) : Int32; overload;

Creates a new PdfPage with the specified size and adds it to the end of the document.

[Visual Basic] Overloads Public Function Add(SizeF) As Integer

[C#] public int Add(SizeF);

[Delphi] public function Add(SizeF) : Int32; overload;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfPageCollection.Add Method ()

PdfPageCollection.Add Method ()

Creates a new PdfPage and adds it to the end of the document.

[Visual Basic]

Overloads Public Function Add() As Integer

[C#]

public int Add()

[Delphi]

public function Add(): Int32; overload;

Return Value

The index of the new page.

Remarks

The size of the new page is determined by the PageSize property of the parent document.

The new page becomes current after it is added to the document (see the CurrentPage property).

You can also add pages to a C1PdfDocument by calling the NewPage method.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfPageCollection.Add Method (PaperKind)

PdfPageCollection.Add Method (PaperKind)

Creates a new PdfPage with the specified size and adds it to the end of the document.

[Visual Basic]

Overloads Public Function Add( _

ByVal paperKind As PaperKind _

) As Integer

[C#]

public int Add(

PaperKind paperKind

);

[Delphi]

public function Add(

paperKind: PaperKind

): Int32; overload;

Parameters

paperKind

The size of the new page, expressed as a System.Drawing.Printing.PaperKind.

Return Value

The index of the new page.

Remarks

The new page becomes current after it is added to the document (see the CurrentPage property).

You can also add pages to a C1PdfDocument by calling the NewPage method.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfPageCollection.Add Method (PdfPage)

PdfPageCollection.Add Method (PdfPage)

Adds a page to the document.

[Visual Basic]

Overloads Public Function Add( _

ByVal page As PdfPage _

) As Integer

[C#]

public int Add(

PdfPage page

);

[Delphi]

public function Add(

page: PdfPage

): Int32; overload;

Parameters

page

PdfPage to add to the document.

Return Value

The index of the new page in the document.

Remarks

Since the PdfPage class has no public constructors, the only way to use this overload is to remove an existing page from the document first, then add that page back into the document.

Each page can appear only once in the document. Trying to add the same page twice will throw an exception.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfPageCollection.Add Method (SizeF)

PdfPageCollection.Add Method (SizeF)

Creates a new PdfPage with the specified size and adds it to the end of the document.

[Visual Basic]

Overloads Public Function Add( _

ByVal pageSize As SizeF _

) As Integer

[C#]

public int Add(

SizeF pageSize

);

[Delphi]

public function Add(

pageSize: SizeF

): Int32; overload;

Parameters

pageSize

The size of the new page, in points.

Return Value

The index of the new page.

Remarks

The new page becomes current after it is added to the document (see the CurrentPage property).

You can also add pages to a C1PdfDocument by calling the NewPage method.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfPageCollection.AddRange Method

PdfPageCollection.AddRange Method

Adds the elements of an System.Collections.ICollection to the end of the document.

[Visual Basic]

Overrides Public Sub AddRange( _

ByVal c As ICollection _

)

[C#]

override public void AddRange(

ICollection c

);

[Delphi]

public procedure AddRange(

c: ICollection

); override;

Parameters

c

Collection of PdfPage objects to add to the document.

Remarks

Since the PdfPage class has no public constructors, the only way to use this overload is to remove existing pages from the document first, then add them back into the document.

Each page can appear only once in the document. Trying to add the same page twice will throw an exception.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfPageCollection.Clear Method

PdfPageCollection.Clear Method

Removes all pages from the document.

[Visual Basic]

Overrides Public Sub Clear() Implements IList.Clear

[C#]

override public void Clear()

[Delphi]

public procedure Clear(); override;

Implements

IList.Clear

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfPageCollection.Insert Method

PdfPageCollection.Insert Method

Overload List

Creates a new page and inserts it at a specific position in the document.

[Visual Basic] Overloads Public Sub Insert(Integer)

[C#] public Insert(int);

[Delphi] public procedure Insert(Int32); overload;

Creates a new page with the specified size and inserts it at a specific position in the document.

[Visual Basic] Overloads Public Sub Insert(Integer, PaperKind)

[C#] public Insert(int, PaperKind);

[Delphi] public procedure Insert(Int32; PaperKind); overload;

Inserts a page at a specific position in the document.

[Visual Basic] Overloads Public Sub Insert(Integer, PdfPage)

[C#] public Insert(int, PdfPage);

[Delphi] public procedure Insert(Int32; PdfPage); overload;

Creates a new page with the specified size and inserts it at a specific position in the document.

[Visual Basic] Overloads Public Sub Insert(Integer, SizeF)

[C#] public Insert(int, SizeF);

[Delphi] public procedure Insert(Int32; SizeF); overload;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfPageCollection.Insert Method (Int32)

PdfPageCollection.Insert Method (Int32)

Creates a new page and inserts it at a specific position in the document.

[Visual Basic]

Overloads Public Sub Insert( _

ByVal index As Integer _

)

[C#]

public void Insert(

int index

);

[Delphi]

public procedure Insert(

index: Int32

); overload;

Parameters

index

The position where the new page will be inserted.

Remarks

The size of the new page is determined by the PageSize property of the parent document.

The new page becomes current after it is added to the document (see the CurrentPage property).

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfPageCollection.Insert Method (Int32, PaperKind)

PdfPageCollection.Insert Method (Int32, PaperKind)

Creates a new page with the specified size and inserts it at a specific position in the document.

[Visual Basic]

Overloads Public Sub Insert( _

ByVal index As Integer, _

ByVal paperKind As PaperKind _

)

[C#]

public void Insert(

int index,

PaperKind paperKind

);

[Delphi]

public procedure Insert(

index: Int32;

paperKind: PaperKind

); overload;

Parameters

index

The position where the new page will be inserted.

paperKind

The size of the new page, expressed as a System.Drawing.Printing.PaperKind.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfPageCollection.Insert Method (Int32, PdfPage)

PdfPageCollection.Insert Method (Int32, PdfPage)

Inserts a page at a specific position in the document.

[Visual Basic]

Overloads Public Sub Insert( _

ByVal index As Integer, _

ByVal page As PdfPage _

)

[C#]

public void Insert(

int index,

PdfPage page

);

[Delphi]

public procedure Insert(

index: Int32;

page: PdfPage

); overload;

Parameters

index

Position where the new page will be inserted in the document.

page

PdfPage to add to the document.

Remarks

Since the PdfPage class has no public constructors, the only way to use this overload is to remove an existing page from the document first, then add that page back into the document.

Each page can appear only once in the document. Trying to add the same page twice will throw an exception.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfPageCollection.Insert Method (Int32, SizeF)

PdfPageCollection.Insert Method (Int32, SizeF)

Creates a new page with the specified size and inserts it at a specific position in the document.

[Visual Basic]

Overloads Public Sub Insert( _

ByVal index As Integer, _

ByVal pageSize As SizeF _

)

[C#]

public void Insert(

int index,

SizeF pageSize

);

[Delphi]

public procedure Insert(

index: Int32;

pageSize: SizeF

); overload;

Parameters

index

The position where the new page will be inserted.

pageSize

The size of the new page, expressed in points.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfPageCollection.InsertRange Method

PdfPageCollection.InsertRange Method

Inserts the elements of an System.Collections.ICollection at a specified position in the document.

[Visual Basic]

Overrides Public Sub InsertRange( _

ByVal index As Integer, _

ByVal c As ICollection _

)

[C#]

override public void InsertRange(

int index,

ICollection c

);

[Delphi]

public procedure InsertRange(

index: Int32;

c: ICollection

); override;

Parameters

index

Position where the new pages will be inserted.

c

Collection of PdfPage objects to add to the document.

Remarks

Since the PdfPage class has no public constructors, the only way to use this overload is to remove existing pages from the document first, then add them back into the document.

Each page can appear only once in the document. Trying to add the same page twice will throw an exception.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfPageCollection.Remove Method

PdfPageCollection.Remove Method

Removes a page from a document.

[Visual Basic]

Public Sub Remove( _

ByVal page As PdfPage _

)

[C#]

public void Remove(

PdfPage page

);

[Delphi]

public procedure Remove(

page: PdfPage

);

Parameters

page

PdfPage to remove from the document.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfPageCollection.RemoveAt Method

PdfPageCollection.RemoveAt Method

Removes a page at a specific position from the document.

[Visual Basic]

Overrides Public Sub RemoveAt( _

ByVal index As Integer _

) Implements IList.RemoveAt

[C#]

override public void RemoveAt(

int index

);

[Delphi]

public procedure RemoveAt(

index: Int32

); override;

Implements

IList.RemoveAt

Parameters

index

Index of the page to be removed from the document.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfPageCollection.RemoveRange Method

PdfPageCollection.RemoveRange Method

Removes a range of pages from the document.

[Visual Basic]

Overrides Public Sub RemoveRange( _

ByVal index As Integer, _

ByVal count As Integer _

)

[C#]

override public void RemoveRange(

int index,

int count

);

[Delphi]

public procedure RemoveRange(

index: Int32;

count: Int32

); override;

Parameters

index

Index of the first page to remove.

count

Number of pages to remove from the document.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfSecurity Class

PdfSecurity Class

Provides security and encryption services and manages permissions for C1PdfDocument objects.

For a list of all members of this type, see PdfSecurity Members.

System.Object

C1.C1Pdf.PdfSecurity

[Visual Basic]

Public Class PdfSecurity

[C#]

public class PdfSecurity

[Delphi]

type PdfSecurity = class;

Remarks

PdfSecurity has properties that allow you to specify owner and user passwords for a pdf document. The OwnerPasswordis required to change passwords and permissions. The UserPassword is required to open the document.

PdfSecurity also has properties that allow you to specify what permissions a regular user should have. For example, you may allow users to see the document but not to print or edit it.

You can specify permissions and set only the OwnerPassword, leaving the UserPassword empty. In this case, anyone will be allowed to open the document, but only the owner will be allowed to change the permissions.

Note that the encryption scheme used by pdf is public and is not 100% secure. There are ways to crack encrypted pdf documents. The security provided is adequate to protect your documents from most casual attacks, but if your data is truly sensitive you should not rely on pdf encryption alone.

Namespace: C1.C1Pdf

Assembly: C1.C1Pdf (in c1.c1pdf.dll)

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfSecurity Members

PdfSecurity Members

PdfSecurity overview

Public Properties

AllowCopyContent | Gets or sets whether the user can copy contents from the pdf document.
AllowEditAnnotations | Gets or sets whether the user can edit annotations in the pdf document.
AllowEditContent | Gets or sets whether the user can edit the contents of the pdf document.
AllowPrint | Gets or sets whether the user can print the pdf document.
OwnerPassword | Gets or sets the password required to change permissions for the pdf document.
UserPassword | Gets or sets the password required to open the pdf document.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfSecurity Properties

PdfSecurity Properties

The properties of the PdfSecurity class are listed here. For a complete list of PdfSecurity class members, see the PdfSecurity Members topic.

Public Properties

AllowCopyContent | Gets or sets whether the user can copy contents from the pdf document.
AllowEditAnnotations | Gets or sets whether the user can edit annotations in the pdf document.
AllowEditContent | Gets or sets whether the user can edit the contents of the pdf document.
AllowPrint | Gets or sets whether the user can print the pdf document.
OwnerPassword | Gets or sets the password required to change permissions for the pdf document.
UserPassword | Gets or sets the password required to open the pdf document.

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfSecurity.AllowCopyContent Property

PdfSecurity.AllowCopyContent Property

Gets or sets whether the user can copy contents from the pdf document.

[Visual Basic]

Public Property AllowCopyContent As Boolean

[C#]

public bool AllowCopyContent {get;set;}

[Delphi]

public property AllowCopyContent: Boolean read get_AllowCopyContent write set_AllowCopyContent;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfSecurity.AllowEditAnnotations Property

PdfSecurity.AllowEditAnnotations Property

Gets or sets whether the user can edit annotations in the pdf document.

[Visual Basic]

Public Property AllowEditAnnotations As Boolean

[C#]

public bool AllowEditAnnotations {get;set;}

[Delphi]

public property AllowEditAnnotations: Boolean read get_AllowEditAnnotations write set_AllowEditAnnotations;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfSecurity.AllowEditContent Property

PdfSecurity.AllowEditContent Property

Gets or sets whether the user can edit the contents of the pdf document.

[Visual Basic]

Public Property AllowEditContent As Boolean

[C#]

public bool AllowEditContent {get;set;}

[Delphi]

public property AllowEditContent: Boolean read get_AllowEditContent write set_AllowEditContent;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfSecurity.AllowPrint Property

PdfSecurity.AllowPrint Property

Gets or sets whether the user can print the pdf document.

[Visual Basic]

Public Property AllowPrint As Boolean

[C#]

public bool AllowPrint {get;set;}

[Delphi]

public property AllowPrint: Boolean read get_AllowPrint write set_AllowPrint;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfSecurity.OwnerPassword Property

PdfSecurity.OwnerPassword Property

Gets or sets the password required to change permissions for the pdf document.

[Visual Basic]

Public Property OwnerPassword As String

[C#]

public string OwnerPassword {get;set;}

[Delphi]

public property OwnerPassword: String read get_OwnerPassword write set_OwnerPassword;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


PdfSecurity.UserPassword Property

PdfSecurity.UserPassword Property

Gets or sets the password required to open the pdf document.

[Visual Basic]

Public Property UserPassword As String

[C#]

public string UserPassword {get;set;}

[Delphi]

public property UserPassword: String read get_UserPassword write set_UserPassword;

See Also

Untitled Document
Send feedback to ComponentOne
Copyright © 1987-2005 ComponentOne LLC. All rights reserved.


C1.C1Pdf Hierarchy

System.Object

System.Collections.ArrayList

C1.C1Pdf.PdfPageCollection ---- System.Collections.IList

System.MarshalByRefObject

System.ComponentModel.Component

C1.C1Pdf.C1PdfDocumentBase

C1.C1Pdf.C1PdfDocument

C1.C1Pdf.PdfDocumentInfo

C1.C1Pdf.PdfPage

C1.C1Pdf.PdfSecurity

System.ValueType

System.Enum

C1.C1Pdf.AttachmentIconEnum

C1.C1Pdf.CompressionEnum

C1.C1Pdf.FontTypeEnum

C1.C1Pdf.ImageQualityEnum

C1.C1Pdf.ImageSizeModeEnum

See Also

C1.C1Pdf Namespace


C1PDFAddAttachment - C#

C#

RectangleF rc = new RectangleF(100, 100, 60, 10);

Font font = new Font("Arial", 9);

// attach some files

string path = @"c:\temp\files";

string[] files = Directory.GetFiles(path);

foreach (string file in files)

{

float width = rc.Width;

rc.Width = rc.Height;

_c1pdf.FillRectangle(Brushes.Gray, rc);

_c1pdf.AddAttachment(file, rc);

rc.Width = width;

rc.X += rc.Height;

_c1pdf.DrawString(Path.GetFileName(file),

font, Brushes.Black, rc);

rc.X -= rc.Height;

rc.Y += 2 * rc.Height;

}


C1PDFAddAttachment - Delphi

Delphi

var

rc: RectangleF;

f: System.Drawing.Font;

path, fl: string;

files: array of string;

width: single;

begin

rc := RectangleF.Create(100, 100, 60, 10);

f := System.Drawing.Font.Create('Arial', 9);

// attach some files

path := '';

files := Directory.GetFiles(path);

for I := 0 to High(files) do

begin

fl := files[I];

width := rc.Width;

_c1pdf.FillRectangle(Brushes.Gray, rc);

_c1pdf.AddAttachment(fl, rc);

rc.Width := width

rc.X := rc.X + rc.Height;

_c1pdf.DrawString(Path.GetFileName(fl), f, Brushes.Black, rc);

rc.X := rc.X - rc.Height;

rc.Y := rc.Y + 2 * rc.Height;

end;

end;


C1PDFAddAttachment - Visual Basic

Visual Basic

Dim rc As New RectangleF(100, 100, 60, 10)

Dim font As New Font("Arial", 9)

' attach some files

Dim path As String = ""

Dim file As String

For Each file In Directory.GetFiles(path)

Dim width As Single = rc.Width

rc.Width = rc.Height

_c1pdf.FillRectangle(Brushes.Gray, rc)

_c1pdf.AddAttachment(file, rc)

rc.Width = width

rc.X += rc.Height

_c1pdf.DrawString(Path.GetFileName(file), font, Brushes.Black, rc)

rc.X -= rc.Height

rc.Y += 2 * rc.Height

Next file


C1PDFAddBookMark - C#

C#

private RectangleF RenderParagraph(string text, Font font,

RectangleF rc, RectangleF rcPage, bool outline)

{

// if it won't fit this page, do a page break

rc.Height = _c1pdf.MeasureString(text, font, rc.Width).Height;

if (rc.Bottom > rcPage.Bottom)

{

_c1pdf.NewPage();

rc.Y = rcPage.Top;

}

// draw the string

_c1pdf.DrawString(text, font, Brushes.Black, rc);

// add headings to outline

if (outline)

{

_c1pdf.DrawLine(Pens.Black, rc.X, rc.Y, rc.Right, rc.Y);

_c1pdf.AddBookmark(text, 0, rc.Y);

}

// update rectangle for next time

rc.Offset(0, rc.Height);

return rc;


C1PDFAddBookMark - Delphi

Delphi

function RenderParagraph(text: string; f: System.Drawing.Font; rc: RectangleF; rcPage: RectangleF; outline: Boolean);

begin

// if it won't fit this page, do a page break

rc.Height := _c1pdf.MeasureString(text, font, rc.Width).Height;

if rc.Bottom > rcPage.Bottom then

begin

_c1pdf.NewPage;

rc.Y := rcPage.Top;

end;

// draw the string

_c1pdf.DrawString(text, f, Brushes.Black, rc);

// add headings to outline

if outline then

begin

_c1pdf.DrawLine(Pens.Black, rc.X, rc.Y, rc.Right, rc.Y);

_c1pdf.AddBookmark(text, 0, rc.Y);

end;

// update rectangle for next time

rc.Offset(0, rc.Height);

Result := rc;

end // RenderParagraph


C1PDFAddBookmarkMethod - C#

C#

private RectangleF RenderParagraph(string text, Font font,

RectangleF rc, RectangleF rcPage, bool outline)

{

// if it won't fit this page, do a page break

rc.Height = _c1pdf.MeasureString(text, font, rc.Width).Height;

if (rc.Bottom > rcPage.Bottom)

{

_c1pdf.NewPage();

rc.Y = rcPage.Top;

}

// draw the string

_c1pdf.DrawString(text, font, Brushes.Black, rc);

// add headings to outline

if (outline)

{

_c1pdf.DrawLine(Pens.Black, rc.X, rc.Y, rc.Right, rc.Y);

_c1pdf.AddBookmark(text, 0, rc.Y);

}

// update rectangle for next time

rc.Offset(0, rc.Height);

return rc;

}


C1PDFAddBookmarkMethod - Delphi

Delphi

function RenderParagraph(text: string; f: System.Drawing.Font; rc: RectangleF; rcPage: RectangleF; outline: Boolean);

begin

// if it won't fit this page, do a page break

rc.Height := _c1pdf.MeasureString(text, font, rc.Width).Height;

if rc.Bottom > rcPage.Bottom then

begin

_c1pdf.NewPage;

rc.Y := rcPage.Top;

end;

// draw the string

_c1pdf.DrawString(text, f, Brushes.Black, rc);

// add headings to outline

if outline then

begin

_c1pdf.DrawLine(Pens.Black, rc.X, rc.Y, rc.Right, rc.Y);

_c1pdf.AddBookmark(text, 0, rc.Y);

end;

// update rectangle for next time

rc.Offset(0, rc.Height);

Result := rc;

end;


C1PDFAddBookmarkMethod- Visual Basic

Visual Basic

Private Function RenderParagraph(text As String, _
font As Font, rc As RectangleF, _
rcPage As RectangleF, outline As Boolean) As RectangleF

' if it won't fit this page, do a page break

rc.Height = _c1pdf.MeasureString(text, font, rc.Width).Height

If rc.Bottom > rcPage.Bottom Then

_c1pdf.NewPage()

rc.Y = rcPage.Top

End If

' draw the string

_c1pdf.DrawString(text, font, Brushes.Black, rc)

' add headings to outline

If outline Then

_c1pdf.DrawLine(Pens.Black, rc.X, rc.Y, rc.Right, rc.Y)

_c1pdf.AddBookmark(text, 0, rc.Y)

End If

' update rectangle for next time

rc.Offset(0, rc.Height)

Return rc

End Function 'RenderParagraph


C1PDFAddBookMark - Visual Basic

Visual Basic

Private Function RenderParagraph(text As String, font As Font, rc As RectangleF, rcPage As RectangleF, outline As Boolean) As RectangleF

' if it won't fit this page, do a page break

rc.Height = _c1pdf.MeasureString(text, font, rc.Width).Height

If rc.Bottom > rcPage.Bottom Then

_c1pdf.NewPage()

rc.Y = rcPage.Top

End If

' draw the string

_c1pdf.DrawString(text, font, Brushes.Black, rc)

' add headings to outline

If outline Then

_c1pdf.DrawLine(Pens.Black, rc.X, rc.Y, rc.Right, rc.Y)

_c1pdf.AddBookmark(text, 0, rc.Y)

End If

' update rectangle for next time

rc.Offset(0, rc.Height)

Return rc

End Function 'RenderParagraph


C1PDFAddLink - C#

C#

RectangleF rc = new RectangleF(50, 50, 100, 15);

Font font = new Font("Arial", 10, FontStyle.Underline);

_c1pdf.AddLink("http://www.componentone.com", rc);

_c1pdf.DrawString("Visit ComponentOne", font, Brushes.Blue, rc);


C1PDFAddLink - Delphi

Delphi

var

f: System.Drawing.Font;

rc: RectangleF;

begin

rc := RectangleF.Create(50, 50, 100, 15);

f := Font.Create('Arial', 10, FontStyle.Underline);

_c1pdf.AddLink('http://www.componentone.com', rc);

_c1pdf.DrawString('Visit ComponentOne', f, Brushes.Blue, rc);

end;


C1PDFAddLinkMethod - C#

C#

RectangleF rc = new RectangleF(50, 50, 100, 15);

Font font = new Font("Arial", 10, FontStyle.Underline);

_c1pdf.AddLink("http://www.componentone.com", rc);

_c1pdf.DrawString("Visit ComponentOne", font, Brushes.Blue, rc);


C1PDFAddLinkMethod - Delphi

Delphi

var

f: System.Drawing.Font;

rc: RectangleF;

begin

rc := RectangleF.Create(50, 50, 100, 15);

f := Font.Create('Arial', 10, FontStyle.Underline);

_c1pdf.AddLink('http://www.componentone.com', rc);

_c1pdf.DrawString('Visit ComponentOne', f, Brushes.Blue, rc);

end;


C1PDFAddLinkMethod- Visual Basic

Visual Basic

Dim rc As New RectangleF(50, 50, 100, 15)

Dim font As New Font("Arial", 10, FontStyle.Underline)

_c1pdf.AddLink("http://www.componentone.com", rc)

_c1pdf.DrawString("Visit ComponentOne", font, Brushes.Blue, rc)


C1PDFAddLink - Visual Basic

Visual Basic

Dim rc As New RectangleF(50, 50, 100, 15)

Dim font As New Font("Arial", 10, FontStyle.Underline)

_c1pdf.AddLink("http://www.componentone.com", rc)

_c1pdf.DrawString("Visit ComponentOne", font, Brushes.Blue, rc)


C1PDFAddTarget - C#

C#

// initialize

_c1pdf.Clear();

// create a regular (external) hyperlink

RectangleF rc = new RectangleF(50, 50, 200, 15);

Font font = new Font("Arial", 10, FontStyle.Underline);

_c1pdf.AddLink("http://www.componentone.com", rc);

_c1pdf.DrawString("Visit ComponentOne", font, Brushes.Blue, rc);

// create a link target

_c1pdf.AddTarget("#myLink", rc);

// add a few pages

for (int i = 0; i < 5; i++)

_c1pdf.NewPage();

// add a link to the target

_c1pdf.AddLink("#myLink", rc);

_c1pdf.FillRectangle(Brushes.BlanchedAlmond, rc);

_c1pdf.DrawString("Local link: back to page 1...", font, Brushes.Blue, rc);

// save document

_c1pdf.Save(@"c:\temp\links.pdf");


C1PDFAddTarget - Delphi

Delphi

var

rc: RectangleF;

font: System.Drawing.Font;

i: Integer;

begin

rc := RectangleF.Create(50, 50, 200, 15);

font := System.Drawing.Font.Create('Arial', 10, FontStyle.Underline);

// initialize

_c1pdf.Clear;

// create a regular (external) hyperlink

_c1pdf.AddLink('http://www.componentone.com', rc);

_c1pdf.DrawString('Visit ComponentOne', font, Brushes.Blue, rc);

// create a link target

_c1pdf.AddTarget('#myLink', rc);

// add a few pages

for i = 0 to 4 do

_c1pdf.NewPage;

// add a link to the target

_c1pdf.AddLink('#myLink', rc);

_c1pdf.FillRectangle(Brushes.BlanchedAlmond, rc);

_c1pdf.DrawString('Local link: back to page 1...', font, Brushes.Blue, rc);

// save document

_c1pdf.Save('');

end;


C1PDFAddTarget- Visual Basic

Visual Basic

' initialize

_c1pdf.Clear()

' create a regular (external) hyperlink

Dim rc As New RectangleF(50, 50, 200, 15)

Dim font As New Font("Arial", 10, FontStyle.Underline)

_c1pdf.AddLink("http://www.componentone.com", rc)

_c1pdf.DrawString("Visit ComponentOne", font, Brushes.Blue, rc)

' create a link target

_c1pdf.AddTarget("#myLink", rc)

' add a few pages

Dim i As Integer

For i = 0 To 4

_c1pdf.NewPage()

Next i

' add a link to the target

_c1pdf.AddLink("#myLink", rc)

_c1pdf.FillRectangle(Brushes.BlanchedAlmond, rc)

_c1pdf.DrawString("Local link: back to page 1...", font, Brushes.Blue, rc)

' save document

_c1pdf.Save("c:\temp\links.pdf")


C1PDFCompression - C#

C#

foreach (C1.C1Pdf.CompressionEnum compression in

Enum.GetValues(typeof(C1.C1Pdf.CompressionEnum)))

{

// initialize control and Compression

_c1pdf.Clear();

_c1pdf.Compression = compression;

DateTime start = DateTime.Now;

// create a long document

CreateDocument();

// show the result

_c1pdf.Save(string.Format(@"c:\test\{0}.pdf",

compression.ToString()));

TimeSpan ts = DateTime.Now-start;

Console.WriteLine("Done with {0} in {1} seconds",

compression, ts.TotalSeconds);

}


C1PDFCompression - Delphi

Delphi

var

c: C1.C1Pdf.CompressionEnum;

i: Integer;

items: array of System.Object;

start: System.DateTime;

ts: TimeSpan;

begin

items := Enum.GetValues(typeof(C1.C1Pdf.CompressionEnum));

for i := 0 to High(items) do

begin

c := C1.C1Pdf.CompressionEnum(items[i]);

// initialize control and Compression

_c1pdf.Clear;

_c1pdf.Compression := c;

start := DateTime.Now;

// create a long document

CreateDocument;

// show the result

_c1pdf.Save(System.String.Format('c:\test\{0}.pdf', compression.ToString));

ts := DateTime.Now - start;

Console.WriteLine('Done with {0} in {1} seconds', compression, ts.TotalSeconds);

end;

end;


C1PDFCompression - Visual Basic

Visual Basic

Dim compression As C1.C1Pdf.CompressionEnum

Dim compType As Type = GetType(C1.C1Pdf.CompressionEnum)

For Each compression In System.Enum.GetValues(compType)

' initialize control and Compression

_c1pdf.Clear()

_c1pdf.Compression = compression

DateTime(start = DateTime.Now)

' create a long document

CreateDocument()

' show the result

_c1pdf.Save(String.Format("c:\test\{0}.pdf", compression.ToString()))

TimeSpan(ts = DateTime.Now - start)

Console.WriteLine("Done with {0} in {1} seconds", _

compression, ts.TotalSeconds)

Next


C1PDFCurrentPage - C#

C#

private void AddFooters()

{

Font font = new Font("Tahoma", 7, FontStyle.Bold);

StringFormat sf = new StringFormat();

sf.Alignment = StringAlignment.Center;

for (int page = 0; page < _c1pdf.Pages.Count; page++)

{

// select page

_c1pdf.CurrentPage = page;

// build rectangle for rendering the footer

RectangleF rc = _c1pdf.PageRectangle;

rc.Y = rc.Bottom – 36;

// write the footer

string text = string.Format("Page {0} of {1}",

page+1, _c1pdf.Pages.Count);

_c1pdf.DrawString(text, font, Brushes.Gray, rc, sf);

}

}


C1PDFCurrentPage - Delphi

Delphi

procedure AddFooters;

var

f: System.Drawing.Font;

sf: StringFormat;

page: Integer;

rc: RectangleF;

text: string;

begin

f := System.Drawing.Font.Create('Tahoma', 7, FontStyle.Bold);

sf := StringFormat.Create;

sf.Alignment := StringAlignment.Center;

for page := 0 to _c1pdf.Pages.Count - 1 do

begin

// select page

_c1pdf.CurrentPage := page;

// build rectangle for rendering the footer

rc := _c1pdf.PageRectangle;

rc.Y := rc.Bottom – 36;

// write the footer

text := System.String.Format('Page {0} of {1}', page + 1, _c1pdf.Pages.Count);

_c1pdf.DrawString(text, f, Brushes.Gray, rc, sf);

end;

end;


C1PDFCurrentPage - Visual Basic

Visual Basic

Private Sub AddFooters()

Dim font As New Font("Tahoma", 7, FontStyle.Bold)

Dim sf As New StringFormat()

sf.Alignment = StringAlignment.Center

Dim page As Integer

For page = 0 To _c1pdf.Pages.Count - 1

' select page

_c1pdf.CurrentPage = page

' build rectangle for rendering the footer

Dim rc As RectangleF = _c1pdf.PageRectangle

rc.Y = rc.Bottom

' write the footer

Dim text As String

text = String.Format("Page {0} of {1}", page + 1, _c1pdf.Pages.Count)

_c1pdf.DrawString(text, font, Brushes.Gray, rc, sf)

Next page

End Sub 'AddFooters


C1PDFDocument DeclareObjects- C#

C#

// Define a new object based on your C1PdfDocument class.//

MyC1PdfDocument as C1PdfDocument;

// Define a new C1Pdf.C1PdfDocument object.

Pdf as C1.C1Pdf.C1PdfDocument;


C1PDFDocumentDeclareObjects - Delphi

Delphi

// Define a new object based on your C1PdfDocument class.;

MyC1PdfDocument: C1PdfDocument;

// Define a new C1Pdf.C1PdfDocument object.;

Pdf: C1.C1Pdf.C1PdfDocument;


C1PDFDocumentDeclareObjects - Visual Basic#

Visual Basic

' Define a new object based on your C1PdfDocument class.'

Dim MyC1PdfDocument as C1PdfDocument

' Define a new C1Pdf.C1PdfDocument object.

Dim Pdf as C1.C1Pdf.C1PdfDocument


C1PDFDrawArc - C#

C#

_c1pdf.Clear();

RectangleF rc = new RectangleF(0, 0, 200, 180);

_c1pdf.DrawEllipse(Pens.Gray, rc);

_c1pdf.DrawArc(new Pen(Color.Black, 4), rc, 0, 45);

_c1pdf.DrawArc(new Pen(Color.Red, 4), rc, 0, -45);

_c1pdf.Save(@"c:\temp\arc.pdf");


C1PDFDrawArc - Delphi

Delphi

var

rc: RectangleF;

begin

_c1pdf.Clear;

rc := RectangleF.Create(0, 0, 200, 180);

_c1pdf.DrawEllipse(Pens.Gray, rc);

_c1pdf.DrawArc(Pen.Create(Color.Black, 4), rc, 0, 45);

_c1pdf.DrawArc(Pen.Create(Color.Red, 4), rc, 0, -45);

_c1pdf.Save('c:\temp\arc.pdf');

end;


C1PDFDrawArc - Visual Basic

Visual Basic

_c1pdf.Clear()

Dim rc As New RectangleF(0, 0, 200, 180)

_c1pdf.DrawEllipse(Pens.Gray, rc)

_c1pdf.DrawArc(New Pen(Color.Black, 4), rc, 0, 45)

_c1pdf.DrawArc(New Pen(Color.Red, 4), rc, 0, - 45)

_c1pdf.Save("c:\temp\arc.pdf")


C1PDFDrawBezier - C#

C#

_c1pdf.Clear();

// define points

PointF[] pts = new PointF[]

{

new PointF(100, 100), new PointF(120, 30),

new PointF(200, 140), new PointF(230, 20),

};

// draw Bezier spline

Pen bluePen = new Pen(Color.Blue, 4);

_c1pdf.DrawBezier(bluePen, pts[0], pts[1], pts[2], pts[3]);

// show points

_c1pdf.DrawLines(Pens.Gray, pts);

foreach (PointF pt in pts)

_c1pdf.DrawRectangle(Pens.Red, pt.X-2, pt.Y-2, 4, 4);

// save document

_c1pdf.Save(@"c:\temp\bezier.pdf");


C1PDFDrawBezier - Delphi

Delphi

var

bluePen: Pen;

pts: array of PointF;

begin

_c1pdf.Clear;

// define points

SetLength(pts, 4);

pts[0] := PointF.Create(100, 100);

pts[1] := PointF.Create(120, 30);

pts[2] := PointF.Create(200, 140);

pts[3] := PointF.Create(230, 20);

// draw Bezier spline;

bluePen := Pen.Create(Color.Blue, 4);

_c1pdf.DrawBezier(bluePen, pts[0], pts[1], pts[2], pts[3]);

_c1pdf.DrawLines(Pens.Gray, pts);

_c1pdf.Save('c:\temp\bezier.pdf');

end;


C1PDFDrawBeziersEx2 - C#

C#

_c1pdf.Clear();

// create points

PointF[] pts = new PointF[]

{

new PointF( 50f, 100f), new PointF(100f, 10f), new PointF(250f, 50f),

new PointF(400f, 100f), new PointF(500f, 150f), new PointF(550f, 250f),

new PointF(400f, 300f)

};

// draw Bezier spline

_c1pdf.DrawBeziers(new Pen(Color.Blue, 4), pts);

// show points

_c1pdf.DrawLines(Pens.Gray, pts);

for (int i = 0; i < pts.Length; i++)

{

Brush brush = (i % 3 == 0)? Brushes.Red: Brushes.Green;

_c1pdf.FillRectangle(brush, pts[i].X-2, pts[i].Y-2, 4, 4);

}

// save document

_c1pdf.Save(@"c:\temp\beziers.pdf");


C1PDFDrawBeziersEx2 - Delphi

Delphi

var

brush: Brush;

i: Integer;

pts: array of PointF;

begin

_c1pdf.Clear;

// create points;

SetLength(pts, 7);

pts[0] := PointF.Create(50, 100);

pts[1] := PointF.Create(100, 10);

pts[2] := PointF.Create(250, 50);

pts[3] := PointF.Create(400, 100);

pts[4] := PointF.Create(500, 150);

pts[5] := PointF.Create(550, 250);

pts[6] := PointF.Create(400, 300);

// draw Bezier spline;

_c1pdf.DrawBeziers(Pen.Create(Color.Blue, 4), pts);

// show points;

_c1pdf.DrawLines(Pens.Gray, pts);

for i := 0 to pts.Length - 1 do

_c1pdf.FillRectangle(brush, (pts[i].X - 2), (pts[i].Y - 2), 4, 4);

// save document;

_c1pdf.Save('c:\temp\beziers.pdf');

end;


C1PDFDrawBeziersEx2 - Visual Basic

Visual Basic

_c1pdf.Clear()

' create points

Dim pts() As PointF = { _
New PointF(50F, 100F),
New PointF(100F, 10F), _
New PointF(250F, 50F), New PointF(400F,
100F), _
New PointF(500F, 150F), New PointF(550F, 250F),
_
New PointF(400F, 300F)}

' draw Bezier spline

_c1pdf.DrawBeziers(New Pen(Color.Blue, 4), pts)

' show points

_c1pdf.DrawLines(Pens.Gray, pts)

Dim i As Integer

For i = 0 To pts.Length - 1

Dim brush As Brush

brush = Iif(i Mod 3 = 0, Brushes.Red, Brushes.Green)

_c1pdf.FillRectangle(brush, pts(i).X - 2, pts(i).Y - 2, 4, 4)

Next i

' save document

_c1pdf.Save("c:\temp\beziers.pdf")


C1PDFDrawBezier - Visual Basic

Visual Basic

_c1pdf.Clear()

' define points

Dim pts() As PointF = {New PointF(100, 100), New PointF(120, 30), New PointF(200, 140), New PointF(230, 20)}

' draw Bezier spline

Dim bluePen As New Pen(Color.Blue, 4)

_c1pdf.DrawBezier(bluePen, pts(0), pts(1), pts(2), pts(3))

' show points

_c1pdf.DrawLines(Pens.Gray, pts)

Dim pt As PointF

For Each pt In pts

_c1pdf.DrawRectangle(Pens.Red, pt.X - 2, pt.Y - 2, 4, 4)

Next pt

' save document

_c1pdf.Save("c:\temp\bezier.pdf")


C1PDFDrawImageEnum - C#

C#

_c1pdf.Clear();

Image img = pictureBox1.Image;

// stretch image to fill the rectangle

Rectangle rc = new Rectangle(100,100,50,30);

_c1pdf.DrawImage(img, rc);

_c1pdf.DrawRectangle(Pens.Black, rc);

// render in actual size, clipping if necessary

rc.Offset(rc.Width+20, 0);

_c1pdf.DrawImage(img, rc,

ContentAlignment.MiddleLeft, ImageSizeModeEnum.Clip);

_c1pdf.DrawRectangle(Pens.Black, rc);

// scale the image to fit the rectangle while preserving the aspect ratio

rc.Offset(rc.Width+20, 0);

_c1pdf.DrawImage(img, rc,

ContentAlignment.MiddleLeft, ImageSizeModeEnum.Scale);

_c1pdf.DrawRectangle(Pens.Black, rc);

// step 3: save the document to a file

_c1pdf.Save(@"c:\temp\image.pdf");


C1PDFDrawImageEnum - Delphi

Delphi

var

rc: Rectangle;

img: Image;

begin

_c1pdf.Clear;

img := pictureBox1.Image;

// stretch image to fill the rectangle;

rc := Rectangle.Create(100, 100, 50, 30);

_c1pdf.DrawImage(img, rc);

_c1pdf.DrawRectangle(Pens.Black, rc);

// render in actual size, clipping if necessary;

rc.Offset((rc.Width + 20), 0);

_c1pdf.DrawImage(img, rc, ContentAlignment.MiddleLeft, ImageSizeModeEnum.Clip);

_c1pdf.DrawRectangle(Pens.Black, rc);

// scale the image to fit the rectangle while preserving the aspect ratio;

rc.Offset((rc.Width + 20), 0);

_c1pdf.DrawImage(img, rc, ContentAlignment.MiddleLeft, ImageSizeModeEnum.Scale);

_c1pdf.DrawRectangle(Pens.Black, rc);

// step 3: save the document to a file

_c1pdf.Save('c:\temp\image.pdf');

end;


C1PDFDrawImageEnum - Visual Basic

Visual Basic

_c1pdf.Clear()

Dim img As Image = pictureBox1.Image

' stretch image to fill the rectangle

Dim rc As New Rectangle(100, 100, 50, 30)

_c1pdf.DrawImage(img, rc)

_c1pdf.DrawRectangle(Pens.Black, rc)

' render in actual size, clipping if necessary

rc.Offset(rc.Width + 20, 0)

_c1pdf.DrawImage(img, rc, ContentAlignment.MiddleLeft, ImageSizeModeEnum.Clip)

_c1pdf.DrawRectangle(Pens.Black, rc)

' scale the image to fit the rectangle while preserving the aspect ratio

rc.Offset(rc.Width + 20, 0)

_c1pdf.DrawImage(img, rc, ContentAlignment.MiddleLeft, ImageSizeModeEnum.Scale)

_c1pdf.DrawRectangle(Pens.Black, rc)

' step 3: save the document to a file

_c1pdf.Save("c:\temp\image.pdf")


C1PDF DrawImages - C#

C#

RectangleF rc = pdf.PageRectangle;

rc.Inflate(-72, -72);

// stretch image to fill the rectangle

pdf.DrawImage(pictureBox1.Image, rc);

// center image within the rectangle, scale keeping aspect ratio

pdf.DrawImage(pictureBox1.Image, rc,

ContentAlignment.MiddleCenter,

C1.C1Pdf.ImageSizeModeEnum.Scale);

// center image within the rectangle, keep original size

pdf.DrawImage(pictureBox1.Image, rc,

ContentAlignment.TopLeft,

C1.C1Pdf.ImageSizeModeEnum.Clip);


C1PDF DrawImages - Delphi

Delphi

var

rc: RectangleF;

begin

rc := pdf.PageRectangle;

rc.Inflate(-72, -72);

// stretch image to fill the rectangle

pdf.DrawImage(pictureBox1.Image, rc);

// center image within the rectangle, scale keeping aspect ratio

pdf.DrawImage(pictureBox1.Image, rc, ContentAlignment.MiddleCenter, C1.C1Pdf.ImageSizeModeEnum.Scale);

// center image within the rectangle, keep original size

pdf.DrawImage(pictureBox1.Image, rc, ContentAlignment.TopLeft, C1.C1Pdf.ImageSizeModeEnum.Clip);

end;


C1PDF DrawImages - Visual Basic

Visual Basic

Dim rc As RectangleF = pdf.PageRectangle

rc.Inflate(- 72, - 72)

' stretch image to fill the rectangle

pdf.DrawImage(pictureBox1.Image, rc)

' center image within the rectangle, scale keeping aspect ratio

pdf.DrawImage(pictureBox1.Image, rc, ContentAlignment.MiddleCenter, C1.C1Pdf.ImageSizeModeEnum.Scale)

' center image within the rectangle, keep original size

pdf.DrawImage(pictureBox1.Image, rc, ContentAlignment.TopLeft, C1.C1Pdf.ImageSizeModeEnum.Clip)


C1PDFDrawingRTF - C#

C#

Font font = new Font("Arial", 12);

RectangleF rc = pdf.PageRectangle;

rc.Inflate(-72, -72);

pdf.DrawStringRtf(

@"To {\b boldly} go where {\i no one} has gone before!",

font, Brushes.Black, rc);


C1PDFDrawingRTF - Delphi

Delphi

var

rc: RectangleF;

f: System.Drawing.Font;

begin

f := System.Drawing.Font.Create('Arial', 12);

rc := pdf.PageRectangle;

rc.Inflate(-72, -72);

pdf.DrawStringRtf('To {\b boldly} go where {\i no one} has gone before!', f, Brushes.Black, rc);

end;


C1PDFDrawingRTF - Visual Basic

Visual Basic

Dim font As New Font("Arial", 12)

Dim rc As RectangleF = pdf.PageRectangle

rc.Inflate(- 72, - 72)
Dim s As String
s = "To {\b boldly}
go where {\i no one} has gone before!"

pdf.DrawStringRtf(s, font, Brushes.Black, rc)


C1PDFDrawLineMethod - C#

C#

_c1pdf.Clear();

// create a thick (3pt) blue pen

Pen thickPen = new Pen(Color.Blue, 3);

// create a thick (2pt) dotted red pen

Pen dotPen = new Pen(Color.Red, 2);

dotPen.DashStyle = DashStyle.Dot;

// draw some lines

_c1pdf.DrawLine(thinPen, 100, 100, 300, 100);

_c1pdf.DrawLine(thickPen, 100, 120, 300, 120);

_c1pdf.DrawLine(dotPen, 100, 140, 300, 140);

// save the document to a file

_c1pdf.Save(@"c:\temp\drawline.pdf");


C1PDFDrawLineMethod - Delphi

Delphi

var

dotPen: Pen;

thickPen: Pen;

begin

_c1pdf.Clear;

// create a thick (2pt) dotted red pen;

thickPen := Pen.Create(Color.Blue, 3);

dotPen := Pen.Create(Color.Red, 2);

dotPen.DashStyle := DashStyle.Dot;

// draw some lines;

_c1pdf.DrawLine(thinPen, 100, 100, 300, 100);

_c1pdf.DrawLine(thickPen, 100, 120, 300, 120);

_c1pdf.DrawLine(dotPen, 100, 140, 300, 140);

_c1pdf.Save('c:\temp\drawline.pdf');

end;


C1PDFDrawLineMethod - Visual Basic

Visual Basic

_c1pdf.Clear()

' create a thick (3pt) blue pen

Dim thickPen As New Pen(Color.Blue, 3)

' create a thick (2pt) dotted red pen

Dim dotPen As New Pen(Color.Red, 2)

dotPen.DashStyle = DashStyle.Dot

' draw some lines

_c1pdf.DrawLine(thinPen, 100, 100, 300, 100)

_c1pdf.DrawLine(thickPen, 100, 120, 300, 120)

_c1pdf.DrawLine(dotPen, 100, 140, 300, 140)

' save the document to a file

_c1pdf.Save("c:\temp\drawline.pdf")


C1PDFDrawPie - C#

C#

// create an array with some brushes

Brush[] brushes = new Brush[]

{

Brushes.Red, Brushes.Green, Brushes.Blue,

Brushes.Yellow, Brushes.Crimson, Brushes.Aquamarine

};

// setup rectangle and initialize angles

RectangleF rc = new RectangleF(100,100,180,150);

float startAngle = 0;

float sweepAngle = -90; // << counter-clockwise

// draw pie

foreach (Brush brush in brushes)

{

_c1pdf.FillPie(brush, rc, startAngle, sweepAngle);

_c1pdf.DrawPie(Pens.Black, rc, startAngle, sweepAngle);

startAngle += sweepAngle;

sweepAngle /= 2;

}

// save the document to a file

_c1pdf.Save(@"c:\temp\pie.pdf");


C1PDFDrawPie - Delphi

Delphi

var

fileName: string;

sweepAngle: System.Single;

startAngle: System.Single;

rc: RectangleF;

brushes: array of Brush;

begin

brushes := [Brushes.Red, Brushes.Green, Brushes.Blue, Brushes.Yellow, Brushes.Crimson, Brushes.Aquamarine];

rc := RectangleF.Create(100, 100, 180, 150);

startAngle := 0;

sweepAngle := -90; // << counter-clockwise;

// draw pie;

_c1pdf.FillPie(brush, rc, startAngle, sweepAngle);

_c1pdf.DrawPie(Pens.Black, rc, startAngle, sweepAngle);

// save the document to a file;

_c1pdf.Save('c:\temp\pie.pdf');

end;


C1PDFDrawPie - Visual Basic

Visual Basic

' create an array with some brushes

Dim brushes() As Brush = {Brushes.Red, Brushes.Green, Brushes.Blue, Brushes.Yellow, Brushes.Crimson, Brushes.Aquamarine}

' setup rectangle and initialize angles

Dim rc As New RectangleF(100, 100, 180, 150)

Dim startAngle As Single = 0

Dim sweepAngle As Single = - 90 ' << counter-clockwise

' draw pie

Dim brush As Brush

For Each brush In brushes

_c1pdf.FillPie(brush, rc, startAngle, sweepAngle)

_c1pdf.DrawPie(Pens.Black, rc, startAngle, sweepAngle)

startAngle += sweepAngle

sweepAngle /= 2

Next brush

' save the document to a file

_c1pdf.Save("c:\temp\pie.pdf")


C1PDFDrawPolygon - C#

C#

_c1pdf.Clear();

// create an array with some points

PointF[] points = new PointF[]

{

new PointF(100, 100), new PointF(300, 100), new PointF(200, 200)

};

// fill and draw a polygon

_c1pdf.FillPolygon(Brushes.Beige, points);

_c1pdf.DrawPolygon(Pens.Black, points);

// save the document to a file

_c1pdf.Save(@"c:\temp\poly.pdf");


C1PDFDrawPolygon - Delphi

Delphi

// create an array with some points;

var

points: array of PointF;

begin

_c1pdf.Clear;

SetLength(points, 3);

points[0] := PointF.Create(100, 100);

points[1] := PointF.Create(300, 100);

points[2] := PointF.Create(200, 200);

// fill and draw a polygon;

_c1pdf.FillPolygon(Brushes.Beige, points);

_c1pdf.DrawPolygon(Pens.Black, points);

_c1pdf.Save('c:\temp\poly.pdf');

end;


C1PDFDrawPolygon - Visual Basic

Visual Basic

_c1pdf.Clear()

' create an array with some points

Dim points() As PointF = {New PointF(100, 100), New PointF(300, 100), New PointF(200, 200)}

' fill and draw a polygon

_c1pdf.FillPolygon(Brushes.Beige, points)

_c1pdf.DrawPolygon(Pens.Black, points)

' save the document to a file

_c1pdf.Save("c:\temp\poly.pdf")


C1PDFDrawRectangleMethod - C#

C#

_c1pdf.Clear();

// create a rectangle

RectangleF rc = new RectangleF(100,100,200,150);

// draw rectangles with round corners

for (int corner = 10; corner < 100; corner += 20)

{

SizeF sz = new SizeF(corner, corner/2);

_c1pdf.FillRectangle(Brushes.Beige, rc, sz);

_c1pdf.DrawRectangle(Pens.Blue, rc, sz);

}

// draw a regular rectangle

_c1pdf.DrawRectangle(Pens.Black, rc);

// save the document to a file

_c1pdf.Save(@"c:\temp\rect.pdf");


C1PDFDrawRectangleMethod - Delphi

Delphi

var

sz: SizeF;

corner: Integer;

rc: RectangleF;

begin

_c1pdf.Clear;

rc := RectangleF.Create(100, 100, 200, 150);

corner := 10;

while corner < 100 do

begin

sz := SizeF.Create(corner, (corner / 2));

_c1pdf.FillRectangle(Brushes.Beige, rc, sz);

_c1pdf.DrawRectangle(Pens.Blue, rc, sz);

corner := corner + 20;

end;

// draw a regular rectangle;

_c1pdf.DrawRectangle(Pens.Black, rc);

// save the document to a file;

_c1pdf.Save('c:\temp\rect.pdf');

end;


C1PDFDrawRectangleMethod - Visual Basic

Visual Basic

_c1pdf.Clear()

' create a rectangle

Dim rc As New RectangleF(100, 100, 200, 150)

' draw rectangles with round corners

Dim corner As Integer

For corner = 10 To 100 - 20 Step 20

Dim sz As New SizeF(corner, corner / 2)

_c1pdf.FillRectangle(Brushes.Beige, rc, sz)

_c1pdf.DrawRectangle(Pens.Blue, rc, sz)

Next corner

' draw a regular rectangle

_c1pdf.DrawRectangle(Pens.Black, rc)

' save the document to a file

_c1pdf.Save("c:\temp\rect.pdf")


C1PDFDrawStringMethodEx1 - C#

C#

_c1pdf.Clear();

// set up to draw

Font font = new Font("Tahoma", 14);

RectangleF rc = new RectangleF(100,100,150,28);

// draw string using default options (left-top alignment, no clipping)

string text = "This string is being rendered using the default options.";

_c1pdf.DrawString(text, font, Brushes.Black, rc);

_c1pdf.DrawRectangle(Pens.Black, rc);

// create StringFormat to center align and clip

StringFormat sf = new StringFormat();

sf.Alignment = StringAlignment.Center;

sf.LineAlignment = StringAlignment.Center;

sf.FormatFlags&= ~StringFormatFlags.NoClip;

// render again using custom options

rc.Offset(0, rc.Height + 30);

text = "This string is being rendered using custom options.";

_c1pdf.DrawString(text, font, Brushes.Black, rc, sf);

_c1pdf.DrawRectangle(Pens.Black, rc);

// save the document to a file

_c1pdf.Save(@"c:\temp\string.pdf");


C1PDFDrawStringMethodEx1 - Delphi

Delphi

var

f: System.Drawing.Font;

rc: RectangleF;

text: String;

sf: StringFormat;

begin

f := System.Drawing.Font.Create('Tahoma', 14);

rc := RectangleF.Create(100, 100, 150, 28);

sf := StringFormat.Create();

_c1pdf.Clear;

// set up to draw

// draw string using default options (left-top alignment, no clipping)

text := 'This string is being rendered using the default options.';

_c1pdf.DrawString(text, f, Brushes.Black, rc);

_c1pdf.DrawRectangle(Pens.Black, rc);

// create StringFormat to center align and clip

sf.Alignment := StringAlignment.Center;

sf.LineAlignment := StringAlignment.Center;

sf.FormatFlags := sf.FormatFlags And Not StringFormatFlags.NoClip;

// render again using custom options

rc.Offset(0, rc.Height + 30);

text := 'This string is being rendered using custom options.';

_c1pdf.DrawString(text, f, Brushes.Black, rc, sf);

_c1pdf.DrawRectangle(Pens.Black, rc);

// save the document to a file

_c1pdf.Save('c:\temp\string.pdf');

end;


C1PDFDrawStringMethodEx1- Visual Basic

Visual Basic

_c1pdf.Clear()

' set up to draw

Dim font As New Font("Tahoma", 14)

Dim rc As New RectangleF(100, 100, 150, 28)

' draw string using default options (left-top alignment, no clipping)

Dim text As String = "This string is being rendered using the default options."

_c1pdf.DrawString(text, font, Brushes.Black, rc)

_c1pdf.DrawRectangle(Pens.Black, rc)

' create StringFormat to center align and clip

Dim sf As New StringFormat()

sf.Alignment = StringAlignment.Center

sf.LineAlignment = StringAlignment.Center

sf.FormatFlags = sf.FormatFlags And Not StringFormatFlags.NoClip

' render again using custom options

rc.Offset(0, rc.Height + 30)

text = "This string is being rendered using custom options."

_c1pdf.DrawString(text, font, Brushes.Black, rc, sf)

_c1pdf.DrawRectangle(Pens.Black, rc)

' save the document to a file

_c1pdf.Save("c:\temp\string.pdf")

String.pdf


C1PDFDrawStringMethodEx2- C#

C#

_c1pdf.Clear();

// set up to draw

Font font = new Font("Tahoma", 14);

RectangleF rc = new RectangleF(100,100,300,28);

// measure RTF text and adjust the rectangle to fit

string text = @"Short {\b RTF} snippet with some " +

"{\b bold} and some {\i italics} in it.";

rc.Y = rc.Bottom + 12;

rc.Height = _c1pdf.MeasureStringRtf(text, font, rc.Width).Height;

// render RTF snippet

_c1pdf.DrawStringRtf(text, font, Brushes.Blue, rc);

_c1pdf.DrawRectangle(Pens.Black, rc);

// save the document to a file

_c1pdf.Save(@"c:\temp\rtf.pdf");


C1PDFDrawStringMethodEx2 - Delphi

Delphi

var

text: string;

rc: RectangleF;

f: System.Drawing.Font;

begin

_c1pdf.Clear;

font := System.Drawing.Font.Create('Tahoma', 14);

rc := RectangleF.Create(100, 100, 300, 28);

text := 'Short {\b RTF} snippet with some ' + '{'\b'bold} and some { italics} in it.';

rc.Y := (rc.Bottom + 12);

rc.Height := _c1pdf.MeasureStringRtf(text, font, rc.Width).Height;

// render RTF snippet;

_c1pdf.DrawStringRtf(text, font, Brushes.Blue, rc);

_c1pdf.DrawRectangle(Pens.Black, rc);

// save the document to a file;

_c1pdf.Save('c:\temp\rtf.pdf');

end;


C1PDFDrawStringMethodEx2- Visual Basic

Visual Basic

_c1pdf.Clear()

' set up to draw

Dim f As Font = New Font("Tahoma", 14)

Dim rc As New RectangleF(100, 100, 300, 28)

' measure RTF text and adjust the rectangle to fit

Dim text As String = "Short {\b RTF} snippet with some " & _

"{\b bold} and some {\i italics} in it."

rc.Y = rc.Bottom + 12

rc.Height = _c1pdf.MeasureStringRtf(Text, Font, rc.Width).Height

' render RTF snippet

_c1pdf.DrawStringRtf(text, f, Brushes.Blue, rc)

_c1pdf.DrawRectangle(Pens.Black, rc)

' save the document to a file

_c1pdf.Save("c:\temp\rtf.pdf")


C1PDFFlowingText - C#

C#

// render string spanning multiple pages

for (;;)

{

// render as much as will fit into the rectangle

int nextChar = _c1pdf.DrawString(text, font,

Brushes.Black, rcPage);

// break when done

if (nextChar >= text.Length)

break;

// get rid of the part that was rendered

text = text.Substring(nextChar);

// move on to the next page

_c1pdf.NewPage();

}


C1PDFFlowingText - Delphi

Delphi

var

nextChar: Integer;

begin

while True do

begin

nextChar := _c1pdf.DrawString(text, font, Brushes.Black, rcPage);

if (nextChar >= text.Length) then

text := text.Substring(nextChar);

_c1pdf.NewPage;

end;

end;


C1PDFFlowingText - Visual Basic

Visual Basic

' render as much as will fit into the rectangle

While True
Dim nextChar As Integer

nextChar = _c1pdf.DrawString(text, font, Brushes.Black, rcPage)

' break when done

If nextChar >= text.Length Then

Exit While

End If ' get rid of the part that was rendered

text = text.Substring(nextChar)

' move on to the next page

_c1pdf.NewPage()

End While


C1PDFGraphics - C#

C#

// create pdf document

C1.C1Pdf.C1PdfDocument g = new C1.C1Pdf.C1PdfDocument();

// set up to draw

Rectangle rc = new Rectangle(0,0,300,200);

string text = "Hello world of .NET Graphics and PDF.\r\n" +

"Nice to meet you.";

Font font = new Font("Times New Roman", 12,

FontStyle.Italic | FontStyle.Underline);

PointF[] bezierPoints = new PointF[]

{

new PointF(10f, 100f), new PointF(20f, 10f),

new PointF(35f, 50f), new PointF(50f, 100f),

new PointF(60f, 150f), new PointF(65f, 100f),

new PointF(50f, 50f)

};

// draw some pie slices

int penWidth = 0;

int penRGB = 0;

g.FillPie(Brushes.Red, rc, 0, 20f);

g.FillPie(Brushes.Green, rc, 20f, 30f);

g.FillPie(Brushes.Blue, rc, 60f, 12f);

g.FillPie(Brushes.Gold, rc, -80f, -20f);

// draw some arcs

for (float startAngle = 0; startAngle < 360; startAngle += 40)

{

Color penColor = Color.FromArgb(penRGB, penRGB, penRGB);

Pen pen = new Pen(penColor, penWidth++);

penRGB = penRGB + 20;

g.DrawArc(pen, rc, startAngle, 40f);

}

// draw a rectangle and some bezier splines

g.DrawRectangle(Pens.Red, rc);

g.DrawBeziers(Pens.Blue, bezierPoints);

g.DrawString(text, font, Brushes.Black, rc);


C1PDFGraphics - Delphi

Delphi

var

g: C1.C1Pdf.C1PdfDocument;

rc: Ractangle;

text: string;

f: Font;

bezierPoints: array of Point;

penWidth: Integer;

penRGB: Integer;

startAngle: Single;

penColor: System.Drawing.Color;

begin

// create pdf document

g := C1.C1Pdf.C1PdfDocument.Create;

// set up to draw

rc := Rectangle.Create(0, 0, 300, 200);

text := 'Hello world of .NET Graphics and PDF.'#13#10'Nice to meet you.';

SetLength(bezierPoints, 7);

bezierPoints[0] := PointF.Create(10, 100);

bezierPoints[1] := PointF.Create(20, 10);

bezierPoints[2] := PointF.Create(35, 50);

bezierPoints[3] := PointF.Create(50, 100);

bezierPoints[4] := PointF.Create(60, 150);

bezierPoints[5] := PointF.Create(65, 100);

bezierPoints[6] := PointF.Create(50, 50);

// draw some pie slices

penWidth := 0;

penRGB := 0;

g.FillPie(Brushes.Red, rc, 0, 20);

g.FillPie(Brushes.Green, rc, 20, 30);

g.FillPie(Brushes.Blue, rc, 60, 12);

g.FillPie(Brushes.Gold, rc, -80, -20);

// draw some arcs

startAnfgle = 0;

while startAngle <= 360 - 40 do

begin

penColor := System.Drawing.Color.FromArgb(penRGB, penRGB, penRGB);

pen := Pen.Create(penColor, penWidth); // ToDo: ++ operator not supported within expressions

penWidth := penWidth + 1;

penRGB := penRGB + 20;

g.DrawArc(pen, rc, startAngle, 40);

startAngle := startAngle + 40;

end;

// draw a rectangle and some bezier splines

g.DrawRectangle(Pens.Red, rc)

g.DrawBeziers(Pens.Blue, bezierPoints)

g.DrawString(text, f, Brushes.Black, rc)

end;


C1PDFGraphics- Visual Basic

Visual Basic

' create pdf document

Dim g As New C1.C1Pdf.C1PdfDocument()

' set up to draw

Dim rc As New Rectangle(0, 0, 300, 200)

Dim text As String = "Hello world of .NET Graphics and PDF." &_
ControlChars.Cr + ControlChars.Lf + "Nice to meet you."

Dim font As New Font("Times New Roman", 12, _
FontStyle.Italic Or FontStyle.Underline)

Dim bezierPoints() As PointF = { _
New
PointF(10F, 100F), New PointF(20F, 10F), _
New PointF(35F, 50F),
New PointF(50F, 100F), _
New PointF(60F, 150F), New PointF(65F,
100F), New PointF(50F, 50F)}

' draw some pie slices

Dim penWidth As Integer = 0

Dim penRGB As Integer = 0

g.FillPie(Brushes.Red, rc, 0, 20F)

g.FillPie(Brushes.Green, rc, 20F, 30F)

g.FillPie(Brushes.Blue, rc, 60F, 12F)

g.FillPie(Brushes.Gold, rc, - 80F, - 20F)

' draw some arcs

Dim startAngle As Single

For startAngle = 0 To 360 - 40 Step 40

Dim penColor As Color = Color.FromArgb(penRGB, penRGB, penRGB)
penWidth = penWidth + 1

Dim pen As New Pen(penColor, penWidth)

penRGB = penRGB + 20

g.DrawArc(pen, rc, startAngle, 40F)

Next

' draw a rectangle and some bezier splines

g.DrawRectangle(Pens.Red, rc)

g.DrawBeziers(Pens.Blue, bezierPoints)

g.DrawString(text, font, Brushes.Black, rc)


C1PDFHelloWorld - C#

C#

// create the C1PdfDocument object

C1.C1Pdf.C1PdfDocument pdf = new C1.C1Pdf.C1PdfDocument();

// add content to the page

RectangleF rc = pdf.PageRectangle;

rc.Inflate(-72, -72);

Font font = new Font("Arial", 12);

pdf.DrawString("Hello World!", font, Brushes.Black, rc);

// save the document to a file

pdf.Save(@"c:\temp\hello world.pdf");


C1PDFHelloWorld - Delphi

Delphi

var

font: Font;

rc: RectangleF;

pdf: C1.C1Pdf.C1PdfDocument;

begin

// add content to the page;

pdf := C1.C1Pdf.C1PdfDocument.Create;

rc := pdf.PageRectangle;

rc.Inflate(-72, -72);

font := Font.Create('Arial', 12);

pdf.DrawString('Hello World!', font, Brushes.Black, rc);

// save the document to a file;

pdf.Save('c:\temp\hello world.pdf');

end;


C1PDFHelloWorld - Visual Basic

Visual Basic

' create the C1PdfDocument object

Dim pdf As New C1.C1Pdf.C1PdfDocument()

' add content to the page

Dim rc As RectangleF = pdf.PageRectangle

rc.Inflate(-72, -72)

Dim font As Font = New Font("Arial",12)

pdf.DrawString("Hello World!", font, Brushes.Black, rc)

' save the document to a file

pdf.Save("c:\temp\hello world.pdf")


C1PDFImports - C#

C#

using C1PdfDocument = C1.C1Pdf.C1PdfDocument;

using MyC1PdfDocument = MyProject.Objects.C1PdfDocument;

C1PdfDocument c1;

MyC1PdfDocument c2;


C1PDFImports - Delphi

Delphi

uses C1PdfDocument, MyC1PdfDocument;

c1: C1PdfDocument;

c2: MyC1PdfDocument;

C1PdfDocument := C1.C1Pdf.C1PdfDocument;

MyC1PdfDocument := MyProject.Objects.C1PdfDocument;


C1PDFImports - Visual Basic

Visual Basic

Imports C1PdfDocument = C1.C1Pdf.C1PdfDocument

Imports MyC1PdfDocument = MyProject.Objects.C1PdfDocument

Dim c1 As C1PdfDocument

Dim c2 As MyC1PdfDocument


C1PDFInsert - C#

C#

_c1pdf.Clear();

// set up to draw

Font font = new Font("Tahoma", 12);

RectangleF rc = pdf.PageRectangle;

rc.Inflate(-72, -72);

// create document with 5 numbered pages

for (int i = 0; i < 5; i++)

{

if (i > 0) _c1pdf.NewPage();

_c1pdf.DrawString("Page " + i.ToString(), font, Brushes.Black, rc);

_c1pdf.DrawRectangle(Pens.LightGray, rc);

}

// move the last page to the front of the document

PdfPage lastPage = _c1pdf.Pages[pdf.Pages.Count-1];

_c1pdf.Pages.Remove(lastPage);

_c1pdf.Pages.Insert(0, lastPage);

// save the document to a file

_c1pdf.Save(@"c:\temp\pages.pdf");


C1PDFInsert - Delphi

Delphi

var

fileName: string;

lastPage: PdfPage;

i: Integer;

rc: RectangleF;

font: Font;

begin

_c1pdf.Clear;

// set up to draw;

font := Font.Create('Tahoma', 12);

rc := pdf.PageRectangle;

rc.Inflate(-72, -72);

// create document with 5 numbered pages;

for I := 0 to 4 do

begin

if (i > 0) then

_c1pdf.NewPage;

_c1pdf.DrawString(('Page ' + i.ToString), font, Brushes.Black, rc);

_c1pdf.DrawRectangle(Pens.LightGray, rc);

end;

// move the last page to the front of the document;

lastPage := _c1pdf.Pages[(pdf.Pages.Count - 1)];

_c1pdf.Pages.Remove(lastPage);

_c1pdf.Pages.Insert(0, lastPage);

// save the document to a file;

fileName := 'c:\temp\pages.pdf';

pdf.Save(fileName);

end;


C1PDFInsert - Visual Basic

Visual Basic

c1pdf.Clear()

' set up to draw

Dim font As New Font("Tahoma", 12)

Dim rc As RectangleF = pdf.PageRectangle

rc.Inflate(- 72, - 72)

' create document with 5 numbered pages

Dim i As Integer

For i = 0 To 4

If i > 0 Then

_c1pdf.NewPage()

End If

_c1pdf.DrawString("Page " + i.ToString(), font, Brushes.Black, rc)

_c1pdf.DrawRectangle(Pens.LightGray, rc)

Next i

' move the last page to the front of the document

Dim lastPage As PdfPage = _c1pdf.Pages((pdf.Pages.Count - 1))

_c1pdf.Pages.Remove(lastPage)

_c1pdf.Pages.Insert(0, lastPage)

' save the document to a file

_c1pdf.Save("c:\temp\pages.pdf");


C1PDFLandscape - C#

C#

// create a 10 page document, make page 5 landscape

Font font = new Font("Arial", 12);

for (int i = 0; i < 10; i++)

{

if (i > 0) _c1pdf.NewPage();

_c1pdf.Landscape = (i == 4);

RectangleF rc = _c1pdf.PageRectangle;

rc.Inflate(-72, -72);

_c1pdf.DrawString("Hello", font, Brushes.Black, rc);

_c1pdf.DrawRectangle(Pens.Black, rc);

}

// save the file

string fileName = @"c:\temp\landscape.pdf";

_c1pdf.Save(fileName);


C1PDFLandscape - Delphi

Delphi

var

f: System.Drawing.Font;

i: Integer;

rc: RectangleF;

fileName: String;

begin

font := System.Drawing.Font.Create('Arial', 12);

// create a 10 page document, make page 5 landscape

for i = 0 to 9 do

begin

if i > 0 then

begin

_c1pdf.NewPage;

end;

_c1pdf.Landscape := i = 4;

rc := _c1pdf.PageRectangle;

rc.Inflate(- 72, - 72);

_c1pdf.DrawString('Hello', f, Brushes.Black, rc);

_c1pdf.DrawRectangle(Pens.Black, rc);

end;

// save the file

fileName := '';

_c1pdf.Save(fileName);

end;


C1PDFLandscape - Visual Basic

Visual Basic

' create a 10 page document, make page 5 landscape

Dim font As New Font("Arial", 12)

Dim i As Integer

For i = 0 To 9

If i > 0 Then

_c1pdf.NewPage()

End If

_c1pdf.Landscape = (i = 4)

Dim rc As RectangleF = _c1pdf.PageRectangle

rc.Inflate(- 72, - 72)

_c1pdf.DrawString("Hello", font, Brushes.Black, rc)

_c1pdf.DrawRectangle(Pens.Black, rc)

Next i

' save the file

Dim fileName As String = " c:\temp\landscape.pdf "

_c1pdf.Save(fileName)


C1PDFMeasureStringMethod - C#

C#

// set up to draw

string text = "We all came down to Montreux, " +

"by the Lake Geneva shoreline.";

Font font = new Font("Tahoma", 12);

RectangleF rc = new RectangleF(100,100,0,0);

// measure text on a single line

rc.Size = _c1pdf.MeasureString(text, font);

_c1pdf.DrawString(text, font, Brushes.Black, rc);

_c1pdf.DrawRectangle(Pens.LightGray, rc);

// update rectangle for next sample

rc.Y = rc.Bottom + 12;

rc.Width = 120;

// measure text that wraps

rc.Size = _c1pdf.MeasureString(text, font, rc.Width);

_c1pdf.DrawString(text, font, Brushes.Black, rc);

_c1pdf.DrawRectangle(Pens.LightGray, rc);

// save the document to a file

_c1pdf.Save(@"c:\temp\measure.pdf");


C1PDFMeasureStringMethod - Delphi

Delphi

var

text: String;

f: System.Drawing.Font;

rc: RectangleF;

begin

f := System.Drawing.Font.Create('Tahoma', 12);

rc := RectangleF.Create(100, 100, 0, 0);

// set up to draw

// measure text on a single line

rc.Size := _c1pdf.MeasureString([text], font);

_c1pdf.DrawString(text, f, Brushes.Black, rc);

_c1pdf.DrawRectangle(Pens.LightGray, rc);

// update rectangle for next sample

rc.Y := rc.Bottom + 12;

rc.Width := 120;

// measure text that wraps

rc.Size := _c1pdf.MeasureString(text, f, rc.Width);

_c1pdf.DrawString([text], font, Brushes.Black, rc);

_c1pdf.DrawRectangle(Pens.LightGray, rc);

// save the document to a file

_c1pdf.Save('c:\temp\measure.pdf');

end;


C1PDFMeasureStringMethod - Visual Basic

Visual Basic

' set up to draw

Dim text As String = "We all came down to Montreux, " & _
"by the Lake Geneva shoreline."

Dim font As New Font("Tahoma", 12)

Dim rc As New RectangleF(100, 100, 0, 0)

' measure text on a single line

rc.Size = _c1pdf.MeasureString(text, font)

_c1pdf.DrawString(text, font, Brushes.Black, rc)

_c1pdf.DrawRectangle(Pens.LightGray, rc)

' update rectangle for next sample

rc.Y = rc.Bottom + 12

rc.Width = 120

' measure text that wraps

rc.Size = _c1pdf.MeasureString(text, font, rc.Width)

_c1pdf.DrawString(text, font, Brushes.Black, rc)

_c1pdf.DrawRectangle(Pens.LightGray, rc)

' save the document to a file

_c1pdf.Save("c:\temp\measure.pdf")


C1PDFMeasuringText - C#

C#

private RectangleF RenderParagraph(string text,

Font font,

RectangleF rc, RectangleF rcPage)

{

// calculate necessary height

SizeF sz = _c1pdf.MeasureString(text, font, rc.Width);

rc.Height = sz.Height;

// if it won't fit this page, do a page break

if (rc.Bottom > rcPage.Bottom)

{

_c1pdf.NewPage();

rc.Y = rcPage.Top;

}

// draw the string

_c1pdf.DrawString(text, font, Brushes.Black, rc);

// update rectangle for next time

rc.Offset(0, rc.Height);

return rc;

}

// use the RenderParagraph method:

Font font = new Font("Arial", 10);

RectangleF rcPage = _c1pdf.PageRectangle;

rcPage.Inflate(-72, -72);

RectangleF rc = rcPage;

foreach (string s in myStringList)

rc = RenderParagraph(s, font, rc, rcPage);


C1PDFMeasuringText - Delphi

Delphi

function Class1.RenderParagraph(text: string; font: Font; rc: RectangleF; rcPage: RectangleF): RectangleF;

var

sz: SizeF;

begin

// calculate necessary height

sz := _c1pdf.MeasureString(text, font, rc.Width);

rc.Height := sz.Height;

// if it won't fit this page, do a page break

if (rc.Bottom > rcPage.Bottom) then

begin

_c1pdf.NewPage;

rc.Y := rcPage.Top;

end;

// draw the string

_c1pdf.DrawString(text, font, Brushes.Black, rc);

// update rectangle for next time

rc.Offset(0, rc.Height);

Result := rc;

end;

var

f: Font;

rcPage: RectangleF;

rc: RectangleF;

i: Integer;

begin

// use the RenderParagraph method

f := Font.Create('Arial', 10);

rcPage := _c1pdf.PageRectangle;

rcPage.Inflate(-72, -72);

rc = rcPage;

for I := 0 to myStringList.Count – 1 do

rc := RenderParagraph(myStringList[i], f, rc, rcPage);

end;


C1PDFMeasuringText - Visual Basic

Visual Basic

Private Function RenderParagraph(text As String, _
font As Font, rc As RectangleF, rcPage As RectangleF) As RectangleF

' calculate necessary height

Dim sz As SizeF = _c1pdf.MeasureString(text, font, rc.Width)

rc.Height = sz.Height

' if it won't fit this page, do a page break

If rc.Bottom > rcPage.Bottom Then

_c1pdf.NewPage()

rc.Y = rcPage.Top

End If

' draw the string

_c1pdf.DrawString(text, font, Brushes.Black, rc)

' update rectangle for next time

rc.Offset(0, rc.Height)

Return rc

End Function 'RenderParagraph

' use the RenderParagraph method:

Dim font As New Font("Arial", 10)

rcPage.Inflate(-72, -72)

Dim rcPage As RectangleF = _c1pdf.PageRectangle

Dim rc As RectangleF = rcPage

Dim s As String

For Each s In myStringList

rc = RenderParagraph(s, font, rc, rcPage)

Next s


C1PDFMetaFiles - C#

C#

// get the document as a list of Metafiles, one per page

ArrayList pages = GetMetafiles();

// loop through the pages and create a PDF document

_c1pdf.Clear();

for (int i = 0; i < pages.Count; i++)

{

// get ith page

Metafile page = pages[i] as Metafile;

if (page == null) continue;

// calculate page size

SizeF sz = page.PhysicalDimension;

sz.Width = (float)Math.Round(sz.Width * 72f / 2540f, 2);

sz.Height = (float)Math.Round(sz.Height * 72f / 2540f, 2);

// add a page and set the size

if (i > 0) _c1pdf.NewPage();

_c1pdf.PageSize = sz;

// draw the page into the PDF document

_c1pdf.DrawImage(page, _c1pdf.PageRectangle);

}

// save to file

_c1pdf.Save(@"c:\temp\mydoc.pdf");


C1PDFMetaFiles - Delphi

Delphi

var

pages: ArrayList;

i: Integer;

page: Metafile;

sz: SizeF;

begin

// get the document as a list of Metafiles, one per page

pages := GetMetafiles;

// loop through the pages and create a PDF document

_c1pdf.Clear;

for I := 0 to pages.Count - 1 do

begin

// get ith page

if not (pages[i] is Metafile) then

continue;

page := Metafile(pages[i]);

// calculate page size

sz := page.PhysicalDimension;

sz.Width := float(Math.Round(sz.Width * 72 / 2540, 2));

sz.Height := float(Math.Round(sz.Height * 72 / 2540, 2));

// add a page and set the size

if (i > 0) then

_c1pdf.NewPage;

_c1pdf.PageSize := sz;

// draw the page into the PDF document

_c1pdf.DrawImage(page, _c1pdf.PageRectangle);

end;

// save to file

_c1pdf.Save('c:\temp\mydoc.pdf');

end;


C1PDFMetaFiles - Visual Basic

Visual Basic

' get the document as a list of Metafiles, one per page

Dim pages As ArrayList = GetMetafiles()

' loop through the pages and create a PDF document

_c1pdf.Clear()

Dim i As Integer

for i = 0 i <= pages.Count

' get ith page

Dim page As Metafile = pages(i)

If Not (page Is Nothing) Then

' calculate page size

Dim sz As SizeF = page.PhysicalDimension

sz.Width = Math.Round(sz.Width * 72.0F / 2540.0F, 2)

sz.Height = Math.Round(sz.Height * 72.0F / 2540.0F, 2)

' add a page and set the size

If i > 0 Then _c1pdf.NewPage()

_c1pdf.PageSize = sz

' draw the page into the PDF document

_c1pdf.DrawImage(page, _c1pdf.PageRectangle)

End If

Next

' save to file

_c1pdf.Save("c:\temp\mydoc.pdf")


C1PDFNameSpaces - C#

C#

C1.C1Pdf.C1PdfDocument pdf;


C1PDFNameSpaces - Delphi

Delphi

pdf: C1.C1Pdf.C1PdfDocument;


C1PDFNameSpaces - Visual Basic

Visual Basic

Dim pdf As C1.C1Pdf.C1PdfDocument


C1PDF PageRectangle - C#

C#

private RectangleF GetContentRectangle(Margins m)

{

RectangleF rc = _c1pdf.PageRectangle;

rc.X += m.Left;

rc.Y += m.Top;

rc.Width -= (m.Left + m.Right);

rc.Height -= (m.Top + m.Bottom);

return rc;

}


C1PDF PageRectangle - Delphi

Delphi

function Class1.GetContentRectangle(m: Margins): RectangleF;

var

rc: RectangleF;

begin

rc := _c1pdf.PageRectangle;

rc.X := rc.X + m.Left;

rc.Y := rc.Y + m.Top;

rc.Width := rc.Width – (m.Left + m.Right);

rc.Height := rc.Height – (m.Top + m.Bottom);

Result := rc;

end;


C1PDF PageRectangle - Visual Basic

Visual Basic

Private Function GetContentRectangle(m As Margins) As RectangleF

Dim rc As RectangleF = _c1pdf.PageRectangle

rc.X += m.Left

rc.Y += m.Top

rc.Width -= m.Left + m.Right

rc.Height -= m.Top + m.Bottom

Return rc

End Function 'GetContentRectangle


C1PDFPagesandOverlays - C#

C#

Font font = new Font("Arial", 9);

StringFormat sf = new StringFormat();

sf.Alignment = StringAlignment.Center;

sf.LineAlignment = StringAlignment.Center;

// create one page with each paper size

bool firstPage = true;

foreach (PaperKind pk in Enum.GetValues(typeof(PaperKind)))

{

// skip custom size

if (pk == PaperKind.Custom) continue;

// add new page for every page after the first one

if (!firstPage) _c1pdf.NewPage();

firstPage = false;

// set paper kind

_c1pdf.PaperKind = pk;

// draw some content on the page

_c1pdf.DrawString("PaperKind: " + pk.ToString(),

font, Brushes.Black,

_c1pdf.PageRectangle, sf);

}


C1PDFPagesandOverlays - Delphi

Delphi

var

f: Font;

sf: StringFormat;

firstPage: Boolean;

pk: PaperKind;

items: array of System.Object;

i: Integer;

begin

f := Font.Create('Arial', 9);

sf := StringFormat.Create;

sf.Alignment := StringAlignment.Center;

sf.LineAlignment := StringAlignment.Center;

// create one page with each paper size

firstPage := True;

items := System.Enum.GetValues(typeof(PaperKind));

for i := 0 to High(items) do

begin

pk := PaperKind(items[i]);

// skip custom size

if pk = PaperKind.Custom then

continue;

// add new page for every page after the first one

if not firstPage then

_c1pdf.NewPage;

firstPage := False;

// set paper kind

_c1pdf.PaperKind := pk;

// draw some content on the page

_c1pdf.DrawString('PaperKind: ' + pk.ToString, f, Brushes.Black, _c1pdf.PageRectangle, sf)

end;

end;


C1PDFPagesandOverlaysEx2 - C#

C#

private void AddFooters()

{

Font font = new Font("Tahoma", 7, FontStyle.Bold);

StringFormat sf = new StringFormat();

sf.Alignment = StringAlignment.Center;

for (int page = 0; page < _c1pdf.Pages.Count; page++)

{

// select page

_c1pdf.CurrentPage = page;

// build rectangle for rendering the footer

RectangleF rc = _c1pdf.PageRectangle;

rc.Y = rc.Bottom – 36;

// write the footer

string text = string.Format("Page {0} of {1}",

page+1, _c1pdf.Pages.Count);

_c1pdf.DrawString(text, font, Brushes.Gray, rc, sf);

}

}


C1PDFPagesandOverlaysEx2 - Delphi

Delphi

procedure AddFooters;

var

f: System.Drawing.Font;

sf: StringFormat;

pas: Integer;

rc: RectangleF;

text: string;

begin

f := Font.Create('Tahoma', 7, FontStyle.Bold);

sf := StringFormat.Create;

sf.Alignment := StringAlignment.Center;

for page := 0 to _c1pdf.Pages.Count - 1 do

begin

// select page

_c1pdf.CurrentPage := page;

// build rectangle for rendering the footer

rc := _c1pdf.PageRectangle;

rc.Y := rc.Bottom;

// write the footer

text := System.String.Format('Page {0} of {1}', page + 1, _c1pdf.Pages.Count);

_c1pdf.DrawString(text, f, Brushes.Gray, rc, sf)

next;

end; // AddFooters


C1PDFPagesandOverlaysEx2 - Visual Basic

Visual Basic

Private Sub AddFooters()

Dim font As New Font("Tahoma", 7, FontStyle.Bold)

Dim sf As New StringFormat()

sf.Alignment = StringAlignment.Center

Dim page As Integer

For page = 0 To _c1pdf.Pages.Count - 1

' select page

_c1pdf.CurrentPage = page

' build rectangle for rendering the footer

Dim rc As RectangleF = _c1pdf.PageRectangle

rc.Y = rc.Bottom

' write the footer

Dim text As String
text = String.Format("Page {0} of {1}", page + 1, _
_c1pdf.Pages.Count)

_c1pdf.DrawString(text, font, Brushes.Gray, rc, sf)

Next page

End Sub 'AddFooters


C1PDFPagesandOverlays - Visual Basic

Visual Basic

Dim font As New Font("Arial", 9)

Dim sf As New StringFormat()

sf.Alignment = StringAlignment.Center

sf.LineAlignment = StringAlignment.Center

' create one page with each paper size

Dim firstPage As Boolean = True

Dim pk As PaperKind

For Each pk InSystem.Enum.GetValues(GetType(PaperKind))

' skip custom size

If pk = PaperKind.Custom Then

GoTo ContinueForEach1

End If

' add new page for every page after the first one

If Not firstPage Then

_c1pdf.NewPage()

End If

firstPage = False

' set paper kind

_c1pdf.PaperKind = pk

' draw some content on the page

_c1pdf.DrawString("PaperKind: " + pk.ToString(), font, Brushes.Black, _c1pdf.PageRectangle, sf)

ContinueForEach1:

Next pk


C1PDF PageSize - C#

C#

// get the document as a list of Metafiles, one per page

ArrayList pages = GetMetafiles();

// loop through the pages and create a PDF document

_c1pdf.Clear();

for (int i = 0; i < pages.Count; i++)

{

// get ith page

Metafile page = pages[i] as Metafile;

if (page == null) continue;

// calculate page size

SizeF sz = page.PhysicalDimension;

sz.Width = (float)Math.Round(sz.Width * 72f / 2540f, 2);

sz.Height = (float)Math.Round(sz.Height * 72f / 2540f, 2);

// add a page and set the size

if (i > 0) _c1pdf.NewPage();

_c1pdf.PageSize = sz;

// draw the page into the pdf document

_c1pdf.DrawImage(page, _c1pdf.PageRectangle);

}

// save to file

_c1pdf.Save(@"c:\temp\mydoc.pdf");


C1PDF PageSize - Delphi

Delphi

var

pages: ArrayList;

i: Integer;

page: Metafile;

sz: SizeF;

begin

// get the document as a list of Metafiles, one per page

pages := GetMetafiles;

// loop through the pages and create a PDF document

_c1pdf.Clear;

for i = 0 to pages.Count - 1 do

begin

// get ith page

if not (pages[i] is Metafile) then

begin

continue;

end;

page := Metafile(pages[i]);

// calculate page size

sz := page.PhysicalDimension;

sz.Width := Math.Round(sz.Width * 72 / 2540, 2);

sz.Height := Math.Round(sz.Height * 72 / 2540, 2);

// add a page and set the size

if i > 0 then

_c1pdf.NewPage;

_c1pdf.PageSize := sz;

// draw the page into the pdf document

_c1pdf.DrawImage(page, _c1pdf.PageRectangle);

end;

// save to file

_c1pdf.Save('');

end;


C1PDF PageSize - Visual Basic

Visual Basic

' get the document as a list of Metafiles, one per page

Dim pages As ArrayList = GetMetafiles()

' loop through the pages and create a PDF document

_c1pdf.Clear()

Dim i As Integer

For i = 0 To pages.Count - 1

' get ith page

Dim page As Metafile = pages(i)

If page Is Nothing Then

GoTo ContinueFor1

End If

' calculate page size

Dim sz As SizeF = page.PhysicalDimension

sz.Width = CSng(Math.Round(sz.Width * 72F / 2540F, 2))

sz.Height = CSng(Math.Round(sz.Height * 72F / 2540F, 2))

' add a page and set the size

If i > 0 Then

_c1pdf.NewPage()

End If

_c1pdf.PageSize = sz

' draw the page into the pdf document

_c1pdf.DrawImage(page, _c1pdf.PageRectangle)

ContinueFor1:

Next i

' save to file

_c1pdf.Save("")


C1PDF PagesProperty - C#

C#

// initialize

_c1pdf.Clear();

_c1pdf.DocumentInfo.Title = "Document with Table of Contents";

// create document

CreateDocument();

// number pages (before adding TOC)

AddFooters();

// prepare to render Table of Contents

_c1pdf.NewPage();

int tocPage = _c1pdf.CurrentPage;

// render Table of Contents

RenderTOC();

// move table of contents to start of document

PdfPage[] arr = new PdfPage[_c1pdf.Pages.Count - tocPage];

_c1pdf.Pages.CopyTo(tocPage, arr, 0, arr.Length);

_c1pdf.Pages.RemoveRange(tocPage, arr.Length);

_c1pdf.Pages.InsertRange(0, arr);


C1PDF PagesProperty - Delphi

Delphi

var

tocPage: Integer;

arr: array of PdfPage;

begin

// initialize

_c1pdf.Clear;

_c1pdf.DocumentInfo.Title := 'Document with Table of Contents';

// create document

CreateDocument;

// number pages (before adding TOC)

AddFooters;

// prepare to render Table of Contents

_c1pdf.NewPage;

tocPage := _c1pdf.CurrentPage;

// render Table of Contents

RenderTOC;

// move table of contents to start of document

SetLength(arr, _c1pdf.Pages.Count – tocPage);

_c1pdf.Pages.CopyTo(tocPage, arr, 0, arr.Length);

_c1pdf.Pages.RemoveRange(tocPage, arr.Length);

_c1pdf.Pages.InsertRange(0, arr);

end;


C1PDF PagesProperty - Visual Basic

Visual Basic

' initialize

_c1pdf.Clear()

_c1pdf.DocumentInfo.Title = "Document with Table of Contents"

' create document

CreateDocument()

' number pages (before adding TOC)

AddFooters()

' prepare to render Table of Contents

_c1pdf.NewPage()

Dim tocPage As Integer = _c1pdf.CurrentPage

' render Table of Contents

RenderTOC()

' move table of contents to start of document

Dim arr(_c1pdf.Pages.Count - tocPage) As PdfPage

_c1pdf.Pages.CopyTo(tocPage, arr, 0, arr.Length)

_c1pdf.Pages.RemoveRange(tocPage, arr.Length)

_c1pdf.Pages.InsertRange(0, arr)


C1PDF PaperKindProperty - C#

C#

Font font = new Font("Arial", 9);

StringFormat sf = new StringFormat();

sf.Alignment = StringAlignment.Center;

sf.LineAlignment = StringAlignment.Center;

// create one page with each paper size

bool firstPage = true;

foreach (PaperKind pk in Enum.GetValues(typeof(PaperKind)))

{

// skip custom size

if (pk == PaperKind.Custom) continue;

// add new page for every page after the first one

if (!firstPage) _c1pdf.NewPage();

firstPage = false;

// set paper kind

_c1pdf.PaperKind = pk;

// draw some content on the page

_c1pdf.DrawString("PaperKind: " + pk.ToString(),

font, Brushes.Black,

_c1pdf.PageRectangle, sf);

}


C1PDF PaperKindProperty - Delphi

Delphi

var

f: Font;

sf: StringFormat;

firstPage: Boolean;

pk: PaperKind;

items: array of System.Object;

i: Integer;

begin

f := Font.Create('Arial', 9);

sf := StringFormat.Create;

sf.Alignment := StringAlignment.Center;

sf.LineAlignment := StringAlignment.Center;

// create one page with each paper size

firstPage := True;

items := System.Enum.GetValues(typeof(PaperKind));

for i := 0 to High(items) do

begin

pk := PaperKind(items[i]);

// skip custom size

if pk = PaperKind.Custom then

continue;

// add new page for every page after the first one

if not firstPage then

_c1pdf.NewPage;

firstPage := False;

// set paper kind

_c1pdf.PaperKind := pk;

// draw some content on the page

_c1pdf.DrawString('PaperKind: ' + pk.ToString, f, Brushes.Black, _c1pdf.PageRectangle, sf)

end;

end;


C1PDF PaperKindProperty - Visual Basic

Visual Basic

Dim font As New Font("Arial", 9)

Dim sf As New StringFormat()

sf.Alignment = StringAlignment.Center

sf.LineAlignment = StringAlignment.Center

' create one page with each paper size

Dim firstPage As Boolean = True

Dim pk As PaperKind

For Each pk In System.Enum.GetValues(GetType(PaperKind))

' skip custom size

If pk = PaperKind.Custom Then

GoTo ContinueForEach1

End If

' add new page for every page after the first one

If Not firstPage Then

_c1pdf.NewPage()

End If

firstPage = False

' set paper kind

_c1pdf.PaperKind = pk

' draw some content on the page

_c1pdf.DrawString("PaperKind: " + pk.ToString(), font, Brushes.Black, _c1pdf.PageRectangle, sf)

ContinueForEach1:

Next pk


C1PDFRTFMethod - C#

C#

// get RTF templates

string rtfHdr = @"{\rtf1\ansi\ansicpg1252\deff0\deflang1033" +

@"{\fonttbl{\f0\fswiss\fcharset0 " +

@"Arial;}{\f1\froman\fprq2\fcharset0 Book Antiqua;}}" +

@"{\colortbl ;\red0\green0\blue0;}" +

@"\viewkind4\uc1\pard\f0\fs20\par" +

@"\pard\tx1440\tx2880\tx4320\tx5760\cf1\b\f1\fs24 " +

@"Directory Report created on <<TODAY>>\par" +

@"\ul\par Name\tab Extension\tab Size\tab Date\tab " +

@"Attributes\par";

string rtfEntry = @"\cf0\ulnone\b0\f0\fs16 <<NAME>>\tab " +

@"<<EXT>>\tab <<SIZE>>\tab <<DATE>>\tab <<ATTS>>\par";

// build RTF string

StringBuilder sb = new StringBuilder();

sb.Append(rtfHdr.Replace("<<TODAY>>", DateTime.Today.ToShortDateString()));

foreach (string file in Directory.GetFiles(@"c:\winnt", "*.bmp"))

{

string s = rtfEntry;

FileInfo fi = new FileInfo(file);

s = s.Replace("<<NAME>>",

Path.GetFileNameWithoutExtension(file));

s = s.Replace("<<EXT>>", fi.Extension);

s = s.Replace("<<SIZE>>", string.Format("{0:#,##0}", fi.Length));

s = s.Replace("<<DATE>>", fi.LastWriteTime.ToShortDateString());

s = s.Replace("<<ATTS>>", fi.Attributes.ToString());

sb.Append(s);

}

sb.Append("}");

// render it

C1.C1Pdf.C1PdfDocument pdf = new C1.C1Pdf.C1PdfDocument();

RectangleF rc = pdf.PageRectangle;

rc.Inflate(-72, -72);

_c1pdf.DrawStringRtf(sb.ToString(), Font, Brushes.Black, rc);

// save

_c1pdf.Save(@"c:\temp\dir.pdf");


C1PDFRTFMethod - Delphi

Delphi

var

rtfHdr, rtfEntry: string;

sb: StringBuilder;

i: Integer;

files: array of string;

fl, s: string;

fi: FileInfo;

pdf: C1.C1Pdf.C1PdfDocument;

rc: RectangleF;

begin

// get RTF templates

rtfHdr := '{\rtf1\ansi\ansicpg1252\deff0\deflang1033' +

'{\fonttbl{\f0\fswiss\fcharset0 ' +

'Arial;}{\f1\froman\fprq2\fcharset0 Book Antiqua;}}' +

'{\colortbl ;\red0\green0\blue0;}' +

'viewkind4\uc1\pard\f0\fs20\par' +

'\pard\tx1440\tx2880\tx4320\tx5760\cf1\b\f1\fs24 ' +

'Directory Report created on <<TODAY>>\par' +

'\ul\par Name\tab Extension\tab Size\tab Date\tab ' +

'Attributes\par';

rtfEntry := '\cf0\ulnone\b0\f0\fs16 <<NAME>>\tab ' +

'<<EXT>>\tab <<SIZE>>\tab <<DATE>>\tab <<ATTS>>\par';

// build RTF string

sb := StringBuilder.Create;

sb.Append(rtfHdr.Replace('<<TODAY>>', DateTime.Today.ToShortDateString()));

files := Directory.GetFiles('c:\winnt', '*.bmp');

for i := 0 to High(files) do

begin

fl := files[i];

s := rtfEntry;

fi := FileInfo.Create(fl);

s := s.Replace('<<NAME>>', Path.GetFileNameWithoutExtention(fl));

s := s.Replace('<<EXT>>', fi.Extention);

s := s.Replace('<<SIZE>>', System.String.Format('{0:#,##0}', fi.Length));

s := s.Replace('<<DATE>>', fi.LastWriteTime.ToShortDateString);

s := s.Replace('<<ATTS>>', fi.Attributes.ToString);

sb.Append(s);

end;

sb.Append('}');

// render it

pdf := C1.C1Pdf.C1PdfDocument.Create;

rc := pdf.PageRectangle;

rc.Inflate(-72, -72);

_c1pdf.DrawStringRtf(sb.ToString, Font, Brushes.Black, rc);

// save

_c1pdf.Save('c:\temp\dir.pdf');

end;


C1PDFRTFMethod - Visual Basic

Visual Basic

' get RTF templates

Dim rtfHdr As String = "" & _

"{\rtf1\ansi\ansicpg1252\deff0\deflang1033" & _

"{\fonttbl{\f0\fswiss\fcharset0 " & _

"Arial;}{\f1\froman\fprq2\fcharset0 Book Antiqua;}}" & _

"{\colortbl ;\red0\green0\blue0;}" & _

"\viewkind4\uc1\pard\f0\fs20\par" & _

"\pard\tx1440\tx2880\tx4320\tx5760\cf1\b\f1\fs24 " & _

"Directory Report created on <<TODAY>>\par" & _

"\ul\par Name\tab Extension\tab Size\tab Date\tab " & _

"Attributes\par"

Dim rtfEntry As String = "" & _

"\cf0\ulnone\b0\f0\fs16 <<NAME>>\tab " & _

"<<EXT>>\tab <<SIZE>>\tab <<DATE>>\tab <<ATTS>>\par"

' build RTF string

Dim sb As New StringBuilder()

sb.Append(rtfHdr.Replace("<<TODAY>>", DateTime.Today.ToShortDateString()))

Dim file As String

For Each file in Directory.GetFiles(@"c:\winnt", "*.bmp")

Dim s As String = rtfEntry

Dim fi As FileInfo = New FileInfo(file)

s = s.Replace("<<NAME>>", Path.GetFileNameWithoutExtension(file))

s = s.Replace("<<EXT>>", fi.Extension)

s = s.Replace("<<SIZE>>", String.Format("{0:#,##0}", fi.Length))

s = s.Replace("<<DATE>>", fi.LastWriteTime.ToShortDateString())

s = s.Replace("<<ATTS>>", fi.Attributes.ToString())

sb.Append(s)

Next

sb.Append("}")

' render it

Dim pdf As New C1PdfDocument()

RectangleF(rc = pdf.PageRectangle)

rc.Inflate(-72, -72)

_c1pdf.DrawStringRtf(sb.ToString(), Font, Brushes.Black, rc)

' save

_c1pdf.Save("c:\temp\dir.pdf")


C1PDFSecurity - C#

C#

// create the document as usual

CreateDoc();

// set passwords

_c1pdf.Security.OwnerPassword = "2mds%dffgd";

_c1pdf.Security.UserPassword = "anyone";

_c1pdf.Security.AllowEditAnnotations = false;

_c1pdf.Security.AllowEditContent = false;

_c1pdf.Security.AllowPrint = false;

// save the encrypted document

_c1pdf.Save(@"c:\reports\secure.pdf");


C1PDFSecurity - Delphi

Delphi

begin

// create the document as usual

CreateDoc;

// set passwords

_c1pdf.Security.OwnerPassword := '2mds%dffgd';

_c1pdf.Security.UserPassword := 'anyone';

_c1pdf.Security.AllowEditAnnotations := False;

_c1pdf.Security.AllowEditContent := False;

_c1pdf.Security.AllowPrint := False;

// save the encrypted document

_c1pdf.Save('c:\reports\secure.pdf');

end;


C1PDFSecurityProperty - C#

C#

// create the document as usual

CreateDoc();

// set passwords

_c1pdf.Security.OwnerPassword = "2mds%dffgd";

_c1pdf.Security.UserPassword = "user";

_c1pdf.Security.AllowEditAnnotations = false;

_c1pdf.Security.AllowEditContent = false;

_c1pdf.Security.AllowPrint = false;

// save the encrypted document

_c1pdf.Save(@"c:\reports\secure.pdf");


C1PDFSecurityProperty - Delphi

Delphi

begin

// create the document as usual

CreateDoc;

// set passwords

_c1pdf.Security.OwnerPassword := '2mds%dffgd';

_c1pdf.Security.UserPassword := 'anyone';

_c1pdf.Security.AllowEditAnnotations := False;

_c1pdf.Security.AllowEditContent := False;

_c1pdf.Security.AllowPrint := False;

// save the encrypted document

_c1pdf.Save('c:\reports\secure.pdf');

end;


C1PDFSecurityProperty - Visual Basic

Visual Basic

' create the document as usual

CreateDoc()

' set passwords

_c1pdf.Security.OwnerPassword = "2mds%dffgd"

_c1pdf.Security.UserPassword = "user"

_c1pdf.Security.AllowEditAnnotations = False

_c1pdf.Security.AllowEditContent = False

_c1pdf.Security.AllowPrint = False

' save the encrypted document

_c1pdf.Save("")


C1PDFSecurity - Visual Basic

Visual Basic

' create the document as usual

CreateDoc()

' set passwords

_c1pdf.Security.OwnerPassword = "2mds%dffgd"

_c1pdf.Security.UserPassword = "anyone"

_c1pdf.Security.AllowEditAnnotations = False

_c1pdf.Security.AllowEditContent = False

_c1pdf.Security.AllowPrint = False

' save the encrypted document

_c1pdf.Save("")


C1PDFTextExample1 - C#

C#

pdf.DrawString("Hello World!", font, Brushes.Black, rc);


C1PDFTextExample1 - Delphi

Delphi

pdf.DrawString('Hello World!', font, Brushes.Black, rc);


C1PDFTextExample1 - Visual Basic

Visual Basic

pdf.DrawString("Hello World!", font, Brushes.Black, rc)


C1PDFTextExample2 - C#

C#

Font font = new Font("Arial", 12);

RectangleF rc = new RectangleF(72, 72, 100, 50);

string text = "Some long string to be " +

"rendered into a small rectangle. ";

text = text + text + text + text + text + text;

// center align string

StringFormat sf = new StringFormat();

sf.Alignment = StringAlignment.Center;

sf.LineAlignment = StringAlignment.Center;

pdf.DrawString(text, font, Brushes.Black, rc, sf);

pdf.DrawRectangle(Pens.Gray, rc);


C1PDFTextExample2 - Delphi

Delphi

var

sf: StringFormat;

text: string;

rc: RectangleF;

font: Font;

begin

font := Font.Create('Arial', 12);

rc := RectangleF.Create(72, 72, 100, 50);

text := ('Some long string to be ' + 'rendered into a small rectangle. ');

text := (((((text + text) + text) + text) + text) + text);

sf := StringFormat.Create;

sf.Alignment := StringAlignment.Center;

sf.LineAlignment := StringAlignment.Center;

pdf.DrawString(text, font, Brushes.Black, rc, sf);

pdf.DrawRectangle(Pens.Gray, rc);

end;


C1PDFTextExample2 - Visual Basic

Visual Basic

Dim font As New Font("Arial", 12)

Dim rc As New RectangleF(72, 72, 100, 50)

Dim text As String = "Some long string to be " & _

"rendered into a small rectangle. "

text = text & text & text & text & text & text

' center align string

Dim sf As New StringFormat()

sf.Alignment = StringAlignment.Center

sf.LineAlignment = StringAlignment.Center

pdf.DrawString(text, font, Brushes.Black, rc, sf)

pdf.DrawRectangle(Pens.Gray, rc)


Create PDF from VSPrinter - C#

C#

-- Not Available


Create PDF from VSPrinter - Delphi

Delphi

-- Not Available


Create PDF from VSPrinter - Visual Basic

Visual Basic

' Initialize PDF document

_pdf.Clear()

' Create a VSPrinter document

' (or load it from an existing document)

.StartDoc()

For i = 1 To 1000

.Paragraph = "This is paragraph " & i.ToString()

Next

.EndDoc()

' Scan the document page by page (1-based)

For i = 1 To .PageCount

' Set the current preview page

.PreviewPage = i

' Retrieve the image

Dim img As Image = .Picture

' Save image into PDF document

If i > 1 Then _pdf.NewPage()

_pdf.DrawImage(img, Me._pdf.PageRectangle)

Next

' Return preview to first page

.PreviewPage = 0


Print PDF Files - C#

C#

-- Not Available


Print PDF Files - Delphi

Delphi

-- Not Available


Print PDF Files - Visual Basic

Visual Basic

Sub PrintAdobePDF(ByVal Filename As String)

Dim myProcess As New Process

Dim lbRunning As Boolean = True

Dim fi As FileInfo

Try

' Point the process to our Acrobat file

myProcess.StartInfo.FileName = Filename

fi = new FileInfo(Filename)

myProcess.StartInfo.WorkingDirectory = fi.DirectoryName

' Suppress the UI and pass the "Print" verb to force

' Acrobat to only print

myProcess.StartInfo.CreateNoWindow = True

myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden

myProcess.StartInfo.Verb = "Print"

myProcess.Start()

' Wait until Acrobat has finished or 10 seconds whichever

' comes first

If Not myProcess.HasExited Then

myProcess.WaitForInputIdle(10000)

End If

' Close Acrobat, loop until succeeds or times out

Dim i As Integer = 1

While lbRunning And i <= 20

' Sleep for 1/2 of a second

System.Threading.Thread.Sleep(500)

' See if the Adobe will exit gracefully

Select Case myProcess.HasExited

Case True : lbRunning = False

Case False : lbRunning = Not _

myProcess.CloseMainWindow

End Select

i += 1

End While

' If it never closed gracefully, force it out of memory

If lbRunning AndAlso Not myProcess.HasExited Then

myProcess.Kill()

End If

myProcess.Dispose()

Catch ex As System.ComponentModel.Win32Exception

' A process error throws

Const ERROR_FILE_NOT_FOUND As Integer = 2

Select Case ex.NativeErrorCode

Case ERROR_FILE_NOT_FOUND

Throw New System.IO.FileNotFoundException

Case Else

Throw New Exception(ex.Message & " (PrintAdobePDF)")

End Select

Catch ex As Exception

Throw New Exception(ex.Message & " (PrintAdobeFile)")

End Try

End Sub


Remove bookmarks from C1Report - C#

C#

-- Not Available


Remove bookmarks from C1Report - Delphi

Delphi

-- Not Available


Remove bookmarks from C1Report - Visual Basic

Visual Basic

// Set OutlineRootLevel to -1

c1Report1.OutlineRootLevel = -1;

c1Report1.RenderToFile("foo.pdf",
C1.Win.C1Report.FileFormatEnum.PDF);

// OR: Create a PDF filter and disable the outline

C1.Win.C1Report.PdfFilter f =
new C1.Win.C1Report.PdfFilter("foo.pdf");

f.Outline = false;

c1Report1.RenderToFilter(f);


Write PDF Content in Web Apps - C#

C#

-- Not Available


Write PDF Content in Web Apps - Visual Basic

Visual Basic

Public Sub RenderPdf()

' Render report into memory-based PDF stream

Dim ms As New MemoryStream()

C1WebReport1.Report.RenderToStream(ms, FileFormatEnum.PDF);

' Render PDF stream into response object

Dim length As Integer

Dim rsp As HttpResponse = Me.Page.Response

rsp.Clear()

rsp.ContentType = "Application/pdf"

length = CType(ms.Length,Integer)

rsp.OutputStream.Write(ms.GetBuffer, 0, CType(ms.Length,Integer))

rsp.Flush()

rsp.SuppressContent = True

End Sub


Untitled Document


Untitled Document

 E-mail sent to documentation@componentone.com is for documentation feedback only. We welcome any suggestions to help improve our documentation.