The pcData object consists of the following properties:
property | value | description |
---|---|---|
lang | en | de | fr | language to be used |
pageCount | [int] | amount of pages |
unit | mm | pt | px | in | global unit, used for all undefined variables The 'unit' property can be redefined at each marker and inherits this property down to the lower levels. |
pages | [object] | collection of page objects |
optionalContentGroups | [object] | collection of optional content such as layers |
refMarks | [object] | collection of reusable marks that can be referred in marks |
marks | [object] | collection of marks that should be placed |
structure
{
"lang": "en",
"pageCount": 1,
"unit": "mm",
"pages": [{},{}],
"optionalContentGroups": [{}, {}, {}],
"refMarks":[{}, {}],
"marks":[{}, {}]
}
If PDF Toolbox is used, this property is not needed as the marks will be placed on the processed PDF!
It is essential that a page object must be defined for each page to be created. At least the mediabox
must exist for each object, serving as a mandatory requirement.
Additionally, there are several optional page boxes whose usage can vary based on the need and context. Please note that the reference anchor for all these boxes is always the bottom left. These optional page boxes include:
cropbox
: This is an optional frame that defines the visible area of the page when it is trimmed and output.TrimBox
: An optional box that determines the final trim area of the page as it will appear post the printing process.bleedbox
: This optional box defines the area of the page containing ink markings that extend beyond the final trim area, ensuring there are no white edges when the document is trimmed.artbox
: Another optional box, which defines the area intended for the graphical representation of the page.Each of these box types fulfills a specific function in the process of page creation and output. Depending on the specific requirements of the project, some or all of these box types may be utilized.
{
"pages": [
{
"pageNumber": 1,
"pageLabel": "string",
"boxes": {
"mediabox": {
"size": "0 0 35mm 25mm"
},
"TrimBox": {
"size": "2.5mm 2.5mm 30mm 20mm"
}
}
}
]
}
The first two values of the size property define the position (x- and y-coordinate axis) between the origin and the left bottom corner of the box. The third and fourth value define the width and height of the box. The unit can either be defined directly after the values or the global unit of the head information will be used.
The property pageNumber is optionally and pageLabel allows to define a PDF page label.
Attention: |
---|
Due to technical reasons pdfChip always creates a PDF with a cropbox sized as the mediabox. It's recommanded to not work with the mediabox. |
This collection contains marks that define layer properties. For each mark of the marks collection a layer can be defined by setting the property "ocRefId" to the layers "id" (e.g.: "OCG1"). Therefore it's possible to place marks on certain layers and to hide/show those by the property "layerVisibility".
property | value | description |
---|---|---|
id | [string] | (reqired) set a unique id to be used in marks |
layerName | [string] | (required) set a unique name |
layerDisplayName | [string] | (optional) set a display name |
layerVisibility | on | off | (optional) set the visibility of the OCG |
processingStepGroup | Structural, Dimensions, Braille, Legend, Positions, White, Varnish |
(optional) |
processingStepType | Cutting*, PartialCutting*, ReversePartialCutting*, Creasing*, ReverseCreasing*, CuttingCreasing*, ReverseCuttingCreasing*, PartialCuttingCreasing*, ReversePartialCuttingCreasing*, Drilling*, Gluing*, FoilStamping*, ColdFoilStamping*, Embossing*, Debossing*, Perforating*, Bleed*, VarnishFree*, InkFree*, InkVarnishFree*, Folding*, Punching*, Stapling*, Hologram, Barcode, ContentArea, CodingMarking, Imprinting |
(optional) Each processingStepType belongs to a processingStepGroup. Only the processingStepGroup structural and positions have defined processingStepTyps. All other processingStepGroups use the rendered result of the PDF graphics objects. |
* processingStepGroup: structural, the other properties used with positions
example:
{
"optionalContentGroups": [
{
"id": "OCG1",
"layerName": "right-pdf",
"layerDisplayName": "Right Side layer",
"layerVisibility": "on",
"processingStepGroup": "Structural",
"processingStepType": "Cutting"
},
{
"id": "OCG2",
"layerName": "left-pdf",
"layerDisplayName": "Left Side layer",
"layerVisibility": "off",
"processingStepGroup": "Structural",
"processingStepType": "Cutting"
},
{
"id": "OCG3",
"layerName": "center-pdf",
"layerDisplayName": "Center Layer",
"layerVisibility": "off",
"processingStepGroup": "Structural",
"processingStepType": "Cutting"
}
]
}
This collection contains marks that can be referred in the marks collection. The reference is made by defining a mark with type "refMark" and a refId, which value equals the id of the refMark. If the same mark should be placed multiple times this collection can be used to define the static part (size, source, etc.) of the mark.
{
"refMarks": [
{
"id": "ref_barcode",
"type": "barcode",
"data": "12345678",
"size": "10 10",
"barcodeType": "Code 39",
"style": {
"line": {
"colorSpace": "rgb",
"colorValue": "0 0 1",
"thickness": "0.25pt"
},
"specials": {
"barwithreduction": "10%"
}
}
}
]
}
All marks that should be placed on the PDF must be defined in the marks collection.
{
"id": "line001",
"type": "line",
"anchor": "TopLeft",
"size": "25mm 0",
"offset": "20 10mm",
"pageRange": "all",
"refAnchor": "BottomLeft",
"refBox": "TrimBox",
"underlay": false,
"ocRefId": "",
"refId": "",
"opacity": "0.5",
"unit": "mm"
}
property | value | description |
---|---|---|
id | [string] | must be unique |
type | line rect roundrect simpleText text img barcode svg group refMark |
line| draw a line rect| draw a rectangle roundrect| draw a rectangle with rounded edges simpleText| insert a text text| insert a text without linebreaks pdf| insert a pdf img| insert an image (svg, png, tiff, etc.) barcode| insert a auto-generated barcode, or QR-Code svg| insert an svg element group| group of multiple marks refMark| insert a defined existing mark from refMarks |
anchor | TopLeft, TopCenter, TopRight, CenterLeft, Center, CenterLeft, BottomLeft, BottomCenter, BottomLeft | adds the anchor of the mark |
size | Supports JSONATA-calculations. example: $JSONATA{TrimBox.width}+3mm*2 $JSONATA{TrimBox.height}-7pt |
define the size of the mark. the first value defines the width and the second value defines the height. |
offset | [number] | set the offset If the object is on a border, the offset moves the object to the center of the pdf. With a positif offset the object moves always to the center. the first value defines the x-axis (horizontal) and the second the y-axis (vertical) |
pageRange | [int], "all", "even", "odd" | defines the pages on which the mark should place. you can set more than one page. the ", (comma)" seperates the numbers |
refAnchor | TopLeft, TopCenter, TopRight, CenterLeft, Center, CenterLeft, BottomLeft, BottomCenter, BottomLeft | set the reference position of the pdf |
refBox | mediaBox,cropBox,TrimBox,bleedBox,artBox | reffered page box to calculate the position from |
underlay | [boolean] | |
ocRefId | [string] | Id of the Layer, defined in optionalContentGroups, on which the mark should be placed |
refId | [string] | Id of the refMArk of which the mark should be placed |
opacity | [string] | set the opacity of the mark possible values are float numbers cast to string from 0 to 1 |
unit | mm | pt | px | in | global unit, used for all undefined variables The 'unit' property can be redefined at each marker and inherits this property down to the lower levels. |
In order to define a color, the colorSpace and colorValue must be defined.
property | value | description |
---|---|---|
colorName | [string] | this is required, if the color is a spotcolor |
colorSpace | cmyk, rgb, lab, gray | define the color space |
colorValue | Depends on the colorSpace . Check the examples below for detailed information |
defines the color values |
overprint | [boolean] | |
tint | [float] 0-1.0 |
{
"colorSpace": "cmyk",
"colorValue": "0 1 0 0",
"tint": 0.8
}
If the colorSpace
is "rgb", the colorValue
defines the percentage (1.0 = 100%) of separations (red, green, blue) which define the color.
{
"colorSpace": "rgb",
"colorValue": "0 0.5 0.5"
}
If the colorSpace
is "lab" the colorValue
must have three values. (brightness = 0-100 / green-red-axis = (-128)-127 / blue-yellow-axis = (-128)-127
{
"colorSpace": "lab",
"colorValue": "100 -128 127"
}
If the colorSpace
is "gray", the colorValue
defines the shade of grey. (0 = black | 1.0 = white)
{
"colorName": "Stanze",
"colorSpace": "cmyk",
"colorValue": "0 1 0 0",
"tint": 0.8
}
The color is defined as spot color when a colorName
is defined. The colorSpace
and colorValue
define the alternative color.
In addition a spot color name and a tint must be defined.
{
"colorName": "Stanze",
"colorSpace": "cmyk",
"colorValue": "0 1 0 0",
"tint": 0.8
}
A DeviceN color must be defined in the global style.deviceN
array. The DeviceN object needs a deviceNName
and each channel of the color must be defined in the components
array.
The color can then be referred in any mark by defining the deviceNName
as colorName
and the value of each channel in colorValue
. This means if the DeviceN color has 5 channels, then the colorValue
must have 5 space separated values.
{
"marks": [
{
"colorSpace": "devicen",
"colorName": "pittiplatsch-green",
"colorValue": "1.0 0.2 0.1 0.28 0.02"
}
],
"style": {
"deviceN": [
{
"deviceNName": "pittiplatsch-green",
"components": [
{
"colorName": "Cyan",
"colorSpace": "cmyk",
"colorValue": "1 0 0 0"
},
{
"colorName": "Pink",
"colorSpace": "cmyk",
"colorValue": "0 1 0 0"
},
{
"colorName": "Yellow",
"colorSpace": "cmyk",
"colorValue": "0 0 1 1"
},
{
"colorName": "Lila",
"colorSpace": "cmyk",
"colorValue": "0 0 0 1"
},
{
"colorName": "Green",
"colorSpace": "cmyk",
"colorValue": "0.0 0.5 0.5 0.2"
}
]
}
]
}
}
The style object is a property of a certain mark object and defines the look.
There are multiple options depending on the type of the mark.
The fill-property, fills the mark-box with the defined color.
Breaking change: "fill" in text-marks are not the textcolor!
required: colorSpace
, colorValue
{
"style": {
"fill": {
"colorSpace": "cmyk",
"colorValue": "0.2 0.8 0.2 0",
"overprint": false,
"tint": 1
}
}
}
The line-property styles the line in the marks.
property | value | description |
---|---|---|
color | see 2.5.2.1 | |
thickness | [string] | defines the width of the line |
dashed | [boolean] | defines the type of the line |
required: colorSpace
, colorValue
, thickness
{
"style": {
"line": {
"colorName": "Stanze",
"colorType": "cmyk",
"colorValue": "0 1 1 0",
"overprint": true,
"thickness": "5pt",
"dashed": true
}
}
}
The text-property styles the text off the mark. and are required!
property | value | description |
---|---|---|
color | see colors | |
hyphens | auto, manuel, none | auto | set the linebreak automatically (depending on the language (lang) manuel | you can force a break with "&hyphens;" If a linebreake should be optional, depending on the space you can work with none | no hyphenation |
family | Helvetica, Arial, Geneva, sans-serif | set the font family |
source | [.tff-file] | load font from local storage (file format .tff) |
style | normal,italic,oblique,inherit | set the styles on your font |
variant | normal, smal-caps,inherit | in some font-families there a some known variants which can be choosen |
size | [string] | set the font size |
lineHeight | [string] | define the vertical gab to your multiline text |
weight | light,normal,bold,bolder,100,200,...800,900, inherit | set the weight (bold) of the font |
overflow | visible, hidden, auto | the text have a defined space. If the text is to long for this space, and overflow is set on "hidden" the text dissapears out of the space |
align | left,right,center | set the text-block anchor on the defined side |
lang | EN-GB, EN-US, DE, ES, FR, IT | set the language of the text (nessesary for hyphens) |
required: colorSpace
, colorValue
, size
{
"style": {
"text": {
"colorName": "FontName",
"colorType": "cmyk",
"colorValue": "0 0 0 1",
"overprint": false,
"family": "Helvetica, Arial, Geneva, sans-serif",
"lineHeight": "5",
"size": "10pt",
"style": "normal",
"variant": "normal",
"weight": "normal",
"align": "left"
}
}
}
Allows you to use own fonts.
fontFamily
defines the name with which the font can be referenced in a mark by the style.text.family
property.
src
can either be a remote or a file path to a font. If it's a file path the absolut path must be defined as follows:
Mac OS:
"src": "url('file:///tmp/font/arvo/Arvo-Bold.ttf')"
Windows:
"src": "url('file:///C:/tmp/font/arvo/Arvo-Bold.ttf')"
Example:
{
"style": {
"fonts": [
{
"fontFamily": "myFont",
"src": "url('data/font/arvo/Arvo-Bold.ttf')"
}
]
},
"marks": [
{
"type": "text",
...
"style": {
"text": {
...
"family": "myFont"
}
}
}
]
}
Look at DeviceN | Multi-Channel Spot Colors
At the moment the following types of marks are supported:
"type":
"line"
For this type one value of the size object must be 0 and the other one defines the length of the line. Therefore if the first value is 0, a vertical line, else a horizontal line will be place.
If "underlay = true" a white object, which is a little bit bigger as the created one, will be placed under the object.
[
{
"id": "hline_1",
"type": "line",
"refBox": "TrimBox",
"refAnchor": "TopCenter",
"anchor": "Center",
"offset": "-20 50",
"pageRange": "1",
"size": "10 0",
"style": {
"line": {
"colorName": "red",
"colorSpace": "rgb",
"colorValue": "1 0 0",
"overprint": true,
"thickness": "3pt"
}
}
},
{
"id": "vline_1",
"type": "line",
"refBox": "TrimBox",
"refAnchor": "TopCenter",
"anchor": "Center",
"offset": "20 50",
"pageRange": "1",
"size": "0 10",
"style": {
"line": {
"colorName": "red",
"colorSpace": "rgb",
"colorValue": "1 0 0",
"overprint": true,
"thickness": "3pt"
}
}
}
]
"type":
"circle"
The circle supports different style properties for fill (style.fill) and line (style.line). If no style.fill
is defined, the rectangle will be transparent.
example:
{
"id": "circle_1",
"type": "circle",
"refBox": "TrimBox",
"refAnchor": "Center",
"anchor": "Center",
"offset": "0 0",
"pageRange": "1",
"size": "10 10",
"style": {
"line": {
"colorName": "red",
"colorSpace": "rgb",
"colorValue": "1 0 0",
"overprint": true,
"thickness": "1pt"
}
}
}
"type":
"rect"
The rectangle supports different style properties for fill (style.fill) and line (style.line).
If no style.fill is defined, the rectangle will be transparent.
example:
{
"id": "rectangle_1",
"type": "rect",
"refBox": "TrimBox",
"refAnchor": "TopCenter",
"anchor": "Center",
"offset": "-20 80",
"pageRange": "1",
"size": "10 10",
"style": {
"line": {
"colorName": "red",
"colorSpace": "rgb",
"colorValue": "1 0 0",
"overprint": true,
"thickness": "1pt"
}
}
}
"type":
"roundRect"
A special form of rectangle is the rectangle with rounded corners.
Additional property: radius
{
"id": "round_rectangle_1",
"type": "roundRect",
"refBox": "TrimBox",
"refAnchor": "TopCenter",
"anchor": "Center",
"offset": "40 80",
"pageRange": "1",
"size": "10 10",
"radius": "10",
"style": {
"line": {
"colorName": "red",
"colorSpace": "rgb",
"colorValue": "1 0 0",
"overprint": true,
"thickness": "1pt"
},
"fill": {
"colorSpace": "gray",
"colorValue": "0.5",
"overprint": false,
"tint": 1
}
}
}
"type":
"rectChamfer"
A second special form of rectangle is a rectangle with chamfer.
Additional property: chamfer
{
"id": "chamfer_rectangle_1",
"type": "rectChamfer",
"refBox": "TrimBox",
"refAnchor": "TopCenter",
"anchor": "Center",
"offset": "-40 80",
"pageRange": "1",
"size": "10 10",
"chamfer": "3",
"style": {
"line": {
"colorName": "red",
"colorSpace": "rgb",
"colorValue": "1 0 0",
"overprint": true,
"thickness": "1pt"
},
"fill": {
"colorSpace": "gray",
"colorValue": "0.5",
"overprint": false,
"tint": 1
}
}
}
"type":
"pdf"
We recommand to use the pdfV2 mark.
"size":
Dimension of the box into which the PDF will be placed. In order to place the PDF 1:1, size must have the dimensions of the used box plus the defined bleed. If the PDF should be scaled the size object must be adapted to reach the scaling factor.
boxSize:
Final size of the box, exluded bleed
boxOverFlow:
Controls if the content, that stands out the size box should be hidden or visible - (hidden|visible)
matrix:
Transformation matrix: http://angrytools.com/css-generator/transform/ - if defined scaling, mirroring and rotation will be ignored
source:
The path is relative to PCA if it does not start with "/". In the case of Windows the path must look like: file:///<disk drive>:/<path to folder>/<name of file>
.
rotate:
The PDF will be placed into the boxSize and rotated afterwards. The boxSize will not be rotated.
The following properties can either be defined in the source URL of the pdf or as additional property:
example: "source": "/Volumes/kwaltz/repositories/pca/test/200x300mm.pdf#page=1&box=trim&boxadj=2mm, 2mm, 2mm, 2mm"
example:
{
"id": "pdf1",
"type": "pdf",
"refBox": "TrimBox",
"refAnchor": "BottomCenter",
"anchor": "BottomCenter",
"offset": "0 10",
"pageRange": "2",
"boxSize": "150 90",
"boxOverflow": "hidden",
"page": 1,
"contentBox": "TrimBox",
"size": "210 297",
"source": "/Users/Shared/DEV/pca/SPORTLehrbuch.pdf",
"bleed": "2",
"rotate": 0,
BETA: "matrix": [1 0 0 0 1 0],
BETA: "mirror": none|horizontal|vertical|horizontalvertical,
"contentOffset": "0 10",
"valign": "left",
"style": {
"line": {
"colorName": "red",
"colorSpace": "rgb",
"colorValue": "1 0 0",
"overprint": true,
"thickness": "1pt"
}
}
}
"type":
"pdfV2"
This mark makes positioning of PDFs even easier. Also use this if the size of the placed PDF is not known or when it is required to honor bleed.
{
"anchor": "Center",
"offset": "0 0",
"pageRange": "all",
"refAnchor": "Center",
"refBox": "trimbox",
"rotate": 0,
"size": "auto auto",
"source": "/Documentation/Examples/place PDF mark/work/A4_template.pdf",
"pdfRefBox": "trimbox",
"pdfSize": "auto auto",
"pdfAnchor": "topCenter",
"pdfRefAnchor": "topCenter",
"pdfOffset": "0 0",
"pdfPage": 1,
"type": "pdfV2",
"bleed": "0",
"scalingMethod": "fill",
"rotationAnchor": "center",
"mirror": "none"
}
rotate
allows to define the rotation angle. A rotation of 90 rotates the content 90 degree counter clockwise.
rotationAnchor
allows to define all possible anchor positions. Rotation gets applied after scaling and mirroring and refers to the placed PDF without bleed. Hence the rotation anchor has an offset if bleed is defined vor any adjacent edge.
size: "210mm 297mm"
size: "auto 297mm"
size: "auto auto"
size
defines a box in width and height that is used the place the PDF, possibly clipped, into. A value of auto can be used if the width or height is defined by the placed PDF and not by the mark itself.
If the size of the clipped PDF differs to the defined size, the PDF gets scaled. Scaling is done either proportionally or unproportionally, depending on the scalingMethod property
If no unit is defined, then the default unit is used.
A value of auto auto means, that the size of the mark is defined by the resolved area based on pdfSize. No scaling is performed
Defines the page box of the placed PDF that shall be used as reference.
This property defines the area that gets clipped from the placed PDF.
"pdfSize": "210mm 297mm"
"pdfSize": "auto auto"
Default: auto auto
pdfSize
defines the image area of the PDFs page that shall get placed. The defined area is in relation to pdfRefBox.
A value of auto gets resolved the the width and/or height of the referenced PDFs page box.
If the marks size has a defined size only one of the pdfSize values is defined using auto, then the proportions of the size defined by size will be used to resolve the respective value.
Example:
PDF to be placed: A3 landscape
"size": "210 auto",
"pdfSize": "auto 10"
Result: the PDFs image area will get scaled from 420mm to 10mm and the original 10mm in height (clipped) will become 5mm in the final output
If both properties size and pdfSize have a value of auto auto then the PDF gets placed in 100%. No scaling is performed.
If the the mark has defined values for the dimension and the aspect ration of the PDFs image area differ from the aspect ration of the mark, then the PDFs image area gets scaled into the dimension defined ba the marks size.
possible values:
fill
- scale the PDF into the give size, resulting in unproportional scaling if ratio differs
proportional
- the PDF gets scaled proportionally so it fits inside the defined size, possibly leaving a white space if the ratio differs
proportionalFill
- the PDF gets scaled proportionally so it completely fills the defined size, possibly requiring more space in one dimension defined by size. This part will only be shown if overflow : visible; - not yet implemented
Default: proportional
Defines which page of the PDF shall get placed.
Default: 0
A value of 0 defines the following:
If the source PDF and the placed PDF has multiple pages (also when limited by a pageRange), then the pages to be placed are used in a sequential order. If there are no more pages in the PDF to be placed, then a new loop starts at page 1 again.
The first page being placed is always the page 1, except a specific pdfPage is defined
Info: If a specific pdfPage is defined, this page is placed on any page, defined inpagerange, of the generated PDF.
Defines the anchor of the image area defined by pdfSize
.
Same as values as anchor
Defines the anchor of the PDFs page box defined by pdfRefBox
.
Same as values as anchor
Defines the offset in x and y of the anchors pdfAnchor
relative to pdfRefAnchor
. A positive value moves the image area towards the center of the placed PDF.
basically positive values always move right and up with the following exception: if pdfRefBox is using any of
- right - positive values move left
- top - positive values move down
1 or 4 words, defining the bleeds width for all 4 edged
If 4 values are defined, then the define the bleed for each of the four edges. The sequence is then
“<leftEdge> <bottomEdge> <rightEdge> <topEdge>”
Otherwise, the defined width applies to all edges.
Examples
bleed: "3mm"
bleed: "3mm 10mm 3mm 3mm"
The bleed extends the box defined by pdfSize at each edge. However, pdfAnchor and pdfRefAnchor are to be considered without any added bleed.
The bleed width and position is considered based on the PDFs image area at 100%. Scaling and mirroring will effect the position and width of the final bleed.
Mirrors the visible area inside the defined pdfSize
rectangle.
"type":
"img"
The images will be placed like the PDF, but without a contentBox and a boxSize. It's also possible to use an external SVG and reference it under source
.
{
"id": "img1",
"type": "img",
"refBox": "TrimBox",
"refAnchor": "Center",
"anchor": "Center",
"offset": "0 0",
"pageRange": "1",
"size": "30 30",
"source": "/Users/Shared/DEV/pca/Download.png"
}
"type":
"barcode"
If the barcode should be placed without text, the style.text element must not be defined. The barcode will get higher.
"barcodeTypes":
https://help.callassoftware.com/m/pdfchip/l/655298-list-of-supported-barcodes-and-matrix-codes
additional properties:
https://hilfe.callassoftware.com/m/pdfchip/l/649874-using-pdfchip-to-add-barcodes-and-matrix-codes
example:
{
"id": "code1",
"type": "barcode",
"data": "12345678",
"size": "30 10",
"barcodeType": "Code 39",
"refBox": "TrimBox",
"refAnchor": "Center",
"anchor": "Center",
"offset": "0 -30",
"pageRange": "1",
"style": {
"line": {
"colorSpace": "rgb",
"colorValue": "0 0 0",
"overprint": true,
"thickness": "1pt"
},
"fill": {
"colorSpace": "gray",
"colorValue": "0.5",
"overprint": false,
"tint": 1
},
"specials": {
"barwithreduction": "10%"
}
}
}
"type":
"simpleText"
In line or multi line text without automatically line wrapping or justification.
"linebreak":
"text":
example:
{
"id": "simpletext1",
"type": "simpleText",
"refBox": "TrimBox",
"refAnchor": "Center",
"anchor": "Center",
"offset": "0 -60",
"pageRange": "1",
"size": "50 30",
"text": "Labore cillum \n irure dolore pariatur \n nisi sint sunt exercitation \n in irure sit enim est in.",
"lineBreak": "",
"style": {
"line": {
"colorName": "red",
"colorSpace": "rgb",
"colorValue": "1 0 0",
"overprint": true,
"thickness": "1pt"
},
"fill": {
"colorSpace": "rgb",
"colorValue": "0 1 0",
"overprint": false,
"tint": 1
},
"text": {
"colorSpace": "rgb",
"colorValue": "0 0 1",
"align": "center",
"family": "Arial",
"size": "10pt",
"weight": 600,
"hyphens": "auto",
"lang": "en",
"lineHeight": "5"
}
}
}
"type":
"text"
Only works trustfully if the text is aligned from the upper right or upper left corner.
The text color of this object is directly defined in the style.text
object.
style.fill
and style.color
define the color of the text box.
example:
{
"id": "textMark",
"type": "text",
"text": "sample text",
"anchor": "TopLeft",
"offset": "0 0",
"refAnchor": "BottomLeft",
"hAllign": "Top",
"pageRange": "all",
"refBox": "TrimBox",
"underlay": false,
"vAllign": "top",
"style": {
"text": {
"align": "left",
"colorSpace": "cmyk",
"colorValue": "0 0 0 1",
"family": "Helvetica, Arial, Geneva, sans-serif",
"hyphenation": false,
"overflow": "hidden",
"style": "normal",
"size": "10pt",
"lineHeight": "120%",
"overprint": false,
"tint": 1,
"variant": "normal",
"weight": "normal"
}
}
}
If style.text.size
is set to auto
, the text size is dynamically calculated so that it fits into the defined box size of the mark.
example size=auto:
{
"id": "textMark",
"type": "text",
"text": "sample text",
"anchor": "TopLeft",
"offset": "0 0",
"size": "100 30",
"refAnchor": "BottomLeft",
"hAllign": "Top",
"pageRange": "all",
"refBox": "TrimBox",
"underlay": false,
"vAllign": "top",
"style": {
"text": {
"align": "left",
"colorSpace": "cmyk",
"colorValue": "0 0 0 1",
"family": "Helvetica, Arial, Geneva, sans-serif",
"hyphenation": false,
"overflow": "hidden",
"style": "normal",
"size": "auto",
"overprint": false,
"tint": 1,
"variant": "normal",
"weight": "normal"
}
}
}
"type":
"svg"
Svg-marks can either be defined as img or directly as svg inline without the need of an external file reference.
{
"boxOverflow": "hidden",
"boxSize": "7 7",
"id": "G2",
"rotate": 0,
"size": "7 7",
"inlineContent": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 100 100\" width=\"100\" height=\"100\" fill=\"none\" stroke=\"black\" stroke-width=\"10\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"50\" cy=\"50\" r=\"40\"/><path d=\"M50 25V50 H75\" /></svg>",
"type": "svg"
}
"type":
"group"
This type is useful if there are multiple elements that should be placed inside a group. The whole group can then be placed on the final PDF without the need of calculating the offset of each element.
A group is a rectangle to which the marks of the collection "subMarks" are referred to.
In addition it is possible to place elements depending on the previous element by setting the "mode" to adjacent. The offset of the group object defines the distance between those elements.
{
"lang": "en",
"pageCount": 1,
"pages": [
{
"pageNumber": 0,
"pageLabel": null,
"boxes": {
"mediabox": {
"size": "0 0 420 210"
},
"cropbox": {
"size": "0 0 420 210"
},
"TrimBox": {
"size": "0 0 420 210"
}
}
}
],
"marks": [
{
"type": "group",
"id": "crossmark",
"size": "auto",
"offset": "0 10",
"pageRange": "all",
"anchor": "BottomCenter",
"refAnchor": "BottomCenter",
"refBox": "TrimBox",
"underlay": false,
"mode": "adjacent",
"style": {
"line": {
"thickness": "3pt",
"colorSpace": "cmyk",
"colorValue": "0.2 0.5 0 0.2",
"overprint": true
}
},
"subMarks": [
{
"id": "rect001",
"type": "rect",
"anchor": "BottomLeft",
"offset": "0 0",
"pageRange": "all",
"refAnchor": "BottomLeft",
"size": "20 20",
"style": {
"line": {
"colorName": "Stanze",
"colorType": "cmyk",
"colorValue": "0 1 1 0",
"overprint": true,
"thickness": "0.5pt"
}
}
},
{
"id": "line001",
"type": "line",
"anchor": "BottomLeft",
"size": "25 0",
"offset": "2 1",
"pageRange": "all",
"refAnchor": "BottomLeft",
"underlay": false,
"scale": 1,
"style": {
"line": {
"thickness": "3pt",
"colorSpace": "cmyk",
"colorValue": "0.2 0.5 0 0.2",
"overprint": true,
"dashed": true
}
}
},
{
"type": "simpleText",
"anchor": "BottomLeft",
"refAnchor": "BottomLeft",
"offset": "2 0",
"text": "AdjacentMarks",
"lineBreak": "",
"rotate": 0,
"style": {
"text": {
"align": "right",
"family": "Arial",
"size": "10pt"
},
"fill": {
"colorSpace": "cmyk",
"colorValue": "1 0 1 0",
"overprint": true,
"tint": 1
}
}
},
{
"type": "barcode",
"data": "123456780",
"pageRange": "all",
"anchor": "BottomLeft",
"refAnchor": "BottomLeft",
"barcodeType": "Code 39",
"offset": "2 0",
"size": "23 7",
"style": {
"fill": {
"colorSpace": "cmyk",
"colorValue": "0.0 0.0 0 0.0"
},
"line": {
"colorSpace": "cmyk",
"colorValue": "0.0 0.0 0.0 1.0"
},
"specials": {
"barwidthreduction": "10%"
},
"text": {
"family": "myFont",
"size": "6pt",
"colorSpace": "cmyk",
"colorValue": "0 0 0 1"
}
}
},
{
"id": "textMark",
"type": "text",
"text": "Calibrate",
"anchor": "BottomLeft",
"offset": "2 0",
"refAnchor": "BottomLeft",
"hAllign": "Top",
"pageRange": "all",
"underlay": false,
"vAllign": "top",
"style": {
"text": {
"align": "left",
"colorSpace": "cmyk",
"colorValue": "0 1 1 0",
"family": "Helvetica, Arial, Geneva, sans-serif",
"hyphenation": false,
"overflow": "hidden",
"style": "normal",
"size": "10pt",
"lineHeight": "120%",
"overprint": false,
"tint": 1,
"variant": "normal",
"weight": "normal"
}
}
},
{
"anchor": "BottomLeft",
"boxOverflow": "hidden",
"boxSize": "10 10",
"id": "slot_0_1",
"offset": "1 0",
"pageRange": "all",
"refAnchor": "BottomLeft",
"rotate": 0,
"size": "10 10",
"inlineContent": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 100 100\" width=\"100\" height=\"100\" fill=\"none\" stroke=\"black\" stroke-width=\"10\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"50\" cy=\"50\" r=\"40\"/><path d=\"M50 25V50 H75\" /></svg>",
"type": "svg"
},
{
"type": "img",
"pageRange": "all",
"source": "/D:/wamp64/www/callas-pdfChip/images/Earth.jpg",
"size": "15 15",
"refAnchor": "BottomLeft",
"anchor": "BottomLeft",
"offset": "2 0"
},
{
"anchor": "BottomLeft",
"boxOverflow": "hidden",
"boxSize": "10 25",
"id": "slot_0_0",
"offset": "2 0",
"pageRange": "all",
"refAnchor": "BottomLeft",
"rotate": 0,
"size": "10 25",
"source": "/D:/wamp64/www/callas-pdfChip/images/test.pdf",
"type": "pdf",
"bleed": "0"
}
]
}
],
"unit": "mm"
}
"type":
"refMark"
Objects of the type "refMark" contain information about the position and a reference (refId) to the refMark containing other information such as "source" or the "size" of the mark. This is useful if the same marks should be placed on different positions.
[
{
"type": "refMark",
"id": "crossmark_1",
"refId": "G1",
"offset": "20mm 10mm",
"pageRange": "all",
"refAnchor": "BottomLeft",
"refBox": "TrimBox",
"anchor": "BottomLeft",
"underlay": false
},
{
"type": "refMark",
"id": "crossmark_2",
"refId": "G1",
"offset": "20mm 10mm",
"pageRange": "all",
"refAnchor": "TopRight",
"refBox": "TrimBox",
"anchor": "TopRight",
"underlay": false
}
]
Variables could use for the properties size, offset and data (text-values/barcode)
There are two options implement variables in pca
In JSON you cann add
${pdfToolbox.document.name}
${pdfToolbox.pages[0].userunit}
${pdfToolbox.variable.<varname>}
The variables are defined in the calsDocInfo.js
Example:
JSON-file:
{
"pageCount": 1,
"pages": [
{
"pageNumber": 0,
"pageLabel": "cover",
"boxes": {
"mediabox": {
"size": "0 0 1296pt 864pt"
},
"TrimBox": {
"size": "431.575pt 178.016pt 770.882pt 592.441pt"
},
"bleedbox": {
"size": "421.575pt 168.016pt 790.882pt 612.441pt"
}
}
}
],
"lang": "en",
"marks": [
{
"id": "spine_fold_left_bottom",
"type": "line",
"anchor": "BottomCenter",
"size": "0 -8mm",
"refAnchor": "bottomleft",
"offset": "${pdfToolbox.variable.VAR_Cover_width}-${pdfToolbox.variable.VAR_Fold_width} -16mm",
"pageRange": "all",
"style": {
"line": {
"dashed": true
}
}
},
{
"id": "spine_fold_right_bottom",
"type": "line",
"anchor": "BottomCenter",
"size": "0 -8mm",
"refAnchor": "bottomright",
"offset": "${pdfToolbox.variable.VAR_Cover_width}-${pdfToolbox.variable.VAR_Fold_width} -16mm",
"pageRange": "all",
"style": {
"line": {
"dashed": true
}
}
}
]
}
calsDocInfo-file
'variables':
[{'name': 'VAR_Cover_width', 'value':"131.95mm"},
{'name': 'VAR_Fold_width', 'value':"13mm"},
{'name': 'pcData', 'value': ...}]
The second option is to use pdfChip and import a JSON-File as an opject.
cli-parameter
import=import:./variables.json
The name of the import object must be import !
variables.json
{
"vars": {
"VAR_Cover_width": "131.95mm",
"VAR_Fold_width": "13mm"
}
}
Include variables in JSON-file:
JSON-file:
{
"pageCount": 1,
"pages": [
{
"pageNumber": 0,
"pageLabel": "cover",
"boxes": {
"mediabox": {
"size": "0 0 1296pt 864pt"
},
"TrimBox": {
"size": "431.575pt 178.016pt 770.882pt 592.441pt"
},
"bleedbox": {
"size": "421.575pt 168.016pt 790.882pt 612.441pt"
}
}
}
],
"lang": "en",
"marks": [
{
"id": "spine_fold_left_bottom",
"type": "line",
"anchor": "BottomCenter",
"size": "0 -8mm",
"refAnchor": "bottomleft",
"offset": "${import.vars.VAR_Cover_width}-${import.vars.VAR_Fold_width} -16mm",
"pageRange": "all",
"style": {
"line": {
"dashed": true
}
}
},
{
"id": "spine_fold_right_bottom",
"type": "line",
"anchor": "BottomCenter",
"size": "0 -8mm",
"refAnchor": "bottomright",
"offset": "${import.vars.VAR_Cover_width}-${import.vars.VAR_Fold_width} -16mm",
"pageRange": "all",
"style": {
"line": {
"dashed": true
}
}
}
]
}
{
"lang": "en",
"pageCount": 15,
"unit": "mm",
"pages": [
{
"pageNumber": 1,
"pageLabel": "cover",
"boxes": {
"mediabox": {
"size": "0 0 210 297"
},
"TrimBox": {
"size": "10 10 190 277"
}
}
},
{
"pageNumber": 2,
"pageLabel": "toc",
"boxes": {
"mediabox": {
"size": "0 0 210 297"
},
"TrimBox": {
"size": "10 10 190 277"
}
}
},
{
"pageNumber": 3,
"pageLabel": "mid",
"boxes": {
"mediabox": {
"size": "0 0 210 297"
},
"TrimBox": {
"size": "10 10 190 277"
}
}
},
{
"pageNumber": 4,
"pageLabel": null,
"boxes": {
"mediabox": {
"size": "0 0 210 297"
},
"TrimBox": {
"size": "10 10 190 277"
}
}
},
{
"pageNumber": 5,
"pageLabel": null,
"boxes": {
"mediabox": {
"size": "0 0 210 297"
},
"TrimBox": {
"size": "10 10 190 277"
}
}
},
{
"pageNumber": 6,
"pageLabel": null,
"boxes": {
"mediabox": {
"size": "0 0 210 297"
},
"TrimBox": {
"size": "10 10 190 277"
}
}
},
{
"pageNumber": 7,
"pageLabel": null,
"boxes": {
"mediabox": {
"size": "0 0 210 297"
},
"TrimBox": {
"size": "10 10 190 277"
}
}
},
{
"pageNumber": 8,
"pageLabel": null,
"boxes": {
"mediabox": {
"size": "0 0 210 297"
},
"TrimBox": {
"size": "10 10 190 277"
}
}
},
{
"pageNumber": 9,
"pageLabel": null,
"boxes": {
"mediabox": {
"size": "0 0 210 297"
},
"TrimBox": {
"size": "10 10 190 277"
}
}
},
{
"pageNumber": 10,
"pageLabel": null,
"boxes": {
"mediabox": {
"size": "0 0 210 297"
},
"TrimBox": {
"size": "10 10 190 277"
}
}
},
{
"pageNumber": 11,
"pageLabel": null,
"boxes": {
"mediabox": {
"size": "0 0 210 297"
},
"TrimBox": {
"size": "10 10 190 277"
}
}
},
{
"pageNumber": 12,
"pageLabel": null,
"boxes": {
"mediabox": {
"size": "0 0 210 297"
},
"TrimBox": {
"size": "10 10 190 277"
}
}
},
{
"pageNumber": 13,
"pageLabel": null,
"boxes": {
"mediabox": {
"size": "0 0 210 297"
},
"TrimBox": {
"size": "10 10 190 277"
}
}
},
{
"pageNumber": 14,
"pageLabel": "landscape",
"boxes": {
"mediabox": {
"size": "0 0 297 210"
},
"TrimBox": {
"size": "10 10 277 190"
}
}
},
{
"pageNumber": 15,
"pageLabel": "end",
"boxes": {
"mediabox": {
"size": "0 0 210 297"
},
"TrimBox": {
"size": "10 10 190 277"
}
}
}
],
"optionalContentGroups": [
{
"id": "OCG_txt",
"layerName": "TextLayer",
"layerDisplayName": "All text Layer",
"layerVisibility": "on",
"processingStepGroup": "Structural",
"processingStepType": "Cutting"
},
{
"id": "OCG_pdf",
"layerName": "pdfLayer",
"layerDisplayName": "All pdf Layer",
"layerVisibility": "on",
"processingStepGroup": "Structural",
"processingStepType": "Cutting"
},
{
"id": "OCG_form",
"layerName": "formLayer",
"layerDisplayName": "All form Layer",
"layerVisibility": "on",
"processingStepGroup": "Structural",
"processingStepType": "Cutting"
},
{
"id": "OCG_code",
"layerName": "codeLayer",
"layerDisplayName": "All code Layer",
"layerVisibility": "on",
"processingStepGroup": "Structural",
"processingStepType": "Cutting"
}
],
"refMarks": [
{
"id": "ref_barcode",
"type": "barcode",
"data": "12345678",
"size": "10 10",
"barcodeType": "Code 39",
"style": {
"line": {
"colorSpace": "rgb",
"colorValue": "0 0 1",
"thickness": "0.25pt"
},
"specials": {
"barwithreduction": "10%"
}
}
}
],
"marks": [
{
"id": "hline",
"ocRefId": "OCG_form",
"type": "line",
"refBox": "TrimBox",
"refAnchor": "TopCenter",
"anchor": "Center",
"offset": "-20 50",
"pageRange": "1",
"size": "10 0",
"style": {
"line": {
"colorName": "red",
"colorSpace": "rgb",
"colorValue": "1 0 0",
"overprint": true,
"thickness": "3pt"
}
}
},
{
"id": "vline",
"ocRefId": "OCG_form",
"type": "line",
"refBox": "TrimBox",
"refAnchor": "TopCenter",
"anchor": "Center",
"offset": "20 50",
"pageRange": "1",
"size": "0 10",
"style": {
"line": {
"colorName": "red",
"colorSpace": "rgb",
"colorValue": "1 0 0",
"overprint": true,
"thickness": "3pt"
}
}
},
{
"id": "rectangle",
"ocRefId": "OCG_form",
"type": "rect",
"refBox": "TrimBox",
"refAnchor": "TopCenter",
"anchor": "Center",
"offset": "-20 80",
"pageRange": "1",
"size": "10 10",
"style": {
"line": {
"colorName": "red",
"colorSpace": "rgb",
"colorValue": "1 0 0",
"overprint": true,
"thickness": "1pt"
}
}
},
{
"id": "fillrectangle",
"ocRefId": "OCG_form",
"type": "rect",
"refBox": "TrimBox",
"refAnchor": "TopCenter",
"anchor": "Center",
"offset": "20 80",
"pageRange": "1",
"size": "10 10",
"style": {
"line": {
"colorName": "red",
"colorSpace": "rgb",
"colorValue": "1 0 0",
"overprint": true,
"thickness": "1pt"
},
"fill": {
"colorSpace": "gray",
"colorValue": "0.5",
"overprint": false,
"tint": 1
}
}
},
{
"id": "roundrectangle",
"ocRefId": "OCG_form",
"type": "roundrect",
"refBox": "TrimBox",
"refAnchor": "TopCenter",
"anchor": "Center",
"offset": "40 80",
"pageRange": "1",
"size": "10 10",
"radius": "10",
"style": {
"line": {
"colorName": "red",
"colorSpace": "rgb",
"colorValue": "1 0 0",
"overprint": true,
"thickness": "1pt"
},
"fill": {
"colorSpace": "gray",
"colorValue": "0.5",
"overprint": false,
"tint": 1
}
}
},
{
"id": "chamferrectangle",
"ocRefId": "OCG_form",
"type": "rectChamfer",
"refBox": "TrimBox",
"refAnchor": "TopCenter",
"anchor": "Center",
"offset": "-40 80",
"pageRange": "1",
"size": "10 10",
"chamfer": "3",
"style": {
"line": {
"colorName": "red",
"colorSpace": "rgb",
"colorValue": "1 0 0",
"overprint": true,
"thickness": "1pt"
},
"fill": {
"colorSpace": "gray",
"colorValue": "0.5",
"overprint": false,
"tint": 1
}
}
},
{
"id": "pdf1",
"ocRefId": "OCG_pfd",
"type": "pdf",
"refBox": "TrimBox",
"refAnchor": "BottomCenter",
"anchor": "BottomCenter",
"offset": "0 10",
"pageRange": "2",
"boxSize": "150 90",
"boxOverflow": "hidden",
"page": 1,
"contentBox": "TrimBox",
"size": "210 297",
"source": "/Users/Shared/DEV/pca/SPORTLehrbuch.pdf",
"bleed": "2",
"rotate": 0,
"contentOffset": "0 10",
"valign": "left",
"style": {
"line": {
"colorName": "red",
"colorSpace": "rgb",
"colorValue": "1 0 0",
"overprint": true,
"thickness": "1pt"
}
}
},
{
"id": "img1",
"ocRefId": "OCG_form",
"type": "img",
"refBox": "TrimBox",
"refAnchor": "Center",
"anchor": "Center",
"offset": "0 0",
"pageRange": "1",
"size": "30 30",
"source": "/Users/Shared/DEV/pca/Download.png"
},
{
"id": "code1",
"ocRefId": "OCG_code",
"type": "barcode",
"data": "12345678",
"size": "30 10",
"barcodeType": "Code 39",
"refBox": "TrimBox",
"refAnchor": "Center",
"anchor": "Center",
"offset": "0 -30",
"pageRange": "1",
"style": {
"line": {
"colorSpace": "rgb",
"colorValue": "0 0 0",
"overprint": true,
"thickness": "1pt"
},
"fill": {
"colorSpace": "gray",
"colorValue": "0.5",
"overprint": false,
"tint": 1
},
"specials": {
"barwithreduction": "10%"
}
}
},
{
"id": "simpletext1",
"ocRefId": "OCG_text",
"type": "simpleText",
"refBox": "TrimBox",
"refAnchor": "Center",
"anchor": "Center",
"offset": "0 -60",
"pageRange": "1",
"size": "50 30",
"text": "Labore cillum \n irure dolore pariatur \n nisi sint sunt exercitation \n in irure sit enim est in.",
"lineBreak": "",
"style": {
"line": {
"colorName": "red",
"colorSpace": "rgb",
"colorValue": "1 0 0",
"overprint": true,
"thickness": "1pt"
},
"fill": {
"colorSpace": "rgb",
"colorValue": "0 1 0",
"overprint": false,
"tint": 1
},
"text": {
"colorSpace": "rgb",
"colorValue": "0 0 1",
"align": "center",
"family": "Arial",
"size": "10pt",
"weight": 600,
"hyphens": "auto",
"lang": "en",
"lineHeight": "5"
}
}
},
{
"id": "pageborder",
"ocRefId": "OCG_form",
"type": "rect",
"refBox": "TrimBox",
"refAnchor": "Center",
"anchor": "Center",
"offset": "0 0",
"pageRange": "all",
"size": "50 50",
"style": {
"line": {
"colorName": "red",
"colorSpace": "rgb",
"colorValue": "1 0 0",
"overprint": true,
"thickness": "1pt"
}
}
},
{
"id": "ref_bc1",
"refId": "ref_barcode",
"type": "refMark",
"refBox": "TrimBox",
"refAnchor": "TopCenter",
"anchor": "TopCenter",
"offset": "0 0",
"pageRange": "all",
"underlay": false
}
]
}