Every once in a while the watermark covers something important, and so we have to go back and find the original to see what the watermark is covering up. | You can also reduce the watermark transparency by using PdfGraphics.SetTransparency. please find the below code snippet and documentation link for more details.
| |
I am curious if there is a way to shrink the page content, reduce it by half an inch, and then put the watermark in the area that is guaranteed to be empty. | We have created workaround sample for shrink the existing page content by using PdfTemplate. Please refer the below sample for more details. Sample link: |
'Draw the watermark lpage.Graphics.DrawString("Page : " + i.ToString(), font, PdfBrushes.Black, New PointF(200, lpage.Size.Height - 40)) |
Here's the code I was using, which included PDFPens and PDFBrushes: Dim g As Syncfusion.Pdf.Graphics.PdfGraphics = lpage.Graphics Dim state As Syncfusion.Pdf.Graphics.PdfGraphicsState = g.Save g.SetTransparency(0.5F) g.DrawString(i & " " & companycity & " - " & Now.ToString("M-d-yy HH:mm:ss tt"), font, Syncfusion.Pdf.Graphics.PdfPens.Black, Syncfusion.Pdf.Graphics.PdfBrushes.Black, New System.Drawing.PointF(30, lpage.Graphics.ClientSize.Height - 35)) I switched it to g.DrawString(i & " " & companycity & " - " & Now.ToString("M-d-yy HH:mm:ss tt"), font, Syncfusion.Pdf.Graphics.PdfBrushes.Black, New System.Drawing.PointF(30, lpage.Graphics.ClientSize.Height - 35)) | We are not able to reproduce the issue and the attached output document was preserved as excepted in Adobe reader please find the below screenshot for more details. Could you please provide us the below details, it would more helpful for us to investigate further on this. 1.PDF reader which is using for viewing the PDF document 2.System environment details 3.Cultrue setting details | |
and it works if I write to a new path, but I really want to write over the same file. However If I try to save to the same path I get an error: 'Unexpected token Eof before 925' So far I've tried deleting the original file first, saving to a new path and then overwriting the original, and using file streams instead of paths, but none of them seem to work. What's the right way to do it? | We have created a workaround sample for overwriting the existing PDF document to new PDF document, please refer the below code snippet and sample for more details.
Sample link : |
'Create a new PDF section Dim section As PdfSection For Each lpage As Syncfusion.Pdf.PdfPageBase In lDoc.Pages 'Add the section section = newDoc.Sections.Add() 'Set the page size section.PageSettings.Size = lpage.Size 'Set margins section.PageSettings.Margins.All = 0 'Add a new page newPage = section.Pages.Add() 'Create template. template = lpage.CreateTemplate |