PDFsharp & MigraDoc Foundation https://forum.pdfsharp.net/ |
|
Need to include a logo into a pdf as watermark in backgroud https://forum.pdfsharp.net/viewtopic.php?f=2&t=738 |
Page 1 of 1 |
Author: | Shanthi [ Sat May 23, 2009 11:48 am ] |
Post subject: | Need to include a logo into a pdf as watermark in backgroud |
I Need to include a logo into a pdf as a background how can i perform this pls help, Regards Shanthi |
Author: | Thomas Hoevel [ Mon May 25, 2009 7:52 am ] |
Post subject: | |
See Watermark sample on adding watermarks. See Graphics sample on adding graphics. Combine snippets from both samples and you're done. |
Author: | Shanthi [ Thu May 28, 2009 4:12 am ] |
Post subject: | |
Thanks for your guidance I have used the below code to achieve my target Code: // Add LOGO inside pdf
string filename = Server.MapPath("~/Uploads/") + FileUpload1.FileName.ToString(); FileUpload1.SaveAs(filename); PdfDocument document = PdfReader.Open(filename); // Set version to PDF 1.4 (Acrobat 5) because we use transparency. if (document.Version < 14) document.Version = 14; for (int idx = 0; idx < document.Pages.Count; idx++) { PdfPage page = document.Pages[idx]; XGraphics gfx = XGraphics.FromPdfPage(page, XGraphicsPdfPageOptions.Prepend); string imgPath = System.Web.HttpContext.Current.Server.MapPath("Images/nals_logo.jpg"); XImage image = XImage.FromFile(imgPath); gfx.DrawImage(image, 100, 200); } // Save the document... document.Save(filename); // ...and start a viewer Process.Start(filename); |
Page 1 of 1 | All times are UTC |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |