I got this sort of working. I used a 2 step process.
- Using Word, I created a "blank" PDF. I used a greenish background color on the Word doc so I could see it.
- Use DDX to create a PDF with the Watermark I want. I am doing this really only to provide the background color.
- The content of the StyledText is generated on the fly from user input, so I can't "hardcode" the size.
<DDX xmlns='http://ns.adobe.com/DDX/1.0/'>
<PDF result='result.pdf' save='Full'>
<PDF source='blank_pdf' pages='1'>
<PageMargins left='0pt' top='0pt' />
<PageSize width='200pt' height='200pt' />
<Watermark opacity='100%' horizontalAnchor='Left' verticalAnchor='Top'>
<StyledText color='#000000' font-size='14pt'>
<p>This is line 1 of my watermark with a background color</p>
<p>This is line 2 of my watermark with a background color</p>
<p>This is line 3 of my watermark with a background color</p>
</StyledText>
</Watermark>
</PDF>
</PDF>
</DDX>
- Fetch the resulting PDF from the AssemblerResult, Call this "stamp_pdf"
- Use DDX to create a PDF using the "stamp_pdf" as the source of the WaterMark where inDoc1 is the PDF I want to apply the stamp to
<DDX xmlns='http://ns.adobe.com/DDX/1.0/'>
<PDF result='result.pdf' save='Full'>
<PDF source='inDoc1' pages='1'>
<PageMargins left='18pt' top='18pt' right='18pt' />
<Watermark opacity='100%' horizontalAnchor='Left' verticalAnchor='Top'>
<PDF source='stamp_pdf' pages='1'/>
</Watermark>
</PDF>
<PDF source='inDoc1' pages='2-last'/>
</PDF>
</DDX>
The problem is the bold PageSize line. I don't want to specify the size. I would like the Watermark to be big enough to contain the StyledText, but no larger. But if I don't do this, it covers up 100% of the final document