Aspose.Pdf

Set Page Background Image

Aspose.Pdf feature's list also include to set the background image for a Section . In Aspose.Pdf a Section can be composed of multiple pages. So, if we set the background image for a Section then that background image will be displayed on all pages (that belong to the same Section ).

 

We can accomplish this in just two steps:

 

 

The image types supported by ImageFileType enumeration are:

 

Image Types

Description

Ccitt

Ccitt type

Gif

Gif type

Jpeg

Jpeg type

Png

Png type

Tiff

Tiff type

Bmp

Bmp type

Emf

Emf type

Exif

Exif type

Icon

Icon type

Wmf

Wmf type

MemoryBmp

MemoryBmp type

Unknown

Unknown type

 

Code Snippet

 

[C#]

 

//Assign the image file path to BackgroundImageFile property of section

section.BackgroundImageFile = "E:/Projects/Pdf/testimages/apple.jpg";

 

//Set the image type using ImageFileType enumeration

section.BackgroundImageType = ImageFileType.Jpeg;

 

[VB.NET]

 

'Assign the image file path to BackgroundImageFile property of section

section.BackgroundImageFile = "E:/Projects/Pdf/testimages/apple.jpg"

 

'Set the image type using ImageFileType enumeration

section.BackgroundImageType = ImageFileType.Jpeg

 

[JAVA]

 

//Assign the image file path to BackgroundImageFile property of section

section.setBackgroundImageFile("E:/Projects/Pdf/testimages/apple.jpg");

 

 

[XML]

 

<Section BackgroundImageFile="Y:/c#/Pdf/images/flower.jpg"

        BackgroundImageType="jpeg">