Skip to main content
All docs
V23.2

PdfRubberStampAnnotationFacade.SetCustomIcon(Stream) Method

Creates a custom rubber stamp icon from a page in another document.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Pdf.v23.2.Core.dll

NuGet Package: DevExpress.Pdf.Core

Declaration

public void SetCustomIcon(
    Stream pdfStream
)

Parameters

Name Type Description
pdfStream Stream

A stream that contains a document used to generate a stamp.

Remarks

The code sample below shows how to change the rubber stamp icon to a custom icon generated from another document’s page:

using DevExpress.Pdf;
using System.Linq;

using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
{
    // Load a document
    processor.LoadDocument("..\\..\\Document.pdf");

    // Access the first page properties
    PdfPageFacade page = processor.DocumentFacade.Pages[0];

    string customStampFile = "..\\..\\Demo.pdf";

    // Retrieve all rubber stamps
    var rubberStamps = page.Annotations.Where
      (annotation => annotation.Type == PdfAnnotationType.RubberStamp);

    // Set a custom icon for a rubber stamp of a specific author:
    foreach (PdfRubberStampAnnotationFacade rubberStamp in rubberStamps)
    {
        if (rubberStamp.Author == "Cardle Anita L")
        {
            using (FileStream fileStream = new FileStream(customStampFile, FileMode.Open, FileAccess.Read))
            {
              rubberStamp.SetCustomIcon(fileStream);
            }
        }
    }
    processor.SaveDocument("..\\..\\Result.pdf");
}
See Also