PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Fri Mar 29, 2024 2:26 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Tue Nov 29, 2011 9:28 am 
Offline
Supporter

Joined: Fri May 15, 2009 3:28 pm
Posts: 96
Hi,

I have been asked to change the code behind the PDF i am creating to make it flow onto multiple pages if required.

Unfortunately the layout is fairly complex - it consists of two columns, with multiple tables nested in each column - i originally had a "container" table which set the overall layout using col widths and row heights, but that didnt really work for the flowing onto another page requirement, so I have removed this container table and just have each of the tables adding directly to the LastSection, with the tables in the right hand column now all being one table, which is absolutely positioned within a text frame to align with the right hand side of the tables in the left column - it looks good, but the absolutely positioned table will not flow over multiple pages, which is a huge problem.

So, after reading a post about having faux background images for tables/cells using:
Code:
myMigraDocImage.WrapFormat.Style = MigraDoc.DocumentObjectModel.Shapes.WrapStyle.Through;


I figured there may be something similar for a table, but there doesnt seem to be?

My plan was to set all the tables in the left column to WrapStyle.Through, then have the table in the right column actually have two columns, one the same width as the left column which would have no borders, so would be "invisible" and then bordered cells making up the "visible" right column, with the WrapStyle allowing the right column table to be positioned over the left WrapStyle.Through tables.

Would this approach work? and if so, what properties should i set on the tables?

Thanks,

Mike


Top
 Profile  
Reply with quote  
PostPosted: Tue Nov 29, 2011 9:42 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
Hi!
Table cells won't break to the next page.
How about a completely different approach?

Here's a MigraDoc sample:
http://www.pdfsharp.net/wiki/MixMigraDo ... ample.ashx

This sample draws six DIN A4 pages (scaled down) on one page.

A possible approach: create a new MigraDoc document that contains only the text that goes into the columns (just set the paper size appropriately), then do it like the sample does (without scaling, just move the text to the new location).

Or create one page for the left column, one page for the right column - and draw both on one page. This will simulate the "through" effect you asked for.

Back to your question: you can put a table into a textframe and set "through" for the textframe. I used textframes to place page numbers on the page. I rather would not use them to create multi-column text (and textframes do not break to the next page).

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Tue Nov 29, 2011 9:56 am 
Offline
Supporter

Joined: Fri May 15, 2009 3:28 pm
Posts: 96
Hi,

I realise a table row will not flow onto multiple pages, but I am not trying to do this.

I have attached a screenshot of my PDF as it currently stands - you should be able to see the right hand "column" (it is not really a column, but a table with the appropriate column widths, which is absolutely positioned to make it look like its a column) doesnt flow onto the 2nd page, but just goes off the bottom of the page, which I believe is being caused by it being contained within a TextFrame, to allow it to be absolutely positioned.

Thanks for the example - but i dont think this is going to work for my PDF.

Mike


Attachments:
ScreenHunter_01 Nov. 29 09.50.jpg
ScreenHunter_01 Nov. 29 09.50.jpg [ 158.52 KiB | Viewed 8077 times ]
Top
 Profile  
Reply with quote  
PostPosted: Tue Nov 29, 2011 11:23 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
mikesowerbutts wrote:
Thanks for the example - but i dont think this is going to work for my PDF.
Why not? Put the table for the right column into a separate MigraDoc document, set page width and height appropriately (with margins set for the right column) and leave the right column empty in your other document. Then you'll know how many pages you need. Simply call RenderPage once for every document, no transformation required.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Nov 30, 2011 3:12 pm 
Offline
Supporter

Joined: Fri May 15, 2009 3:28 pm
Posts: 96
Hi,

Sorry I didnt properly understand how your suggestion worked before - I have got this working perfectly in my PDF now.

As always, your v helpful - thanks again Thomas!

Mike


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 111 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