Images in absolute position in 4D Write Pro

Automatically translated from English

Pictures speak louder than words, or so they say. In fact, according to researchers the brain processes images 60,000 times faster than words. 4D Write Pro is constantly evolving, version after version, to support more and more picture-related features. After in-line pictures and background pictures, 4D v16 R6 gives you the full control over picture insertion at a specific position in a document, in front of or behind text, as well as anchored to the page or specific parts of the document (i.e., header, footer, sections).

Example: how to handle pictures in absolute position

What’s possible now?

How to add aN IMAGE in absolute position?

To add a picture at a specific position, you first need to add the picture to the page with the new WP Add picture command. You can pass either a 4D picture variable or a path to a picture.

Then, you define its exact position using either the WP SET ATTRIBUTE command or the appropriate standard action. By default, the added picture is behind the text at the top left corner of the paper box and on all pages.

$pictureFilePath:=Get 4D folder(Current resources folder)+"myPicture.png"

// Add an anchored image on the first page and horizontally centered

$oImage:=WP Add picture(vDoc;$pictureFilePath)
WP SET ATTRIBUTES($oImage;wk anchor page;wk anchor first page)
WP SET ATTRIBUTES($oImage;wk anchor horizontal align;wk center)

To learn more about handling pictures, please refer to this article in the documentation.

NEW Standard actions

New standard actions have been created to handle images in absolute position:

  • anchorLayout – defines whether the image is behind or in front of the text
  • anchorAlignVertical and anchorAlignHorizontal – define the horizontal/vertical alignment of the image (left, right, top, bottom, or centered)
  • anchorOrigin – defines the area (header, footer, paper edge) relative to the absolute position of the image
  • anchorPage and anchorSection – defines where the image is displayed (the page(s) or section(s) )
  • moveToBack and moveToFront – moves the image to the back or front

For more information, you can take a look at to the complete list of 4D Write Pro standard actions. Please also note that all existing standard actions applicable to images can also be used with images in absolute position.

New set of attributes

More possibilities are available for the WP GET ATTRIBUTES and WP SET ATTRIBUTE commands: a new set of selectors has been added to manage the new absolute position properties.

Here is an example of a few constants available for images in absolute position:

  • wk anchor layout – defines whether the image is behind or in front of the text
  • wk anchor horizontal align and wk anchor vertical align – define the horizontal/vertical alignment of the image (left, right, top, bottom, or centered)
  • wk anchor horizontal offset and wk anchor vertical offset – defines the horizontal/vertical offset of an image relative to the origin (wk anchor origin)
  • wk anchor page and wk anchor section – defines the page/section index or the type of page/section where the image is anchored

For more info, you can take a look at the complete list of 4D Write Pro attributes.

Vanessa Talbot

• Product Owner •

Vanessa Talbot joined 4D Program team in June, 2014. As a Product Owner, she is in charge of writing the user stories then translating it to functional specifications. Her role is also to make sure that the feature implementation delivered is meeting the customer need.

Since her arrival, she has worked to define key features in 4D. She has worked on most of preemptive multi-threading new features and also on a very complex subject: the new architecture for engined application. Vanessa has a degree from Telecom Saint-Etienne. She began her career at the Criminal Research Institute as a developer for the audiovisual department. She has also worked in media and medical fields as expert in technical support, production as well as documenting new features.