PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Tue Dec 12, 2017 11:46 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 12 posts ] 
Author Message
PostPosted: Thu Nov 12, 2009 11:54 am 
Offline

Joined: Thu Nov 12, 2009 11:50 am
Posts: 5
Hi,

I already have code outputting a document almost exactly as I require.
I know how to read in a pdf document and write over it using a PdfDocument but I would have to re-write everything.

Is it possible to use the same code but add the pdf template at the start?

I guess it would be like using MigraDoc.Rendering.DocumentRenderer.RenderPage but render the whole MigraDoc.DocumentObjectModel.Document instead of a Page.


Top
 Profile  
Reply with quote  
PostPosted: Thu Nov 12, 2009 1:17 pm 
Offline
empira Employee
User avatar

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

What do you mean with template?

We mix PDF pages (containing the Corporate Design) with content generated by MigraDoc to create the final PDF document.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Nov 12, 2009 1:20 pm 
Offline

Joined: Thu Nov 12, 2009 11:50 am
Posts: 5
Yep that's what I mean!

I already have it outputting to pdf and rtf but would like to mix the pdf output with a corporate letterhead/design like you mention but without having to re-write too much.


Top
 Profile  
Reply with quote  
PostPosted: Thu Nov 12, 2009 2:55 pm 
Offline
empira Employee
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 2740
Location: Cologne, Germany
That's what we do - no problem.

The MigraDoc document must know where it may write (not to overwrite the letterhead).

In the most simple case you have a big letterhead for the first page and small letterhead for following pages.
Then you can create the document with MigraDoc - and finally run a routine that works like the Watermark sample and adds the letterheads.

Or is your case more complex?

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Nov 12, 2009 2:58 pm 
Offline

Joined: Thu Nov 12, 2009 11:50 am
Posts: 5
My case isn't complex at all, I'm just new to MigraDoc and PDFSharp and don't know how to do it in code.

I can see how to open a PDF Doc and do the above paragraph by paragraph thanks to the samples section, but that would require re-doing a lot of work and is also quite cumbersome compared to the MigraDoc code so would like a way to push that straight in.


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 16, 2009 2:20 pm 
Offline

Joined: Thu Nov 12, 2009 11:50 am
Posts: 5
Can anyone point me at an example of doing this with MigraDoc please?


Top
 Profile  
Reply with quote  
PostPosted: Tue May 09, 2017 1:02 pm 
Offline

Joined: Tue Jan 07, 2014 7:35 pm
Posts: 12
Thomas Hoevel wrote:
That's what we do - no problem.

The MigraDoc document must know where it may write (not to overwrite the letterhead).

In the most simple case you have a big letterhead for the first page and small letterhead for following pages.
Then you can create the document with MigraDoc - and finally run a routine that works like the Watermark sample and adds the letterheads.

Or is your case more complex?


I'm glad to hear this is possible. I am brand new to PDFSharp and MigraDoc. I understand that you don't want to write peoples' code for them (that is what Professional Support is for and you have to make a living), but it would be nice to at least have an algorithm on the steps to follow to write this myself (and learn the products along the way).

I have a sample document that I need recreate programmatically. It has a .png image that serves as a letterhead and a rectangle with text inside that is placed on the right side of the page near the top. I assuming that I would use PDFSharp to place the image and to draw the rectangle with the text inside.

Below these I have the body of the document (almost like a mail merge template) that I assume I would use MigraDoc to create.

What I lack is an algorithm of the steps to go through to recreate this document as a PDF. Do I need to sign up for professional support and pay the license fee to get this kind of information? I am working for a government agency and need to create these "letters" as PDF files for multiple users.

Thank you,

RandyHJ57


Top
 Profile  
Reply with quote  
PostPosted: Tue May 09, 2017 2:09 pm 
Offline
empira Employee
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 2740
Location: Cologne, Germany
Hi!
RandyHJ57 wrote:
[...] but it would be nice to at least have an algorithm on the steps to follow to write this myself (and learn the products along the way).
The are many ways.
We use PDF files for background and content - we create booklets, not letters.

If you can get the fixed part ("letterhead") as a PDF file, just use that as the background.
Or use PDFsharp to create an XForm and use that as the background on any page:
http://www.pdfsharp.net/wiki/XForms-sample.ashx

There are many different requirements and many different solutions - there isn't a single algorithm that suits all.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Tue May 09, 2017 3:36 pm 
Offline

Joined: Tue Jan 07, 2014 7:35 pm
Posts: 12
Thomas Hoevel wrote:
Hi!
RandyHJ57 wrote:
[...] but it would be nice to at least have an algorithm on the steps to follow to write this myself (and learn the products along the way).
The are many ways.
We use PDF files for background and content - we create booklets, not letters.

If you can get the fixed part ("letterhead") as a PDF file, just use that as the background.
Or use PDFsharp to create an XForm and use that as the background on any page:
http://www.pdfsharp.net/wiki/XForms-sample.ashx

There are many different requirements and many different solutions - there isn't a single algorithm that suits all.


Thank you so much for answering my post and responding to such an old thread.

One more question -

If I need to place text in a bordered box in a specific position on the page, should I use PDFSharp, or will MigraDoc do the same job for me?


Top
 Profile  
Reply with quote  
PostPosted: Wed May 10, 2017 12:15 pm 
Offline

Joined: Tue Jan 07, 2014 7:35 pm
Posts: 12
RandyHJ57 wrote:
Thomas Hoevel wrote:
Hi!
RandyHJ57 wrote:
[...] but it would be nice to at least have an algorithm on the steps to follow to write this myself (and learn the products along the way).
The are many ways.
We use PDF files for background and content - we create booklets, not letters.

If you can get the fixed part ("letterhead") as a PDF file, just use that as the background.
Or use PDFsharp to create an XForm and use that as the background on any page:
http://www.pdfsharp.net/wiki/XForms-sample.ashx

There are many different requirements and many different solutions - there isn't a single algorithm that suits all.


Thank you so much for answering my post and responding to such an old thread.

One more question -

If I need to place text in a bordered box in a specific position on the page, should I use PDFSharp, or will MigraDoc do the same job for me?


I have successfully placed my logo in the proper position at the proper size and also formatted my page height, width and margins.

I was wondering about sections. Are sections just logical containers with no spatial characteristics except what is set in formatting? Putting it another way, can sections be placed beside each other or at any position on the page, or am I missing it altogether?

Thanks,

Randy


Top
 Profile  
Reply with quote  
PostPosted: Thu May 11, 2017 2:16 pm 
Offline
empira Employee
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 2740
Location: Cologne, Germany
RandyHJ57 wrote:
I was wondering about sections. Are sections just logical containers with no spatial characteristics except what is set in formatting? Putting it another way, can sections be placed beside each other or at any position on the page, or am I missing it altogether?
Every section starts on a new page, so you cannot have two sections on one page.
Page size and page numbers are bound to sections.
I don't know which problem you want to solve with multiple sections on one page, so I cannot suggest a different solution.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Mon May 15, 2017 4:50 pm 
Offline

Joined: Tue Jan 07, 2014 7:35 pm
Posts: 12
Thomas Hoevel wrote:
RandyHJ57 wrote:
I was wondering about sections. Are sections just logical containers with no spatial characteristics except what is set in formatting? Putting it another way, can sections be placed beside each other or at any position on the page, or am I missing it altogether?
Every section starts on a new page, so you cannot have two sections on one page.
Page size and page numbers are bound to sections.
I don't know which problem you want to solve with multiple sections on one page, so I cannot suggest a different solution.


I was just asking a question about the nature of sections, which you answered. Thank you.

What I am attempting to do is write text inside a rectangle with borders and place it in an exact position on the page (right side of page next to a TextFrame.

So on the left, you have a TextFrame with a person's name, address, city and state. On the right, you have a rectangle with borders and inside the rectangle you have text that wraps inside the rectangle.

I am thinking I should be using PDFSharp to draw the rectangle with the text inside and using MigraDoc for the rest of my document (letterhead, TextFrame, body of document, and footer). Does this sound right?

I tried creating an XForm object but couldn't get everything to behave the way I wanted it to.

Any suggestions?

Thanks,

Randy


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

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 4 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:  
Powered by phpBB® Forum Software © phpBB Group