Printing a Watermark

Last post 12-15-2011, 2:09 PM by msaleh6. 4 replies.
Sort Posts: Previous Next
  •  12-13-2011, 4:03 PM 349032

    Printing a Watermark .NET

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

     

    public void CreateWatermark(string outputFile)

            {

                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?

     
  •  12-14-2011, 12:51 AM 349078 in reply to 349032

    Re: Printing a Watermark

    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,


    Nausherwan Aslam
    Support Developer,
    Aspose Sialkot Team
    Contact Us
     
  •  12-14-2011, 12:14 PM 349308 in reply to 349078

    Re: Printing a Watermark

    Attachment: Present (inaccessible)

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

    Thanks!

     
  •  12-15-2011, 1:24 AM 349434 in reply to 349308

    Re: Printing a Watermark

    Hi Mahmoud,

    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,


    Nausherwan Aslam
    Support Developer,
    Aspose Sialkot Team
    Contact Us
     
  •  12-15-2011, 2:09 PM 349683 in reply to 349434

    Re: Printing a Watermark

    Version 6.5 fixed the problem.  We were using version 6.1

    Thanks!

     
View as RSS news feed in XML