The PDF Reference defines Allor Nonewith the following description:
The special colorant name All refers collectively to all colorants available on an output device, including those for the standard process colorants. When a Separation space with this colorant name is the current color space, painting operators apply tint values to all available colorants at once. This is useful for purposes such as painting registration targets in the same place on every separation. Such marks are typically painted as the last step in composing a page to ensure that they are not overwritten by subsequent painting operations.
The special colorant name None never produces any visible output. Painting operations in a Separation space with this colorant name have no effect on the current page.
The None color would seem to have little purpose, since page objects colored with it will by definition be invisible. However, they have properties that can be exploited. An example of this is to treat them as “template” objects, as a reference to position and/or size new content added to an existing PDF, possibly for VDP applications.
In Mako, these colors can be created as you would any other spot color, and the simplest way to do that is to create a DeviceN color with a single colorant. When Mako writes out a PDF, such a spot color is written as a Separation color.
You still need to define an alternate color space when defining the All or NoneDeviceN colors, but these are unlikely to be used. While it is possible to define an All colorant in grayscale, it would make little sense as its purpose is to paint on all separations, and a grayscale image by definition has only one.
The following example shows these activities in action to produce a single-page PDF with color chips in various colors:
Code example
This example creates this PDF from scratch, making use of the All colorant to show how it is created, and its effect on a rendered page.
C++
CPP
/* -----------------------------------------------------------------------
* <copyright file="MAKOSUP_11198.cpp" company="Global Graphics Software Ltd">
* Copyright (c) 2022-2023 Global Graphics Software Ltd. All rights reserved.
* </copyright>
* <summary>
* This example is provided on an "as is" basis and without warranty of any kind.
* Global Graphics Software Ltd. does not warrant or make any representations
* regarding the use or results of use of this example.
* </summary>
* -----------------------------------------------------------------------
*/
#include <jawsmako/jawsmako.h>
#include <edl/idomcolor.h>
#include <edl/idomcolorspace.h>
#include <jawsmako/pdfoutput.h>
using namespace JawsMako;
using namespace EDL;
// Create a new DeviceN color space with the given name and one colorant
IDOMColorSpaceDeviceNPtr makeNewDeviceNColor(const IJawsMakoPtr& mako, const EDLSysString& spotColorName,
const double& cyan, const double& magenta, const double& yellow,
const double& black, IDOMColorSpacePtr alternateSpace = IDOMColorSpacePtr())
{
// Create a vector of one colorant
IDOMColorSpaceDeviceN::CColorantInfoVect colorants;
colorants.append(IDOMColorSpaceDeviceN::CColorantInfo(spotColorName, 4, cyan, magenta, yellow, black));
// Create the DeviceN space
if (!alternateSpace)
alternateSpace = IDOMColorSpaceDeviceCMYK::create(mako);
IDOMColorSpaceDeviceNPtr deviceN = IDOMColorSpaceDeviceN::create(mako, colorants, alternateSpace);
return deviceN;
}
int main()
{
const auto mako = IJawsMako::create();
mako->enableAllFeatures(mako);
const auto assembly = IDocumentAssembly::create(mako);
const auto document = IDocument::create(mako);
assembly->appendDocument(document);
const auto page = IPage::create(mako);
document->appendPage(page);
const auto fixedPage = IDOMFixedPage::create(mako);
page->setContent(fixedPage);
// Create an 'All' spot color space, a color and a brush to draw with
const auto spotColorSpaceAll = makeNewDeviceNColor(mako, "All", 1.0, 1.0, 1.0, 1.0);
const auto spotColorAll = IDOMColor::create(mako, spotColorSpaceAll, 1.0, 1.0);
const auto all = IDOMSolidColorBrush::create(mako, spotColorAll);
// Create a 'Rot' spot color
const auto spotColorSpaceRot = makeNewDeviceNColor(mako, "Rot", 0.0, 1.0, 1.0, 0.0);
const auto spotColorRot = IDOMColor::create(mako, spotColorSpaceRot, 1.0, 1.0);
const auto rot = IDOMSolidColorBrush::create(mako, spotColorRot);
// Create a 'Blau' spot color
const auto spotColorSpaceBlau = makeNewDeviceNColor(mako, "Blau", 1.0, 1.0, 0.0, 0.0);
const auto spotColorBlau = IDOMColor::create(mako, spotColorSpaceBlau, 1.0, 1.0);
const auto blau = IDOMSolidColorBrush::create(mako, spotColorBlau);
// Create some process color brushes
const auto cyan = IDOMSolidColorBrush::createSolidCmyk(mako, 1.0, 0.0, 0.0, 0.0);
const auto magenta = IDOMSolidColorBrush::createSolidCmyk(mako, 0.0, 1.0, 0.0, 0.0);
const auto yellow = IDOMSolidColorBrush::createSolidCmyk(mako, 0.0, 0.0, 1.0, 0.0);
const auto black = IDOMSolidColorBrush::createSolidCmyk(mako, 0.0, 0.0, 0.0, 1.0);
// Draw some boxes
const auto origin = FPoint(100, 100);
const auto boxSize = FPoint(100, 100);
auto start = origin;
// Draw Cyan box
auto box = FRect(start.x, start.y, boxSize.x, boxSize.y);
fixedPage->appendChild(IDOMPathNode::createFilled(mako, IDOMPathGeometry::create(mako, box), cyan));
start.x += boxSize.x;
// Draw Magenta box
box = FRect(start.x, start.y, boxSize.x, boxSize.y);
fixedPage->appendChild(IDOMPathNode::createFilled(mako, IDOMPathGeometry::create(mako, box), magenta));
start.x += boxSize.x;
// Draw Yellow box
box = FRect(start.x, start.y, boxSize.x, boxSize.y);
fixedPage->appendChild(IDOMPathNode::createFilled(mako, IDOMPathGeometry::create(mako, box), yellow));
start.x += boxSize.x;
// Draw Black box
box = FRect(start.x, start.y, boxSize.x, boxSize.y);
fixedPage->appendChild(IDOMPathNode::createFilled(mako, IDOMPathGeometry::create(mako, box), black));
start.x += boxSize.x;
// Draw Red box
box = FRect(start.x, start.y, boxSize.x, boxSize.y);
fixedPage->appendChild(IDOMPathNode::createFilled(mako, IDOMPathGeometry::create(mako, box), rot));
start.x += boxSize.x;
// Draw Blue box
box = FRect(start.x, start.y, boxSize.x, boxSize.y);
fixedPage->appendChild(IDOMPathNode::createFilled(mako, IDOMPathGeometry::create(mako, box), blau));
// Draw a border in All
const uint32 strokeWidth = 20;
box = FRect(origin.x - strokeWidth / 2.0, origin.y - strokeWidth / 2.0, start.x + strokeWidth, boxSize.y + strokeWidth);
fixedPage->appendChild(IDOMPathNode::createStroked(mako, IDOMPathGeometry::create(mako, box), all, FMatrix(),
IDOMPathGeometryPtr(), strokeWidth));
// Write a PDF
IPDFOutput::create(mako)->writeAssembly(assembly, "test.pdf");
}
C#
C#
/* -----------------------------------------------------------------------
* <copyright file="Program.cs" company="Global Graphics Software Ltd">
* Copyright (c) 2022-2023 Global Graphics Software Ltd. All rights reserved.
* </copyright>
* <summary>
* This example is provided on an "as is" basis and without warranty of any kind.
* Global Graphics Software Ltd. does not warrant or make any representations
* regarding the use or results of use of this example.
* </summary>
* -----------------------------------------------------------------------
*/
using JawsMako;
namespace MAKOSUP_11198_CS
{
class Program
{
static void Main(string[] args)
{
var mako = IJawsMako.create();
IJawsMako.enableAllFeatures(mako);
var assembly = IDocumentAssembly.create(mako);
var document = IDocument.create(mako);
assembly.appendDocument(document);
var page = IPage.create(mako);
document.appendPage(page);
var fixedPage = IDOMFixedPage.create(mako);
page.setContent(fixedPage);
// Create an 'All' spot color space, a color and a brush to draw with
var spotColorSpaceAll = makeNewDeviceNColor(mako, "All", 1.0f, 1.0f, 1.0f, 1.0f);
var spotColorAll = IDOMColor.create(mako, spotColorSpaceAll, 1.0f, 1.0f);
var all = IDOMSolidColorBrush.create(mako, spotColorAll);
// Create a 'Rot' spot color
var spotColorSpaceRot = makeNewDeviceNColor(mako, "Rot", 0.0f, 1.0f, 1.0f, 0.0f);
var spotColorRot = IDOMColor.create(mako, spotColorSpaceRot, 1.0f, 1.0f);
var rot = IDOMSolidColorBrush.create(mako, spotColorRot);
// Create a 'Blau' spot color
var spotColorSpaceBlau = makeNewDeviceNColor(mako, "Blau", 1.0f, 1.0f, 0.0f, 0.0f);
var spotColorBlau = IDOMColor.create(mako, spotColorSpaceBlau, 1.0f, 1.0f);
var blau = IDOMSolidColorBrush.create(mako, spotColorBlau);
// Create some process color brushes
var cyan = IDOMSolidColorBrush.createSolidCmyk(mako, 1.0f, 0.0f, 0.0f, 0.0f);
var magenta = IDOMSolidColorBrush.createSolidCmyk(mako, 0.0f, 1.0f, 0.0f, 0.0f);
var yellow = IDOMSolidColorBrush.createSolidCmyk(mako, 0.0f, 0.0f, 1.0f, 0.0f);
var black = IDOMSolidColorBrush.createSolidCmyk(mako, 0.0f, 0.0f, 0.0f, 1.0f);
// Draw some boxes
var origin = new FPoint(100, 100);
var boxSize = new FPoint(100, 100);
var start = new FPoint(origin.x, origin.y);
// Draw Cyan box
var box = new FRect(start.x, start.y, boxSize.x, boxSize.y);
fixedPage.appendChild(IDOMPathNode.createFilled(mako, IDOMPathGeometry.create(mako, box), cyan));
start.x += boxSize.x;
// Draw Magenta box
box = new FRect(start.x, start.y, boxSize.x, boxSize.y);
fixedPage.appendChild(IDOMPathNode.createFilled(mako, IDOMPathGeometry.create(mako, box), magenta));
start.x += boxSize.x;
// Draw Yellow box
box = new FRect(start.x, start.y, boxSize.x, boxSize.y);
fixedPage.appendChild(IDOMPathNode.createFilled(mako, IDOMPathGeometry.create(mako, box), yellow));
start.x += boxSize.x;
// Draw Black box
box = new FRect(start.x, start.y, boxSize.x, boxSize.y);
fixedPage.appendChild(IDOMPathNode.createFilled(mako, IDOMPathGeometry.create(mako, box), black));
start.x += boxSize.x;
// Draw Red box
box = new FRect(start.x, start.y, boxSize.x, boxSize.y);
fixedPage.appendChild(IDOMPathNode.createFilled(mako, IDOMPathGeometry.create(mako, box), rot));
start.x += boxSize.x;
// Draw Blue box
box = new FRect(start.x, start.y, boxSize.x, boxSize.y);
fixedPage.appendChild(IDOMPathNode.createFilled(mako, IDOMPathGeometry.create(mako, box), blau));
// Draw a border in All
double strokeWidth = 20;
box = new FRect(origin.x - strokeWidth / 2.0, origin.y - strokeWidth / 2.0, start.x + strokeWidth,
boxSize.y + strokeWidth);
fixedPage.appendChild(IDOMPathNode.createStroked(mako, IDOMPathGeometry.create(mako, box), all,
new FMatrix(), null, strokeWidth));
// Write a PDF
IPDFOutput.create(mako).writeAssembly(assembly, "test.pdf");
}
// Create a new DeviceN color space with the given name and one colorant
static IDOMColorSpaceDeviceN makeNewDeviceNColor(IJawsMako mako, string spotColorName,
float cyan, float magenta, float yellow,
float black, IDOMColorSpace? alternateSpace = null)
{
// Create a vector of one colorant
var colorants = new CEDLVectColorantInfo();
var colorant = new IDOMColorSpaceDeviceN.CColorantInfo(spotColorName, 4);
float[] values = { cyan, magenta, yellow, black };
colorant.components = new CEDLVectFloat(values);
colorants.append(colorant);
// Create the DeviceN space
if (alternateSpace == null)
alternateSpace = IDOMColorSpaceDeviceCMYK.create(mako);
IDOMColorSpaceDeviceN deviceN = IDOMColorSpaceDeviceN.create(mako, colorants, alternateSpace);
return deviceN;
}
}
}
Rendering examples
Using Adobe Acrobat Professional's Output Preview, we can see clearly the effect of the Allcolorant.
The first image shows the page created by the example code as displayed by Acrobat. The border around the colored boxes is drawn with the All colorant.
After opening the Print Preview panel, the process and spot colors are listed. Note that the All colorant is not listed with the other spot colors. Acrobat and other PDF renderers such as Mako recognize the colorant names All and None and treat them differently, as described above.
Next, we turn off the process colors and the second spot color. The graphic is not shown in its color, because when Acrobat displays a single separation in this view, it shows it in grayscale. The first spot color remains, and the All colorant is also drawn on the Rot separation. This may seem counter-intuitive, as the All colorant is defined only in terms of CMYK. However, the PDF spec says All paints on all separations, thus the result you see here.
This final image shows the effect of showing the Cyan and Yellow plates only. When Acrobat displays more than one separation in this view, it shows them in their own color. As before, the All colorant is drawn on these separations, and mixes to produce the green.
JavaScript errors detected
Please note, these errors can depend on your browser setup.
If this problem persists, please contact our support.