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

Free Support Forum - aspose.com

Copyright symbol © is not visible in water mark after saving into pdf format using Aspose.Words API

I am confronting an issue while generating water mark text with copyright symbol by following official code. https://docs.aspose.com/display/wordsnet/Add+Watermark

In the abode code, I have just changed file saving from word to pdf format by using overloaded method which saves into pdf. doc.Save(“D:\sample.pdf”,SaveFormat.Pdf);

Below is the generated pdf document

SampleDoc.pdf (11.5 KB)

Here is the complete code. Please notice i have used string watermarkText = “Aspose.Words for © .NET”; string for water mark text. Output is being generated as Aspose.Words for .NET. My question is where is © symbol
image.jpg (37.7 KB)

Please help!!!

static void Main(string[] args)
{
var path = @“D:\SampleDoc.docx”;
var pathToGenerateDoc = @“D:\Watermark\SampleDoc.pdf”;
Document doc = new Document(path);

        string watermarkText = "Aspose.Words for © .NET";

        // Create a watermark shape. This will be a WordArt shape.
        // You are free to try other shape types as watermarks.
        Aspose.Words.Drawing.Shape watermark = new Aspose.Words.Drawing.Shape(doc, ShapeType.TextPlainText);

        // Set up the text of the watermark.
        watermark.TextPath.Text = watermarkText;
        watermark.TextPath.FontFamily = "Arial";
        watermark.Width = 500;
        watermark.Height = 100;

        // Text will be directed from the bottom-left to the top-right corner.
        watermark.Rotation = -40;

        // Remove the following two lines if you need a solid black text.
        watermark.Fill.Color = System.Drawing.Color.Gray; // Try LightGray to get more Word-style watermark
        watermark.StrokeColor = System.Drawing.Color.Gray; // Try LightGray to get more Word-style watermark

        // Place the watermark in the page center.
        watermark.RelativeHorizontalPosition = RelativeHorizontalPosition.Page;
        watermark.RelativeVerticalPosition = RelativeVerticalPosition.Page;
        watermark.WrapType = WrapType.None;
        watermark.VerticalAlignment = VerticalAlignment.Center;
        watermark.HorizontalAlignment = HorizontalAlignment.Center;

        // Create a new paragraph and append the watermark to this paragraph.
        Paragraph watermarkPara = new Paragraph(doc);
        watermarkPara.AppendChild(watermark);

        // Insert the watermark into all headers of each document section.
        foreach (Section sect in doc.Sections)
        {
            // There could be up to three different headers in each section, since we want
            // the watermark to appear on all pages, insert into all headers.
            insertWatermarkIntoHeader(watermarkPara, sect, HeaderFooterType.HeaderPrimary);
            insertWatermarkIntoHeader(watermarkPara, sect, HeaderFooterType.HeaderFirst);
            insertWatermarkIntoHeader(watermarkPara, sect, HeaderFooterType.HeaderEven);
        }

        **doc.Save(pathToGenerateDoc,SaveFormat.Pdf);**
    }

    static void insertWatermarkIntoHeader(Paragraph watermarkPara, Section sect, HeaderFooterType headerType)
    {
        HeaderFooter header = sect.HeadersFooters[headerType];

        if (header == null)
        {
            // There is no header of the specified type in the current section, create it.
            header = new HeaderFooter(sect.Document, headerType);
            sect.HeadersFooters.Add(header);
        }

        // Insert a clone of the watermark into the header.
        header.AppendChild(watermarkPara.Clone(true));
    }

@mehtabcompunnel,

Thanks for your inquiry. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-16815. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

Thanks @tahir.manzoor, as mentioned here ShapeType.TextBox approach instead of ShapeType.TextPlainText resolved copyright symbol © not visible and watermark stretching issue .
Thanks a ton!!!

@mehtabcompunnel,

Thanks for your feedback. We have closed this issue (WORDSNET-16815) as “Not a Bug”.