BackgroundImage

Represents a background image.

public class BackgroundImage : TaggablePageElement, ISerializable
Public Class BackgroundImage
    Inherits TaggablePageElement
    Implements ISerializable

Inheritance: ObjectPageElementTaggablePageElementBackgroundImage

Implements: ISerializable

Licensing Info

This class is a full DynamicPDF Core Suite feature. One of the following is required for non-evaluation usage:

Examples

The following example will place an image on the page making it the background for that page.
Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
     
Module MyModule
     		
    Sub Main()
        ' Create a PDF Document
        Dim MyDocument As Document = New Document 
     		
        ' Create a Page and add it to the document
        Dim MyPage As Page = New Page
        MyDocument.Pages.Add(MyPage)
     
        ' Create a background image
        Dim MyBackgroundImage As BackgroundImage = New BackgroundImage("C:\MyImage.jpg")
     
        ' Place the image with in the page margins 
        MyBackgroundImage.UseMargins = True
     
        ' Add the background image to the page
        MyPage.Elements.Add(MyBackgroundImage)
     
        ' Save the PDF
        MyDocument.Draw("C:\MyDocument.pdf")
     
    End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;

public class Example
{
    public static void CreatePDF(string outputPath, string imagePath)
    {
        // Create a PDF Document
        Document document = new Document();

        // Create a page and add it to the document
        Page page = new Page();
        document.Pages.Add(page);

        // Create a background image
        BackgroundImage backgroundImage = new BackgroundImage(imagePath);

        // Place the image with in the page margins
        backgroundImage.UseMargins = true;

        // Add the background image to the page
        page.Elements.Add(backgroundImage);

        //Save the PDF
        document.Draw(outputPath);
    }
}

Remarks

This class can be used to place an image on the page that will be stretched to the dimensions of the page. If an image will be used more than once, please see the Image Reuse topic.

Constructors

BackgroundImage(Byte[])Initializes a new instance of the BackgroundImage class.
BackgroundImage(ImageData)Initializes a new instance of the BackgroundImage class.
BackgroundImage(Stream)Initializes a new instance of the BackgroundImage class.
BackgroundImage(String)Initializes a new instance of the BackgroundImage class.

Properties

BottomPaddingGet or set the bottom padding of the background image.
IDGets or sets the ID of the page element.
(Inherited from PageElement)
IgnoreMarginsGets or sets ignore margin property. Setting false will consider the margin while placing the page element based on the RelativeTo property.
(Inherited from PageElement)
ImageDataGet the background image's ImageData object.
LeftPaddingGet or set the left padding of the background image.
RelativeToGets and sets placement of the page element on the page.
(Inherited from PageElement)
RightPaddingGet or set the right padding of the background image.
TagGets or sets the tag of the taggable element.
(Inherited from TaggablePageElement)
TagOrderGets or sets the tag order of the taggable element.
(Inherited from TaggablePageElement)
TopPaddingGet or set the top padding of the background image.
UseMarginsGet or set a value indicating if the pages margins should be used when calculating the placement of the background image.

Methods

Draw(PageWriter)Draws the background image to the given PageWriter object.
Equals(Object)Determines whether the specified Object is equal to the current Object .
(Inherited from Object)
GetHashCode()Serves as a hash function for a particular type.
(Inherited from Object)
GetType()Gets the Type of the current instance.
(Inherited from Object)
ToString()Returns a String that represents the current Object .
(Inherited from Object)

See Also

ceTe.DynamicPDF.PageElements

In this topic