JavaScript imposition - using Place Content during imposition

Using Place Content functionality during imposition is only available for pdfToolbox 16 or later.

Next to using the core imposition functions that place pages or text into slots on an imposed sheet, pdfToolbox also supports using Place Content functionality during the imposition process. This functionality does not use the slot system (in other words, you don't have to create slots to add content to the imposed sheet), but it does come with convenience functions. The functionality available during imposition is very similar to the respective place content fixups. To play with the possibilities of the functionality, using those fixups is a good idea. This article describes all place content functionality available.

Common aspects

All of the place content functions follow the same call signature:

const imposition = new Impose();
imposition.placeText( sheetID, {...});
Click to copy

The convenience functions have to be called on an "Impose" object, just as the other convenience functions. The all take a "sheet ID" as their first parameter. This typically is the result of a call to the addSheet convenience function. The second parameter is a JavaScript object containing all properties for the object that is to be created.

Because these functions don't use the slot system, the properties for the object include where the object should be positioned on the imposed sheet.

Place text

This function places text in a specific area of a sheet. While there is some similarity to the "addText" convenience function that uses the slot system, this function is based on place content and thus supports more capabilities (such as HTML formatting).

imposition.placeText( sheetID, {
	color_space: 'cmyk_percent',    
	color_value_1: 0.0,    
	color_value_2: 0.0,    
	color_value_3: 0.0,    
	color_value_4: 100.0,    
	create_as_spot_color: false,    
	create_on_layer: false,    
	create_white_background: false,    
	font: 'Herculanum, Arial',    
	font_method: 'font_family',    
	fontsize_pt: 24.0,    
	horizontal_offset: 10.0,    
	layername: '',    
	of: 'cropbox',    
	overprint: 'off',    
	relative_to: 'lower_left_corner',    
	rotation_degrees: 0.0,    
	spot_color_name: '',    
	spot_color_tint_value: 100,    
	text: '<i>hello</i> <b>world</b>',    
	unit: 'mm',    vertical_offset: 10.0,
});
Click to copy

Place line

This function places a line in a specific area of a sheet. Check out the "Place line" fixup to understand the properties.

imposition.placeLine( sheetID, {
	blend_mode: 'normal',    
	create_as_spot_color: false,    
	create_objects_behind_current_page_content: false,    
	create_on_layer: '',    
	endpoint_x: 100.0,    
	endpoint_y: 100.0,    
	of: 'cropbox',    
	relative_to: 'lower_left_corner',    
	set_color_space_for_stroke: 'cmyk_percent',    
	set_line_cap_style: 'butt_end_caps',    
	set_line_dash_pattern: '',    
	set_line_join_style: 'miter_joins',    
	set_line_width: 5.0,    
	set_opacity_for_stroke: 100,    
	set_overprint_for_stroke: 'off',    
	set_rendering_intent: 'relativecolorimetric',    
	source_color_value_1: 0.0,    
	source_color_value_2: 0.0,    
	source_color_value_3: 0.0,    
	source_color_value_4: 100.0,    
	spot_color_name: '',    
	spot_color_tint_value: 100,    
	startpoint_x: 10.0,    
	startpoint_y: 10.0,    
	unit: 'mm',
});
Click to copy

Place rectangle

This function places a rectangle in a specific area of a sheet. Check out the "Place rectangle" fixup to understand the properties.

imposition.placeRectangle( sheetID, {
	blend_mode: 'normal',    
	create_objects_behind_current_page_content: false,    
	create_on_layer: '',    
	file_spot_color_name: '',    
	file_spot_color_tint_value: 100,    
	fill_create_as_spot_color: false,    
	fill_source_color_value_1: 0.0,    
	fill_source_color_value_2: 0.0,    
	fill_source_color_value_3: 0.0,    
	fill_source_color_value_4: 0.0,    
	height: 50,    
	of: 'cropbox',    
	position_of_center_x: 60,    
	position_of_center_y: 60,    
	relative_to: 'lower_left_corner',    
	rotation_degrees: 0.0,    
	rounded_corner: 0.0,    
	set_color_space_for_fill: 'none',    
	set_color_space_for_stroke: 'cmyk_percent',    
	set_line_dash_pattern: '',    
	set_line_width: 1.0,    
	set_opacity_for_fill: 100,    
	set_opacity_for_stroke: 100,    
	set_overprint_for_fill: 'off',    
	set_overprint_for_stroke: 'off',    
	set_rendering_intent: 'relativecolorimetric',    
	stroke_create_as_spot_color: false,    
	stroke_source_color_value_1: 0.0,    
	stroke_source_color_value_2: 0.0,    
	stroke_source_color_value_3: 0.0,    
	stroke_source_color_value_4: 100.0,    
	stroke_spot_color_name: '',    
	stroke_spot_color_tint_value: 100,    
	unit: 'mm',    
	width: 50,
});
Click to copy

Place ellipse

This function places a circle / ellipse in a specific area of a sheet. Check out the "Place circle/ellipse" fixup to understand the properties.

imposition.placeEllipse( sheetID, {
	blend_mode: 'normal',    
	create_objects_behind_current_page_content: false,    
	create_on_layer: '',    
	fill_create_as_spot_color: false,    
	fill_source_color_value_1: 0.0,    
	fill_source_color_value_2: 0.0,    
	fill_source_color_value_3: 0.0,    
	fill_source_color_value_4: 0.0,    
	fill_spot_color_name: '',    
	fill_spot_color_tint_value: 100,    
	horizontal_diameter: 50,    
	of: 'cropbox',    
	position_of_center_x: 60,    
	position_of_center_y: 60,    
	relative_to: 'lower_left_corner',    
	rotation_degrees: 0,    
	set_color_space_for_fill: 'cmyk_percent',    
	set_color_space_for_stroke: 'none',    
	set_line_dash_pattern: '',    
	set_line_width: 5.0,    
	set_opacity_for_fill: 50,    
	set_opacity_for_stroke: 100,    
	set_overprint_for_fill: 'off',    
	set_overprint_for_stroke: 'off',    
	set_rendering_intent: 'relativecolorimetric',    
	stroke_create_as_spot_color: false,    
	stroke_source_color_value_1: 0.0,    
	stroke_source_color_value_2: 0.0,    
	stroke_source_color_value_3: 0.0,    
	stroke_source_color_value_4: 100.0,    
	stroke_spot_color_name: '',    
	stroke_spot_color_tint_value: 100,    
	unit: 'mm',    
	vertical_diameter: 40,
});
Click to copy

Place barcode

This function places a barcode in a specific area of a sheet. Check out the "Place barcode" fixup to understand the properties.

imposition.placeBarcode( sheetID, {
	background_color_space: 'cmyk_percent',    
	background_color_value_1: 0.0,    
	background_color_value_2: 0.0,    
	background_color_value_3: 0.0,    
	background_color_value_4: 0.0,    
	background_create_as_spot_color: false,    
	background_spot_color_name: '',    
	background_spot_color_tint_value: 100,    
	bottom: 0.0,    
	color_space: 'cmyk_percent',    
	color_value_1: 0.0,    
	color_value_2: 0.0,    
	color_value_3: 0.0,    
	color_value_4: 100.0,    
	create_as_spot_color: false,    
	create_on_layer: false,    
	create_white_background: true,    
	font: 'Arial',    
	font_method: 'font_family',    
	fontsize_pt: 12.0,    
	height: 40.0,    
	horizontal_offset: 10.0,    
	layername: '',    
	left: 0.0,    
	of: 'cropbox',    
	overprint: 'off',    
	place_barcode_parameter: {        
		config: [            
			{
			  params: {                    
					barcode_parameters_json: {},
          },
        },
		],
	},    
	relative_to: 'lower_right_corner',    
	right: 0.0,    
	rotation_degrees: 0.0,    
	spot_color_name: '',    
	spot_color_tint_value: 100,    
	top: 0.0,    
	type_of_barcode: 'QR-Code',    
	unit: 'mm',    
	value: 'www.callassoftware.com',    
	vertical_offset: 10.0,    
	width: 40.0,
});
Click to copy