PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sun Apr 28, 2024 12:20 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Fri Apr 12, 2013 1:34 pm 
Offline

Joined: Thu Mar 14, 2013 3:11 pm
Posts: 5
Hi,

i have created my pdf document, now i have to add a template (it's a pdf document with logo, footer ...) and write the content into the template.

it's absolute necessary to load my template (because i have to use it for a large number of projects), so i cannot write the logo in every pdf for every project.

Is there a possibility?


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 15, 2013 8:01 am 
Offline
PDFsharp Guru
User avatar

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

You can use pages from PDF files as background and have MigraDoc draw the text in front of it.
You can do it the "MigraDoc" way (e.g. by adding the background page to the page header) or the "Mix MigraDoc and PDFsharp" way (see the sample with the same name) by modifying pages with PDFsharp after MigraDoc created them.

Depends on how many different backgrounds you have and where to apply which background.
If there is only a first page (large logo) and a follow-up page (small logo), the "MigraDoc" way will probably be appropriate.

Sample:
http://www.pdfsharp.net/wiki/MixMigraDo ... ample.ashx
(Note that the sample draws several MigraDoc pages on one PDFsharp page - you would do it 1:1, but with added background)

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 17, 2013 9:00 am 
Offline

Joined: Thu Mar 14, 2013 3:11 pm
Posts: 5
Hi,

thanks for your reply.

But, there is no way to add a source PDF (with all my logos and texts)?
This would be a big big help, because i can't add in every project every logos.

Greetings


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 17, 2013 9:11 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
CaptainGerrard8 wrote:
But, there is no way to add a source PDF (with all my logos and texts)?
I don't understand what you want.

You can use a source PDF with anything it contains - and use MigraDoc to add text, images, etc.

You always create a new PDF, but you can import pages from the source PDF and add MigraDoc content to it.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 17, 2013 1:23 pm 
Offline

Joined: Thu Mar 14, 2013 3:11 pm
Posts: 5
sorry, my fault.

in my case, in every page there is the same header and the same footer.

so the "migradoc way" is engough.

But how can i add the background to the page header?


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 17, 2013 1:51 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3096
Location: Cologne, Germany
I think the code shown here is a good starter:
viewtopic.php?p=4370#p4370

Change this:
Code:
myImage.RelativeVertical = RelativeVertical.Page;
myImage.RelativeHorizontal = RelativeHorizontal.Page;


Set Width and Height of the image to match the page size.
And don't use "document.DefaultPageSetup.DifferentFirstPageHeaderFooter = true;"

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Apr 17, 2013 2:23 pm 
Offline

Joined: Thu Mar 14, 2013 3:11 pm
Posts: 5
/edit

my mistake, sorry! it works perfect!

i think you have developed a very good software, but it would be pleasant if you create a api for users.


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

All times are UTC


Who is online

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