We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to set background image to Page

Hi ,

I want to add page i.e. FirstPage of document . To this page I want to set Background-Image which will cover entire page page size is 8.5’’ X 11.0’’ and after that I want to add Text , Images to that
First Page. And insert more N number of pages but these pages will contain Text ,Images but NO Background-Image.

Background-Image is only for FirstPage.


how to implement this?

Regards ,

Jeevan Joshi

Hi Jeevan,


Thanks for your inquiry. Sure, you can insert a background image in the first page of your document by using Headers/Footers. Here is the code to achieve this:

DocumentBuilder builder = new DocumentBuilder();

PageSetup ps = builder.Document.FirstSection.PageSetup;

ps.DifferentFirstPageHeaderFooter = true;

ps.HeaderDistance = 0;

builder.MoveToHeaderFooter(HeaderFooterType.HeaderFirst);

Shape background = builder.InsertImage(@"C:\Temp\BackgroundImage.png");

background.Width = ps.PageWidth;

background.Height = ps.PageHeight;

background.RelativeHorizontalPosition = RelativeHorizontalPosition.Page;

background.RelativeVerticalPosition = RelativeVerticalPosition.Page;

background.Left = 0;

background.Top = 0;

background.WrapType = WrapType.None;

background.BehindText = true;

builder.MoveToDocumentStart();

builder.Writeln("First page content goes here");

builder.InsertBreak(BreakType.PageBreak);

builder.Writeln("The content for other pages goes here");

builder.Document.Save(@“C:\Temp\out.docx”);


I hope, this helps.

Best regards,