Expand my Community achievements bar.

SOLVED

Add text on every page

Avatar

Former Community Member

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
Former Community Member

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

10 Replies

Avatar

Correct answer by
Former Community Member

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

Former Community Member

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

Former Community Member

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

Former Community Member

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

Former Community Member

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

Former Community Member

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

Avatar

Former Community Member

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

Former Community Member

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

Former Community Member

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

Former Community Member

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.

The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----