PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sun Jun 16, 2024 12:48 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Help for a newbie?
PostPosted: Tue Apr 24, 2012 1:45 pm 
Offline

Joined: Tue Apr 24, 2012 1:38 pm
Posts: 3
Hey,

This is probably a stupid question, but could do with some help with migradoc. From what I understood, by using migradoc, anything I sent to it over one page long, a new page would be generated automatically. However going through some of your examples, when I have tried adding a paragraph with text that overflows, a new page isn't generated it just cuts the text off.

Have I have got the wrong idea of migradoc? If not, any chance of some sample code that shows migradoc generating a new page when needed, which I can learn from and start to build on? I need to generate a PDF from user input, but you would never know when the page end is reached so there is no way on code I can predict and generate a new page when needed.

Thanks in advance,
Vickie Pring


Top
 Profile  
Reply with quote  
 Post subject: Re: Help for a newbie?
PostPosted: Tue Apr 24, 2012 2:45 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3100
Location: Cologne, Germany
Hi!

MigraDoc creates new pages automatically. But TextFrames and table cells will not break to the next page. Tables will break to the next page, but each table row must fit on a single page and will not break to the next page.
http://www.pdfsharp.net/wiki/MigraDocSamples.ashx

PDFsharp does not add page breaks automatically.

Which samples did you try and what did you change?

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject: Re: Help for a newbie?
PostPosted: Tue Apr 24, 2012 2:51 pm 
Offline

Joined: Tue Apr 24, 2012 1:38 pm
Posts: 3
I tried the migradoc / pdf sharp combined code. I did this because my colleague has already used PDFSharp, so thought I could share his initialisation code then create migradoc pages. In that example, I tried adding text to the paragraph in the migradoc page to make it bigger than the page, and also put it in the loop to create 10 instances of a paragraph but it showed the first paragraph cut off and then the file ended.

Does the the fact that it's a combined example mean the migradoc functionality is limited? If so, I guess I need to go through the total migradoc example


Top
 Profile  
Reply with quote  
 Post subject: Re: Help for a newbie?
PostPosted: Tue Apr 24, 2012 3:11 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3100
Location: Cologne, Germany
The "Mix MigraDoc and PDFsharp" draws several MigraDoc pages onto the second page of an PDFsharp document.
If the MigraDoc part grows too much to fit on one page, no new page is added. This is a limitation of the sample program.

It's just a demo creating a single page with thumbnails of MigraDoc pages, but there is no code to allow for more than a single page with thumbnails. Maybe that's the problem.

In a real-world application, you would create a single PDFsharp page for every new MigraDoc page - and the number of MigraDoc pages increases as needed for the document.
Six pages fit (maybe nine), but the seventh (or maybe the tenth) page will be clipped in this sample.

In "void SamplePage2" you'd have to add a loop that includes "document.AddPage();" for each set of nine MigraDoc pages. Use "idx % 9" as parameter for GetRect().
Document must be prepared and rendered outside the loop.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject: Re: Help for a newbie?
PostPosted: Wed Apr 25, 2012 1:56 pm 
Offline

Joined: Tue Apr 24, 2012 1:38 pm
Posts: 3
Hey, I've done what you said, and the added loads more rows to the simple table example, but it still stops and doesn't create the new pages automatically. I am obviously doing something wrong.


Top
 Profile  
Reply with quote  
 Post subject: Re: Help for a newbie?
PostPosted: Wed Apr 25, 2012 3:01 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3100
Location: Cologne, Germany
bluenose wrote:
Hey, I've done what you said, and the added loads more rows to the simple table example, but it still stops and doesn't create the new pages automatically. I am obviously doing something wrong.
I don't know what you did, I don't know what you're trying to achieve - therefore I can't help you.

You can show your source code in this forum or you can upload (attach) a ZIP file with your project to get help (don't forget to mention what you want to have).

_________________
Regards
Thomas Hoevel
PDFsharp Team


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

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 161 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