ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Need help: Dynamic positioning of image in print file

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Need help: Dynamic positioning of image in print file

    Hi fellow professionals, I am new to AS400 and I am trying to find a solution to a problem below:

    Scenario: I need to print an image (e.g. Digital signature) after printing a specific record format (e.g. AMOUNTR).
    AMOUNTR may have different number of lines depending on certain conditions, which means I cannot put the image on a fixed position.

    Based on my research, there are only 2 ways to use an image in the print file.
    1. OVERLAY - uses a pre-formatted document with fixed layout. Therefore I cannot use this as I need the positioning of image to be dynamic.
    2. PAGSEG - calls an image with position based on X and Y where:
    X = position down
    Y = position across

    I already tried to use PAGSEG by supplying both position fields from Cobol program. Field Y can be a fixed position since I am putting the image on the right side. The field X, however, needs to be dynamic.

    To get value of X, first, I get the approximate height of each line which is 4mm. Since PAGSEG is based on inches, I divided 4mm by 25.4 (1 inch) and the result is 0.157. Then, I need to count the number of lines printed before I print the image.

    X = 0.157 x # of lines printed
    E.g. Lines printed = 49
    X = 0.157 x 49
    X = 7.693

    This means the image will be positioned 7.693 inches down from the top margin.

    This formula works fine for a few lines but not accurate for all.

    Is there another way to achieve this?

    Hi Moderator, if I posted on the wrong forum, please move this to the correct one. Thank you!
Working...
X