Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Styled Text + Background

Avatar

Level 4

Is there way to place StyledText on a PDF with an opaque background color of my choosing?  The goal is I want a Watermark that doesn't show the PDF behind it.

Do I have to use a blank PDF as the content of the Watermark?

0 Replies

Avatar

Level 4

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