10 Replies Latest reply on Dec 5, 2010 1:08 PM by The Flex Viking

    Add text on every page

    MaFd0n Level 1

      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. Re: Add text on every page
          Steve L Walker Level 5

          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

          • 2. Re: Add text on every page
            MaFd0n Level 1

            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.

            • 3. Re: Add text on every page
              Steve L Walker Level 5

              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

              1 person found this helpful
              • 4. Re: Add text on every page
                MaFd0n Level 1

                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

                • 5. Re: Add text on every page
                  MaFd0n Level 1

                  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

                  • 6. Re: Add text on every page
                    Steve L Walker Level 5

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

                    • 7. Re: Add text on every page
                      MaFd0n Level 1

                      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>

                      • 8. Re: Add text on every page
                        MaFd0n Level 1

                        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.

                        • 9. Re: Add text on every page
                          Steve L Walker Level 5

                          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

                          • 10. Re: Add text on every page
                            The Flex Viking Level 1

                            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.