Positioning PDF Stamps Programmatically Part III
How to change the stamp size relative to where is lands when applied from the stamps menu.
Last week I explained how to resize stamps in four corners of the page using JavaScript.
All five of our number-incrementing stamps have five different size settings. They are actually one stamp that is resized when applied, no matter where the stamp lands on on the page. This done by using the heigh/width ratio of the stamp to increase or decrease all sides proportionally.
Increase the Height by 25% and Increase the Width Proportionally
In this example, the top and bottom of the stamp with increase by 12.5% of the original height from the middle and the left and right sides will increase by 12.5% from the middle: Here are the steps:
Apply the built-in Reviewed stamp from the Dynamic category of the stamps menu, anywhere on the page.
Obtain the rect of the stamp.
Use the rect to obtain the height and width.
Decrease the left rect by 1/2 of 25% of the width.
Decrease the bottom rect by by 1/2 of 25% of the height.
Increase the right rect by 1/2 of 25% of the width.
Increase the top rect by 1/2 of 25% of the height.
Use the results of points 3 through 6 to set the rect of the stamp.
Get the course above, and a suite of automation tools for FREE with a Professional subscription.
Keep reading with a 7-day free trial
Subscribe to PDF Automation Station to keep reading this post and get 7 days of free access to the full post archives.