addWatermarkFromText- Text Alignment

Ask a Question related to Adobe Acrobat SDK, Design and Development.

  1. #1

    Default addWatermarkFromText- Text Alignment

    I got the VB.Net sample code from the SDK zip and I'm programming against Acrobat 8. I had no problems modifying the code for my own use except for the 4 parameters that position the text: nHorizAlign, nVertAlign, nHorizValue, nVertValue

    The code does not have any named constants for the parameters (I didn't see anything in lac.vb). I've sort of got it working, but in order to get the text to appear higher on the page I increase the value of nVertValue. This seems counter-intuitive.

    nVertValue = 200 puts the text higher than nVertValue = 20. What is the correlation and are the constants for nHorizAlign and nVertAlign listed anywhere?

    Thank you,

    Greg
    GrexD@adobeforums.com Guest

  2. Similar Questions and Discussions

    1. Dynamic Text Box Text alignment
      hi, I want to align text of the dynamic textbox to justify. How to do this ...? Is it possible to do using html tags...? pl post a response it is...
    2. SVG Export, text alignment problem
      We use Illustrator 10 to edit the graphical part of our dynamic SVG. These graphics are then animated using javascript within the Adobe SVG viewer....
    3. Text box vertical alignment... is it possible?
      Well the title said it all... except this: if it is, how?!?
    4. Flash & Text alignment
      I'd like to have a webpage with a Flash movie at the top and plain text (not part of the flash movie) just to the right of it. I can NOT use any...
    5. alignment of text through code
      Hi all, What is the easiest way of changing the alignment of one line of a multi lined text box through code. I tried many variations of...
  3. #2

    Default Re: addWatermarkFromText- Text Alignment

    Hi Greg,

    I am currently battling the same issue. It seems like you are a month ahead of me so you probably know more that i do at this point.

    What i have found is that there a constants for nHorizAlign and nVertAlign but the jso.addwatermarkfromtext method is looking for and integer value. The Adobe SDK shows:

    app.constants.align is an object that has the possible properties left, center, right, top, and bottom, indicating the type of alignment. These values can be used to specify alignment, such as when adding a watermark.

    I guess the values for left, center, right, top, and bottom are 1, 2, 3, 4 and 5 respectively. I have tinkered with the numbers alot and have not seen the results i would expect. I can change the location in the horiz direction with nHorizAlign but the nVertAlign doesn't seem to do anything.

    Let's start with 0. If everything is 0 (nHorizAlign, nVertAlign, nHorizValue and nVertValue) then the stamp ends up in the middle of the page. What i am doing is using the page size to determine the location of the stamp.

    'Get page size for stamp placement
    Dim pdf_Page As Acrobat.CAcroPDPage
    Dim pg_Size As Object
    Dim pg_Rotation As Object
    pdf_Page = pdDoc.AcquirePage(0)
    pg_Size = pdf_Page.GetSize
    pg_Rotation = pdf_Page.GetRotate

    Dim s_X As Double
    Dim s_Y As Double

    s_X = (pdf_Page.x / -2) 'Dividing -2 moves to left edge
    s_Y = (pdf_Page.y / -2)

    You can play with the numbers. You need to add a little here and there to get the stamp exactly where you want it but it works ok.

    Also, if the bPercentage is set to True then the nHorizValue and nVertValue represent the percentage of the page to offset. This is ok but doesn't give consistant results if the pages are different sizes.

    The only thing left that i need to figure out is how to justify text. If i try to put text in a corner it still runs off the edge sometimes as the text length changes for different stamp text.

    I hope this helped you more than confused you. Please, let me know if you have had any Eureka! moments in the past month that you would like to share.

    Joel
    Joel_Swota@adobeforums.com Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139