Creating PDFs in C# with Outlined or Invisible Text

Thu, August 30 2012, 1:51 PM (US Eastern Time)

DynamicPDF Generator has lots of predefined page elements which allow you to easily create different types of content, but you may occasionally have a need to do something that is not available in the API by default. Custom page elements is an easy way to extend the API to achieve these results.

We get questions from time to time on how to add outlined text to a PDF. By outlined text I mean text that is not completely filled in with a color but rather is just an outline of the font and nothing filled in the middle of the text.  This is a great situation for using a Custom page element and the C# code below shows how to extend the TextArea page element to add this functionality:

using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;

public class OutlinedTextArea : TextArea
    // Member variable to store Border Width
    private float borderWidth = 1.0f;

    // Constructors. Additional ones can be added to model TextArea
    public OutlinedTextArea(string text, float x, float y, float width, float height)
        : base(text, x, y, width, height) { }
    public OutlinedTextArea(string text, float x, float y, float width, float height,
        Font font, float fontSize)
        : base(text, x, y, width, height, font, fontSize) { }

    // Border Width Property added
    public float BorderWidth
        get { return this.borderWidth; }
        set { this.borderWidth = value; }

    // Override Draw Method
    public override void Draw(ceTe.DynamicPDF.IO.PageWriter writer)
        // Enter Graphics Mode
        // Set Stroke Color and Border Width
        // Enter Text Mode
        // Set Text Rendering Mode
        // Call Draw on base class
        // Enter Text Mode (in case underline is set to true)
        // Set Text Rendering Mode Back to Fill


Tags: , , , , , , , , , , ,

Create AES Encrypted PDFs in C# and VB .NET

Tue, July 31 2012, 2:48 PM (US Eastern Time)

We recently released an update that introduces AES-256 bit and AES-128 bit encryption to our .NET PDF creation and merging library. We have offered encryption since 2002, but this was limited to RC4-40 bit and RC4-128 bit security until this release. We have also restructured the API a bit in order to easily accommodate new encryption methods in the future.

Encryption is now handled by 4 classes in a new ceTe.DynamicPDF.Cryptography namespace:

All security classes allow restrictions to be placed on a PDF to restrict printing, modification, copying content or updating/adding text annotations or form fields. The 128-bit and higher classes allow restrictions to be placed on a PDF to restrict filling in existing form fields, extracting text and graphics for accessibility purposes, modifying the pages included, high resolution printing or leaving the XMP metadata unencrypted. The AES classes also add the ability to encrypt only file attachments.

The C# code to add AES-256 bit encryption to a new document is very straight forward:

Document document = new Document();
Page page = new Page();
page.Elements.Add(new Label("AES-256 bit encrypted PDF.", 0, 0, 500, 15));
// Add the encryption
Aes256Security security = new Aes256Security("ownerpassword", "userpassword");
security.AllowHighResolutionPrinting = false;
// Set other encryption options
document.Security = security;
// Output the PDF


Tags: , , , ,

Happy 10th Birthday DynamicPDF

Thu, June 28 2012, 10:41 AM (US Eastern Time)

We are proud to announce that our DynamicPDF Product line is now 10 years old! DynamicPDF Generator for COM/ActiveX (now DynamicPDF Generator Classic) was released in mid June 2002 and the first sale was on June 28th, 2002.

I wanted to take a minute to say thank you to all our loyal customers! We appreciate all the feedback, suggestions and support you've provided throughout the years which has helped us improve our existing products and bring new products to market. It is our goal to continue providing industry leading libraries and tools to help meet your software development needs.

Tags: , ,

Month List