How to create a dynamic line

Modified on Wed, Aug 5, 2020 at 9:42 PM

There are many use case scenarios for drawing a line on a business card. You can either draw a dynamic line that will increase or decrease depending on the length of the characters being entered or a fixed line. 




The dynamic line uses 2 Go ePower functions. The first is the shrink function. The shrink function will shrink the actual block box to the size of the inputted text.


The next function being used is the draw function. The draw function has many parameters to draw a straight line the parameters would be the following: line ref="left top" x1=-1 y1=5  x2=w+1 y2=5 linewidth=2 strokecolor="cmyk 0 1 1 0"

line means that you want to draw a straight line.

ref="left top" is the reference point in other words where you want the starting position of the line to be. In this case it is from the top left corner of the block. For the bottom block it would be left bottom.

x1=-1 y1=5  x2=w+1 y2=5 x and y are the horizontal and vertical coordinates relative to the starting position as mentioned above. In this example, the beginning of the line will be 5 units above the Name and -1 unit to the left. The line will extend to the WIDTH of the block as represented by the w and then extend an extra 1 unit. The height will maintain a straight line as indicated by y2 being the same height of 5.


Click to see sample solution in action.

For a static line you can use the above concept as well however,x2 would not be dynamic (w) it will have an end unit.

See sample Solution

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article