Breathe life into your 4D Write Pro documents with pictures

Unless you’re Stephen King and planning to write the next best seller, you may want to avoid long block of texts. And you can do this by using illustrations and images in your documents! Luckily, working with pictures in 4D Write Pro is evolving with every release, and these graphic-related features allow you to breathe life into your drab black and white text documents. In this blog post, we’ll explain the different types of pictures in 4D Write Pro, their use, and how to take advantage of them to create visually compelling documents!

So far there are three types of pictures that can be used in 4D Write Pro, depending on your needs:

background pictures

Background pictures can be added either to your 4D Write Pro documents or to the document’s elements such as tables, paragraphs, sections, just to name a few. They can be clipped to the border or the paper box by using the wk background image or wk background image url attributes with the WP SET ATTRIBUTES command. Background pictures are a good fit when it comes to needing paper-folding lines or watermarks. Make sure the image is discrete enough so it doesn’t take the focus away from the text and other images in the document. This will ensure that everything works well with the background picture!

example

Below is a code snippet of setting a background image covering the entire printable area:

WP SET ATTRIBUTES(wpArea;wk background image;$picture)
WP SET ATTRIBUTES(wpArea;wk background clip;wk paper box)
WP SET ATTRIBUTES(wpArea;wk background origin;wk paper box)

Inline pictures

Inline pictures are inserted as a character in a valid 4D Write Pro range object with the WP INSERT PICTURE command and the specified insertion mode (before, after or replace text). The picture could be loaded either from disk or from a picture field in the database. Some great examples of using inline pictures are inserting your company logo into your invoices or adding product images for each of your products!

example

WP INSERT PICTURE($wpRange;document;wk replace)

anchored pictures

With anchored pictures, full control is given over picture insertion at a specific position in a document, behind or in front of text, as well as whether the picture is anchored to the page or to specific parts of the document (i.e., header, footer, sections). Use the WP Add picture command to add a picture at a specific position, and then define its exact position using either the WP SET ATTRIBUTES command or the appropriate standard action!

example

ARRAY TEXT(arrPath;0)
C_OBJECT($obImage)

$path:=Select document(Get 4D folder(Current resources folder);"";\
"Select an image";Use sheet window+Package open;arrPath)

If (OK=1)
  $obImage:=WP Add picture(wpArea;arrPath{1})
End if

 

See the different types in action

Checkout how these different types of pictures can work together to create beautifully designed documents!

HDI: making use of different types of pictures to create a resume

Avatar
• Product Marketing Manager • Intissar joined 4D in 2017 as a Product Marketing Manager. She works closely with the product, marketing, engineering, and technical support teams to highlight the ‘why’, the ‘how’, and the ‘what’ of new and updated features to different audiences. This close proximity allows her to craft messaging frameworks and write in-depth content and code samples for the 4D blog and website. After graduating with an engineer's degree in Computer Science from VINCI university, Intissar worked in several startups as a software engineer. Her hands-on experience includes software specification, design, and development, user training and support, and team management.