Print Page | Close Window

Create new pages and stamp text on each using C#

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: Sample Code
Forum Description: Share Debenu Quick PDF Library sample code with other forum members
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1211
Printed Date: 28 Apr 24 at 5:35AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Create new pages and stamp text on each using C#
Posted By: Rowan
Subject: Create new pages and stamp text on each using C#
Date Posted: 09 Sep 09 at 2:59AM
This C# sample code shows you how to programmatically create new pages and stamp text on each of the pages as they are created. In the for loop you could use any of the drawing, table, form field, etc, function to create dynamic PDFs on the fly. It's quick and easy.

---
private void btnNewPages_Click(object sender, EventArgs e)
{
    string LicenseKey = "...INSERT_LICENSE_KEY_HERE";
    int result;
    int page;
    int totalPages;

    QuickPDFAX0715.PDFLibrary qp = new QuickPDFAX0715.PDFLibrary();
    result = qp.UnlockKey(LicenseKey);

    if (result == 1)
    {
qp.NewPages(24);
totalPages = qp.PageCount();

for (page = 1; page <= totalPages; page++)
{
     qp.SelectPage(page);
     qp.DrawText(100, 500, "Page " + page);
}
qp.SaveToFile("NewPages.pdf");
    }
    else
    {
MessageBox.Show("Sorry, but the license key you provided could not be validated.");
    }
}



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk