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

[AEM Gems Webinar] Accelerating Experience Manager as a Cloud Service development with Rapid Development Environments
SOLVED

Add text on every page

Avatar

Not applicable

Dear,

I have PDF files and I need to add text on every page they have.

The text can be compared to an ID.

This is not a watermark(!) because a watermark spreads out over the center of the page.

On the right margin of any page, I would like to add text rotated 90 degrees clockwise.

What I mean is something a footer or header but on the side of a page instead of top/bottom.

How am I supposed to do this? I assume making use of a DDX file may help me?

I read something about PageOverlay but I cannot see how i can add content to the pageOverlay in such a way as plain text.

Thanks in advance and awaiting a reply!

1 Accepted Solution

Avatar

Correct answer by
Level 10

You can accomplish this with a watermark and styled text.

<?xml version="1.0" encoding="UTF-8"?>

<DDX xmlns="http://ns.adobe.com/DDX/1.0/">

<PDF result="outDoc">

  <PDF source="inDoc1">

   <Watermark fitToPage="true" rotation="90" horizontalAnchor="Center" horizontalOffset="250pt">

     <StyledText><p>Confidential</p></StyledText>

   </Watermark>

  </PDF>

</PDF>

</DDX>

The result looks like this....

Untitled.png

Steve

View solution in original post

0 Replies

Avatar

Correct answer by
Level 10

You can accomplish this with a watermark and styled text.

<?xml version="1.0" encoding="UTF-8"?>

<DDX xmlns="http://ns.adobe.com/DDX/1.0/">

<PDF result="outDoc">

  <PDF source="inDoc1">

   <Watermark fitToPage="true" rotation="90" horizontalAnchor="Center" horizontalOffset="250pt">

     <StyledText><p>Confidential</p></StyledText>

   </Watermark>

  </PDF>

</PDF>

</DDX>

The result looks like this....

Untitled.png

Steve

Avatar

Not applicable

Very nice, and even with a watermark :-).

Please do note that this does not work if the pdf is a converted JPG with width-dimension lower than 250pt.

Avatar

Level 10

Good point. Using styled text and fitToPage="true" makes for an unusual DDX configuration. If the watermark were an image you could use a horizontalAnchor="Right" and horizontalOffset="-5pt" (or something close) to move the image 5 points to the left.

Steve

Avatar

Not applicable

This works indeed for any document i processed so far.

By the way, do you happen to know how I can replace this text?

As I said in the  inital post the text I'm putting there can be comepared to an ID. This ID however is mutable.

Obviously the client wants me to overwrite this text with the new ID...

So I changed WaterMark to Background and used the attribute replaceExisting.

The initial run goes perfect, it acts like the watermark. However, when I run it again with a different ID only the first page is processed correctly. There is no overlapping of text.

As I'm not allowed to upload PDF files I attached a few screenshots to illustrate my issue. Somehow it shows Page two first before page one the one with the red oval  = page two

You have been of tremendous help so far and I really appreciate your input, could you please help me out on this final issue?

Page two

Page_two.pngPage one:

Page_one.png

Avatar

Not applicable

The table of content on page one is not processed by the DDX by the way, its just a pdf which already had that TOC ev

en before there was text written on its side

Avatar

Level 10

How is the ID generated? Is it specific to a page, a chapter,...?

Avatar

Not applicable

It is text provided in the StyledText:

Complete example of the DDX i'm using:

<?xml version="1.0" encoding="utf-8"?>
<DDX xmlns="http://ns.adobe.com/DDX/1.0/">
  <PDF result="container" return="false">
    <PDF source="1" />
     <Background fitToPage="false" rotation="270" horizontalAnchor="Center" horizontalOffset="275pt" replaceExisting="true">
        <StyledText>
            <p font-family="Franklin Gothic Demi" font-size="10pt">Maximonummer: 6543210 IF 9876543210</p>
        </StyledText>
     </Background>
  </PDF>
  <PDF result="fbs_one.pdf">
    <PDF source="container" />
  </PDF>
</DDX>

Avatar

Not applicable

Obviously this part is generated:

Maximonummer: 6543210 IF 9876543210

Comes from java project but that doesn't matter. It's dropped as a file and picked up by the LiveCycle process I wrote.

Avatar

Level 10

Your DDX has a PDF result embedded in a PDF result. This is against DDX rules. I am not sure how you are generating the DDX but you will have to either define a single Background that applies to the result globally or define a Background that applies to each source, as depicted below. The content of the StyledText could be a process variable, also.

<?xml version="1.0" encoding="utf-8"?>
<DDX xmlns="http://ns.adobe.com/DDX/1.0/">
<PDF result="outDoc" return="false">
  <PDF source="inDoc1" />
    <Background fitToPage="false" rotation="270" horizontalAnchor="Center" horizontalOffset="275pt">
      <StyledText><p font-family="Franklin Gothic Demi" font-size="10pt">Maximonummer: 6543210 IF 9876543210</p></StyledText>
    </Background>
  </PDF>
  <PDF source="inDoc2" />
    <Background fitToPage="false" rotation="270" horizontalAnchor="Center" horizontalOffset="275pt">
      <StyledText><p font-family="Franklin Gothic Demi" font-size="10pt">Maximonummer: 99999999 AA 9999999999</p></StyledText>
    </Background>
  </PDF>
</PDF>
</DDX>

Steve

Avatar

Level 4

FYI ...

To make this work with pages of different sizes, I will use DDX on the PDF first to get the page width, divide that by 2, and use that as the horizontalOffset.

An E sized drawing is 1583 pixels wide at 72DPI.