We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Margins per page and tables

Thread ID:

Created:

Updated:

Platform:

Replies:

75303 Jul 21,2008 04:56 AM Jul 22,2008 02:48 AM Windows Forms 1
loading
Tags: PDF
Dennis van der Stelt
Asked On July 21, 2008 04:56 AM

Hi there,

I've used the following code to use a .jpg as the background for my PDF.

PdfDocument document = new PdfDocument();
document.PageSettings.Margins.All = 0;
document.PageSettings.Size = PdfPageSize.A4;
PdfPage page = document.Pages.Add();
//
PdfGraphics graphics = page.Graphics;
PdfImage backgroundImage = PdfImage.FromImage(Resources.briefpapier_2007);
page.Graphics.DrawImage(backgroundImage, 0, 0, page.GetClientSize().Width, page.GetClientSize().Height);
// Use this to make sure we don't go past a certain point
page.Section.PageSettings.Margins.Bottom = 100;

I'm not sure if this is right, but I'm using the PageAdded event to make sure every other page is getting another background.

PdfPage page = args.Page;
page.Section.PageSettings.Margins.All = 0;
PdfImage backgroundImage = PdfImage.FromImage(Resources.briefpapier_2007_vervolg);
page.Graphics.DrawImage(backgroundImage, 0, 0, page.GetClientSize().Width, page.GetClientSize().Height);
// Set new margins
page.Section.PageSettings.Margins.Bottom = 20;
page.Section.PageSettings.Margins.Top = 200;

I've set the top margin really high. But when I add a table to page 1, the top margin isn't working. Row 1-x is shown on page 1, but from row x to the end is shown on page 2, but immediately at the extreme top of the page.

Any idea how to solve this? Thanks


Sri Subhashini M [Syncfusion]
Replied On July 22, 2008 02:48 AM

Hi,

Thank you for your interest in Syncfusion PDF.

Top margin is not working properly.

I was able to view the condition which is mentioned here. We have resolve the problem by commenting the all Margin values as 0 statement (PageSettings.Margins.All = 0;). Please do find the sample from the below specified location and let me know if this helps.

http://www.syncfusion.com/support/user/uploads/Sample_3e0c6412.zip

Regards,
Suba




CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;