PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sun Jul 14, 2024 2:06 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Alternate pages
PostPosted: Mon Oct 10, 2011 12:24 pm 
Offline

Joined: Mon Oct 10, 2011 11:49 am
Posts: 2
I am creating a document in MigraDoc and would like to alternate pages between two distinct set ups. The specific scenario will probably make more sense:

I have an invoice print (not too dissimilar to the sample invoice project) where the invoice lines are in a table so that on reaching the end of the page it will automatically create a new one.

I have another section that defines a terms and conditions page that needs to appear after each invoice page (when on paper this gets duplexed on the back).

At the moment it just appears after the last page of the invoice and I'm not sure how to get around this.

I've had a number of thoughts about how this could be done but haven't been able to do so successfully yet.
1) Add something like the Odd/Even Headers and Footers that is already available but I'm yet to figure out where to implement it.
2) An option on the document to do one page from each section rather than a whole section at a time.
3) Find a way to override whatever function triggers the generation of a new page.
4) Possibly creating a footer with a page break so it becomes a page in itself.

Something I'd like to avoid if possible as it seems rather untidy
5) Create the document without the t&c pages and use PdfSharp to merge that document with another just containing the t&'s.

Any of these options will do however I'd definitely rather keep it all in MigraDoc if possible as everything so far has been purely MigraDoc.

I don't mind delving into the source code to get this working however I'm not sure where to look.

Has anybody had any success with anything similar?


Top
 Profile  
Reply with quote  
 Post subject: Re: Alternate pages
PostPosted: Mon Oct 10, 2011 3:10 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3101
Location: Cologne, Germany
I think 5 is the tidiest way to get it going.

Here's a sample that calls docRenderer.RenderPage to create the pages as they are needed:
http://www.pdfsharp.net/wiki/MixMigraDo ... ample.ashx

You could optimize the filesize by using an XForm for the T&C pages - but I presume files will be printed, so filesize may not matter.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject: Re: Alternate pages
PostPosted: Mon Oct 10, 2011 3:52 pm 
Offline

Joined: Mon Oct 10, 2011 11:49 am
Posts: 2
I feared that may be the case.

Due to the way the documents are going to be created and handled afterwards throughout the project I'm working on, I'd hoped to keep it within the MigraDoc Document format rather than the PdfSharp PdfDocument one.

I guess I can use an interface and some careful coding to deal with those issues.


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 22 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:  
cron
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group