PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu May 02, 2024 7:12 pm

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
PostPosted: Fri Jun 04, 2010 8:03 am 
Offline

Joined: Fri Jun 04, 2010 7:54 am
Posts: 2
PdfDocument document = PdfReader.Open(fileName, PdfDocumentOpenMode.Modify);
string watermark = waterText;
PdfPage page = document.Pages[document.PageCount-1];
XFont font = new XFont("Arial", 6, XFontStyle.Bold);
XGraphics gfx = XGraphics.FromPdfPage(page, XGraphicsPdfPageOptions.Prepend);
XSize size = gfx.MeasureString(watermark, font);

gfx.TranslateTransform(50, 50);
gfx.RotateTransform(-90);

// Create a string format
XStringFormat format = new XStringFormat();
format.Alignment = XStringAlignment.Near;
format.LineAlignment = XLineAlignment.Near;

// Create a dimmed red brush
XBrush brush = new XSolidBrush(XColor.FromArgb(Color.Black));

// Draw the string
gfx.DrawString(watermark, font, brush, new XPoint(100-page.Height, page.Width - 80), format);


when i use the DrawString method,sometimes the watermark is covered by something, like pictures.

hou can I use the DrawString method to put the watermark always in the front?

Thanks.


Top
 Profile  
Reply with quote  
PostPosted: Fri Jun 04, 2010 8:28 am 
Offline

Joined: Fri Jun 04, 2010 7:54 am
Posts: 2
I have known the answer.

XGraphics gfx = XGraphics.FromPdfPage(page, XGraphicsPdfPageOptions.Append);

Thanks.


Top
 Profile  
Reply with quote  
PostPosted: Fri Sep 03, 2010 8:51 am 
Offline

Joined: Fri Sep 03, 2010 8:01 am
Posts: 1
Hi there,

I ran into the same problem but setting the parameter to Append does not help in my case. I attach my pdf, wich is a little bit strange, since it contains a tiff image. The file was produced with a TIFF printer driver having the capability of converting its output to a PDF File.

I am willing to change the document content but I do not have any idea how, and where to start.

Any help is greatly appreciated.

TIS - kermit


Attachments:
Portable Document Format.zip [1.12 KiB]
Downloaded 328 times
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 79 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