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

Free Support Forum - aspose.com

Watermark with no bounding box in PDF U/A document


I have a word document, where i programmatically add a watermark with Aspose.Word and the following code:

private static void AddWatermark(Aspose.Words.Document document)
	var watermark = new Aspose.Words.Drawing.Shape(document, Aspose.Words.Drawing.ShapeType.TextPlainText);

	watermark.TextPath.Text = "Draft";
	watermark.TextPath.FontFamily = "Arial";
	watermark.AlternativeText = watermark.TextPath.Text;
	watermark.Width = 500;
	watermark.Height = 100;

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

	watermark.Fill.Color = System.Drawing.Color.LightGray;
	watermark.StrokeColor = System.Drawing.Color.LightGray;

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

	// Create a new paragraph and append the watermark to this paragraph.
	var watermarkPara = new Aspose.Words.Paragraph(document);

	// Insert the watermark into all headers of each document section.
	foreach (Aspose.Words.Section sect in document.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, Aspose.Words.HeaderFooterType.HeaderPrimary);
		InsertWatermarkIntoHeader(watermarkPara, sect, Aspose.Words.HeaderFooterType.HeaderFirst);
		InsertWatermarkIntoHeader(watermarkPara, sect, Aspose.Words.HeaderFooterType.HeaderEven);

private static void InsertWatermarkIntoHeader(Aspose.Words.Paragraph watermarkPara, Aspose.Words.Section sect, Aspose.Words.HeaderFooterType headerType)
	var header = sect.HeadersFooters[headerType];

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

	// Insert a clone of the watermark into the header.

After this I convert the document into a Pdf document with Aspose.Pdf with Pdf U/A compilance:

var pdfDocument = new Aspose.Pdf.Document(wordOutputStream);
pdfDocument.Convert(new MemoryStream(), Aspose.Pdf.PdfFormat.PDF_UA_1, Aspose.Pdf.ConvertErrorAction.Delete);

The Pdf looks good, but after checking the Pdf against WCAG rules with the Tool “PAC 3” (download here), I see an error that the figure (the watermark) has no bounding box and therefor the Pdf is not valid.

To reproduce the issue I have attached my original Word, the generated Pdf, the code and a screenshot of the result in this Sample.zip (258.6 KB). You can ignore the other “Content” error in the PAC tool, this is because of the missing license.

Is there something wrong with my watermark or is this an issue with Aspose.Pdf while converting it to a Pdf U/A document?

Thanks for your reply…


Thanks for contacting support.

Since, the features regarding PDF/UA compliance have been under development, Aspose.PDF API expectedly can bypass some compliance rules. However, we have logged all details of the issue under the ticket ID PDFNET-45681 in our issue tracking system. We will further investigate the scenario in details and as soon as some progress is made towards issue resolution, we will let you know. Please be patient and spare us little time.

We are sorry for the inconvenience.