PDFsharp & MigraDoc Foundation

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

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: Thu Nov 03, 2016 11:06 am 
Offline

Joined: Wed May 25, 2016 4:19 pm
Posts: 8
Hi,

I have a .mdddl loaded by Migradoc.

Is there a way to add a watermark in the .mdddl or in the code behind at the moment I load the file ?

Thank you


Last edited by parouuu on Thu Nov 10, 2016 1:05 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Thu Nov 03, 2016 2:17 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
Hi!
parouuu wrote:
Is there a way to add a watermark in the .mdddl or in the code behind at the moment I load the file?
I can think of several ways to do that. Maybe the question should be more specific.

Why .MDDDL?

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Nov 03, 2016 2:29 pm 
Offline

Joined: Wed May 25, 2016 4:19 pm
Posts: 8
Hi, thank you for the answer.

We use mdddl so we can store the model of each individual PDF then modify it and rebuild it. That's the way our app works today, that cannot be changed.

I need a big watermark in the background half transparent so people cant print it and claim it's an original document.

Thanks


Top
 Profile  
Reply with quote  
PostPosted: Thu Nov 03, 2016 3:47 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
If you give PDF to your customers then there probably is no need to modify the MDDDL.

Just modify the PDF like the Watermark sample does:
http://www.pdfsharp.net/wiki/Watermark-sample.ashx


You can do it with MDDDL by e.g. adding an image to the headers or footers of each section.
To achieve that, you can read the MDDDL with MigraDoc, make the changes using the MigraDoc Document Object Model, and save back to MDDDL.

You could also make the changes directly to the MDDDL file, but that requires some parsing.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Tue Nov 08, 2016 11:10 am 
Offline

Joined: Wed May 25, 2016 4:19 pm
Posts: 8
Hi,

Thank you for your answer.

I can't figure out how to use the samples quoted above (using PdfSharp's XGraphic) and Migradoc.DocumentObjectModel.Document, could you explain me quickly please ?


Top
 Profile  
Reply with quote  
PostPosted: Wed Nov 09, 2016 4:17 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3095
Location: Cologne, Germany
parouuu wrote:
I can't figure out how to use the samples quoted above (using PdfSharp's XGraphic) and Migradoc.DocumentObjectModel.Document, could you explain me quickly please ?
I cannot figure out what you don't understand.

Adopt the Watermark sample to your needs, create a PDF file from the MDDDL for internal use, process this PDF file with the modified Watermark sample and save it under a different name and there is the PDF file for your customers.
That is the simple solution - and you do not have to deal with the DocumentObjectModel if you take this simple approach.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Nov 10, 2016 1:05 pm 
Offline

Joined: Wed May 25, 2016 4:19 pm
Posts: 8
Ok I managed to do it thank you !

I used the code in this thread to copy the pdf into a new one with the watermark


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: Google [Bot] and 171 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