Watermarks

Hi
I am trying to place a watermark in the margin of a PDF document/or the far most right on the right during the conversation from word to PDF - is this possible and if so can anyone provide an example. My code is below and I have attached a copy of the output file. From the attachment you can see that the watermark could shift to the right an inch or so.
Also I am trying to rotate my watermark using the following code but I cannot get this to work. Watermark.Rotation = -45 does not work.
Any help would be greatly appreciated
Regards
Des

byte[] bytes = System.Text.Encoding.ASCII.GetBytes(report);
MemoryStream stream = new MemoryStream(bytes);
// Create new doc
Document doc = new Document(stream);
// Insert Watermark
InsertWatermarkText(doc, "Copy as of " + DateTime.Now.ToShortDateString());
// Save the doc in a xml fille that can be handled by Aspose.Pdf.
doc.Save("test.xml", SaveFormat.AsposePdf);
// New a pdf object.
Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
// Bind content from the named xml file.
pdf.BindXML("test.xml", null);
// Save the result
pdf.Save("c:\\test.pdf");
public void InsertWatermarkText(Document doc, String watermarkText)
{
    // Create a watermark shape. This will be a WordArt shape. 
    // You are free to try other shape types as watermarks.
    Shape watermark = new Shape(doc, ShapeType.TextPlainText);
    // Set up the text of the watermark.
    watermark.TextPath.Text = watermarkText;
    watermark.TextPath.FontFamily = "Arial";
    watermark.TextPath.Size = 13;
    watermark.Width = 150;
    watermark.Height = 50;
    // Text will be directed from the bottom-left to the top-right corner.
    watermark.Rotation = -90;
    // watermark.Rotation = 180;
    // Remove the following two lines if you need a solid black text.
    watermark.Fill.Color = Color.White;//.Silver;//.Gray; // Try LightGray to get more Word-style watermark
    watermark.StrokeColor = Color.Silver; // 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.Top;
    watermark.HorizontalAlignment = HorizontalAlignment.Right;
    // 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);
    }
}
public 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));
}
}

Hi,
Thanks for considering Aspose.
As far as I can understand, you are adding the watermark to Word document before it’s converted into PDF format. So for the sake of correction, I’m moving this thread to Aspose.Words forum and I believe that our team of experts taking care of that product would be kind enough to find some solution to this problem.
We are sorry for the inconvenience that you’ve been facing in this regard.

Hi

Thanks for your inquiry. Please attach also your word document here for testing. I will investigate the issue and provide you more information. Maybe you can try using image as a watermark, instead of using WordArt shape.
Best regards.

Hi
What I am trying to do is add a watermark to a PDF file directly. I have a word document that does NOT contain a watermark and I am converting this document to a PDF file and would like to add a datetime stamp watermark to the PDF at the time of its creation/conversation.
I can get the watermark to display but I cant get the watermark to rotate using the following code
Watermark.Rotation = -45
Thanks
Des

Hi

Thank you for additional information. Currently, there are two ways to convert Word documents to PDF: old legacy method (Aspose.Words+Aspose.Pdf) and new method (without Aspose.Pdf). Unfortunately, in both methods there are problems with WordArt watermarks.
The legacy method does not support rotation of WordArt shapes. And the new method does not support rendering of WordArt shapes. I linked your request to the appropriate issues and you will be notified as soon as these problems are resolved.
Best regards.

The issues you have found earlier (filed as 7114) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(19)