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

Free Support Forum - aspose.com

Watermark shows in strange perspective in Words 15.4.0

When I add a watermark to a page in my document, it shows in a strange perspective in version 15.12.0 (I used the example Java code below).

In a former version (15.4.0) is was still correct.

        /// 
/// Inserts a watermark into a document.
///
/// <param name=“doc”>The input document.
/// <param name=“watermarkText”>Text of the watermark.
private static 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);
        <span class="code-comment" style="color: rgb(128, 128, 128); background-color: inherit;">// 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 = Color.Gray; // Try LightGray to get more Word-style watermark
watermark.StrokeColor = 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;

        <span class="code-comment" style="color: rgb(128, 128, 128); background-color: inherit;">// Create a <span class="code-keyword" style="color: rgb(0, 0, 145); background-color: inherit;">new</span> paragraph and append the watermark to <span class="code-keyword" style="color: rgb(0, 0, 145); background-color: inherit;">this</span> paragraph.

Paragraph watermarkPara = new Paragraph(doc);
watermarkPara.AppendChild(watermark);

        <span class="code-comment" style="color: rgb(128, 128, 128); background-color: inherit;">// 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);
}
}

Hi Wim,

Thanks for your inquiry. It would be great if you please share following detail for investigation purposes.


  • Please attach your input Word document.
  • Please attach the output Word file that shows the undesired behavior.
  • Please
    attach your target Word document showing the desired behavior. You can
    use Microsoft Word to create your target Word document. We will
    investigate how you are expecting your final document be generated
    like.

As soon as you get these pieces of information to
us we’ll start our investigation into your issue.

I need to elaborate this inquiry:


The strange watermark happens after converting the document to PDF with the following code:
(The document content is in the output stream)

Document pdfdoc = document.deepClone();
PdfSaveOptions options = new PdfSaveOptions();
options.setCompliance( PdfCompliance.PDF_15 );
pdfdoc.save(stream, options);

Attached 4 files, as requested:
businessplan.docx - original document
businessplan_concept-15.4.0.docx - watermark added in Aspose.Words version 15.4.0
businessplan_concept-15.12.0.docx - watermark added in Aspose.Words version 15.12.0
businessplan_concept-15.12.0.pdf - Converted to PDF - watch the strange watermark

Hi Wim,

Thanks for sharing the detail. We have tested the scenario using following code example and have managed to reproduce the same issue at our side. You will be notified via this forum thread once this issue is resolved. We will share the issue ID with you soon.


We apologize for your inconvenience.

Document pdfdoc = new Document(MyDir + “businessplan.docx”);<o:p></o:p>

insertWatermarkText(pdfdoc, "Concept");

pdfdoc.save(MyDir + "Out.pdf");

Hi Wim,

We logged this problem in our issue tracking system as WORDSJAVA-1258. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSJAVA-1258) have been fixed in this .NET update and this Java update.


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

Hi, from what version has this issue fixed? (the link only show a list of versions, not a specific version)

@wotnot,

Thanks for your inquiry. This issue was fixed in February 2016 release (Aspose.Words 16.2). Please let us know if you have any more queries.