PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sat Apr 27, 2024 9:22 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Page Breaks
PostPosted: Thu Jul 23, 2009 5:49 pm 
Offline

Joined: Tue Jul 21, 2009 6:37 pm
Posts: 12
I have a process that adds alternating Images and Tables. (each set has a large image followed by a table). Before each set of Image and associated Table I add a bookmark. I need to force new page breaks everytime the bookmark is added and everytime the table is added. How can I cause these page breaks?


foreach (Assembly thisAssembly in assemblyList)
{

// NEED PAGE BREAK HERE SO THIS HEADING AND IMAGE IS ON A SEPARATE PAGE

Paragraph paragraph = document.LastSection.AddParagraph(thisAssembly.number + " " + thisAssembly.description, "Heading2");
paragraph.AddBookmark(thisAssembly.number + " " + thisAssembly.description);


completeFilename = directoryLocation + "\\" + pic.artnumber + "." + pic.fileextension;
document.LastSection.AddImage(completeFilename);


Table table = new Table();

Column column = table.AddColumn(Unit.FromCentimeter(1.2));
column.Format.Alignment = ParagraphAlignment.Center;
column = table.AddColumn(Unit.FromCentimeter(3.9));
column.Format.Alignment = ParagraphAlignment.Center;
column = table.AddColumn(Unit.FromCentimeter(.9));
column.Format.Alignment = ParagraphAlignment.Center;
column = table.AddColumn(Unit.FromCentimeter(6.1));
column = table.AddColumn(Unit.FromCentimeter(7));

Cell cell;
Row row = table.AddRow();
row.Shading.Color = Colors.PaleGoldenrod;
cell = row.Cells[0];
cell.AddParagraph("ITEM");
cell = row.Cells[1];
cell.AddParagraph("PARTNUMBER");
cell = row.Cells[2];
cell.AddParagraph("QTY");
cell = row.Cells[3];
cell.AddParagraph("DESCRIPTION");
cell = row.Cells[4];
cell.AddParagraph("NOTES");


// loop thru datareader to add rows


// NEED PAGE BREAK HERE SO THIS HEADING AND TABLE IS ON A SEPARATE PAGE


document.LastSection.AddParagraph(thisAssembly.number + " " + thisAssembly.description, "Heading2");

document.LastSection.Add(table);

}


//thanks !


Top
 Profile  
Reply with quote  
 Post subject: Re: Page Breaks
PostPosted: Mon Jul 27, 2009 9:04 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
Code:
Document.LastSection.AddPageBreak();

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 361 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group