How do I create a high-quality custom appearance for sticky note?


**Custom appearance for sticky note looks pixelated**
**This is the code we're currently using:**
/// <summary>
/// Creates an object that contains a sticky note appearance that can be used on an annotation.
/// </summary>
/// <param name="pdfDoc">The pdf document.</param>
/// <returns></returns>
public static Obj CreateStickyNoteAppearance(PDFDoc pdfDoc)
    var name = new AssemblyName("Papers.UI.Windows");
    var assembly = Assembly.Load(name);

    Image img = null;
    using (var stream = assembly.GetManifestResourceStream("Papers.UI.Windows.Resources.StickyNote.png"))
        var bit = new BitmapImage();
        bit.StreamSource = stream;

        var objSet = new ObjSet();
        var flateHint = objSet.CreateArray();
        flateHint.PushBackNumber(9); // Set max compression vs speed.

        img = Image.Create(pdfDoc, bit, flateHint);

    using (var writer = new ElementWriter())

        using (var build = new ElementBuilder())
            var img_element = build.CreateImage(img);
            var g = img_element.GetGState();
            g.SetTransform(new Matrix2D(img.GetImageHeight(), 0, 0, img.GetImageWidth(), 0, 0));

        var stm = writer.End();

        // Set the bounding box
        stm.PutRect("BBox", img.GetImageWidth(), img.GetImageHeight(), 0, 0);
        stm.PutName("Subtype", "Form");
        return stm;


It seems that you are using a bitmap as a sticky note, which explains why you see pixels.

A quick workaround would be to increase the icon resolution (i.e. use more pixels for the image) but no matter what you will see pixels if you zoom sufficiently enough.

As an alternative you can create the icon appearance using vector graphics. For example, see parts of ElementBuilder sample:

If your icons are stored as vector pages in a PDF you could load/import them as shown in Imposition sample project, then reference the form XObject in the annotation appearance: