We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Printing a Watermark

We add a watermark to a PDF file using this logic:

public void CreateWatermark(string outputFile)<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

{

PdfFileInfo fileInfo = new PdfFileInfo(outputFile);

Aspose.Pdf.Facades.Stamp stamp = new Aspose.Pdf.Facades.Stamp();

stamp.BindLogo(new FormattedText("DEMO", System.Drawing.Color.Blue, System.Drawing.Color.White,

Aspose.Pdf.Facades.FontStyle.Helvetica, EncodingType.Winansi, true, 100));

stamp.SetOrigin(fileInfo.GetPageWidth(1) / 4, fileInfo.GetPageHeight(1) / 2);

stamp.IsBackground = true;

stamp.Rotation = 30;

stamp.Opacity = .7F;

PdfFileStamp fileStamp = new PdfFileStamp(outputFile, outputFile);

fileStamp.AddStamp(stamp);

fileStamp.Close();

}

We can see and print the PDF with the watermark in Adobe Reader, but when we use PdfViewer to print the PDF the watermark does not show:

public void PrintPdf(string pdfpath)

{

PdfViewer pdfview = new PdfViewer();

pdfview.OpenPdfFile(pdfpath);

pdfview.GetDefaultPrinterSettings();

pdfview.PrintPageDialog = true;

pdfview.PrintDocument();

pdfview.ClosePdfFile();

}

How can we use ASPOSE to print a PDF file with a watermark using the default printer settings?

Hi Mahmoud,

Thank you for sharing the sample code.

Please share the template PDF file your are using. This will help us figure out the issue soon.

Thank You & Best Regards,

I uploaded two attachments, one without the watermark and another with the watermark.

Thanks!

Hi Mahmoud,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for sharing the template files.

I have tested your scenario with the latest version of Aspose.Pdf for .NET v6.5 and it works fine (resultant PDF is attached which is generated with Abode as Default Printer). Please download and try the latest version and let us know if you still face the issue.

Thank You & Best Regards,

Version 6.5 fixed the problem. We were using version 6.1

Thanks!