direction: Find out size of image block

Modified on Mon, May 14, 2018 at 10:56 AM

The direction function allows you to know if an uploaded image is vertical meaning portrait or landscape (horizontal) or square so that you can change the shape of your image block so that the uploaded image fits properly.


This function is used inside values for commands (like paragraph or filename) to return whether the uploaded image is vertical, horizontal or square.


Syntax:

!direction path to image or {BlockName} direction!

Returns:

vertical, horizontal or square


Example:

Block 1

Block Name: Logo

Block Type: Image

Custom Commands:

status: noprint

Block 2

Block Name: PlaceLogo

Block Type: Image

Custom Commands:

status: hide

filename: {Logo}

optlist:

!!if "!direction {Logo} direction!"="vertical"%%rect={0.41 0.68 2.98 5.12}%%rect={0.41 2.90 7.96 5.12}!!

IMPORTANT: rect dimensions in optlist are in inches (they can be copied and pasted from PDFLib plugin as is)

So figure out how the rectangle should look by creating those blocks and take the coordinates and put them into the optlist if statement.


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