PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index PDFsharp - moved to http://forum.pdfsharp.net/
Please visit the new PDFsharp forum at http://forum.pdfsharp.net/
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Big table only shown on page 1 other pages aren't shown?

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Support - moved to http://forum.pdfsharp.net/
View previous topic :: View next topic  
Author Message
matthewb



Joined: 30 Dec 2008
Posts: 7

PostPosted: Tue Dec 30, 2008 2:18 pm    Post subject: Big table only shown on page 1 other pages aren't shown? Reply with quote

I have is I have created a big table which is rendered via a datatable. When I load the pdf it is created but only the first page is shown. In theory there should be around 30 pages. I thought the table would automatically create and go onto a seperate page or am i misinformed? Could someone look at my code and please tell me what to change so that all the table is shown. Many thanks Matt.

Code:
 PdfDocument outputPdf = new PdfDocument();
            PdfPage page0 = outputPdf.AddPage();
           

            Document doc = new Document();
           
            Section tableSection = doc.AddSection();

           
            Table myTable2 = tableSection.AddTable();
           
            myTable2.Borders.Visible = false;
            myTable2.Format.Borders.Visible = false;

            Column column1 = myTable2.AddColumn(Unit.FromCentimeter(2));
            Column column2 = myTable2.AddColumn(Unit.FromCentimeter(2));
            Column column3 = myTable2.AddColumn(Unit.FromCentimeter(8));
            Column column4 = myTable2.AddColumn(Unit.FromCentimeter(2));
            Column column5 = myTable2.AddColumn(Unit.FromCentimeter(2));
            Column column6 = myTable2.AddColumn(Unit.FromCentimeter(2));

           
            Row row1 = myTable2.AddRow();

            row1.Cells[0].AddParagraph("Forename");
            row1.Cells[1].AddParagraph("Surname");
            row1.Cells[2].AddParagraph("Email");
            row1.Cells[3].AddParagraph("Tel Num");
            row1.Cells[4].AddParagraph("Username");
            row1.Cells[5].AddParagraph("Password");


            for(int i =0; i<dt.Rows.Count; i++)
            {

            Row row2 = myTable2.AddRow();

            string item1 = dt.Rows[i][0].ToString();
            string item2 = dt.Rows[i][1].ToString();
            string item3 = dt.Rows[i][2].ToString();
            string item4 = dt.Rows[i][3].ToString();
            string item5 = dt.Rows[i][4].ToString();
            string item6 = dt.Rows[i][5].ToString();

            row2.Cells[0].AddParagraph(item1);
            row2.Cells[1].AddParagraph(item2);
            row2.Cells[2].AddParagraph(item3);
            row2.Cells[3].AddParagraph(item4);
            row2.Cells[4].AddParagraph(item5);
            row2.Cells[5].AddParagraph(item6);
           

                }


       


            DocumentRenderer docRenderer = new MigraDoc.Rendering.DocumentRenderer(doc);
            docRenderer.PrepareDocument();
            XGraphics gfx = XGraphics.FromPdfPage(page0);
           
            docRenderer.RenderPage(gfx, 1, PageRenderOptions.All);
           
           
            outputPdf.Save("C:/Documents and Settings/Matthew Bryant/My Documents/Visual Studio 2008/WebSites/Matt Drop Down/mattsfile.pdf");
Back to top
View user's profile Send private message
stu72



Joined: 12 Nov 2008
Posts: 2

PostPosted: Mon Jan 05, 2009 2:09 pm    Post subject: Reply with quote

Well, looking at your code it seems to be doing exactly what you tell it to: rendering only one page.

I'm a bit confused as to why you're using the XGraphics package here. I'm using PDFSharp to render a multi-page table with headers and footers. My rendering code looks something like this:

Code:

Document document = gvPDF.CreateDocument(GridView1);
MiagraDoc.Rendering.PdfDocumentRenderer pdfRenderer = new MiagraDoc.Rendering.PdfDocumentRenderer(true);
pdfRenderer.Document = document;
pdfRenderer.RenderDocument();           
pdfRenderer.Save("test.pdf");


There's nothing special about my document, it's just a section with a table and some rows and columns.
Back to top
View user's profile Send private message
Thomas Hoevel



Joined: 16 Oct 2006
Posts: 387
Location: Cologne, Germany

PostPosted: Thu Jan 08, 2009 10:41 am    Post subject: Reply with quote

stu72 wrote:
I'm a bit confused as to why you're using the XGraphics package here.

Yep, that's right.

After calling PrepareDocument you can determine how many pages there are in the document. Then you have to loop thru all pages.

If you don't want to modify the pages with PDFsharp calls, then simply follow stu72's approach.
_________________
Regards
Thomas Hoevel
PDFsharp Team
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Support - moved to http://forum.pdfsharp.net/ All times are GMT
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © phpBB Group. Hosted by phpBB.BizHat.com


Start Your Own YouTube Clone

Free Web Hosting | Free Forum Hosting | FlashWebHost.com | Image Hosting | Photo Gallery | FreeMarriage.com

Powered by PhpBBweb.com, setup your forum now!
For Support, visit Forums.BizHat.com