Skip to content

Instantly share code, notes, and snippets.

Avatar

Mako SDK mako-sdk

View GitHub Profile
@mako-sdk
mako-sdk / makoconverter.cpp
Created Aug 8, 2019
Modified makoconverter sample to demonstrate use of IAbort()
View makoconverter.cpp
/*
* Copyright (C) 2013-2019 Global Graphics Software Ltd. All rights reserved
*
* Simple sample application for conversions using the JawsMako APIs.
* Makes use of a separate thread to demonstrate use of IAbort()
*/
#include <algorithm>
#include <exception>
#include <iostream>
@mako-sdk
mako-sdk / makotransformer.cpp
Last active Jan 8, 2021
Mako example to demonstrate use of IAbort() in a transform process
View makotransformer.cpp
/*
* Copyright (C) 2013-2021 Global Graphics Software Ltd. All rights reserved
*
* Example application for interruptible transforms using the JawsMako APIs.
* Demonstrates use of IAbort(), IProgressTick (int and float) and IProgressMonitor().
*/
#include <algorithm>
#include <exception>
#include <iostream>
@mako-sdk
mako-sdk / StampAnnotation.cpp
Created Aug 8, 2019
Mako SDK: This code will create a rectangular annotation, 3 inches wide by 1 inch high, 2 inches from the left and 2 inches down, with a red dashed border, blue fill and 50% opacity
View StampAnnotation.cpp
IDocumentAssemblyPtr assembly = input->open(inputFilePath);
FRect fRect = FRect(192.0, 192.0, 276.0, 96.00);
auto red = IDOMColor::create(jawsMako,
IDOMColorSpaceDeviceRGB::create(jawsMako), 1.0f, 1.0f, 0.0f, 0.0f);
auto blue = IDOMColor::create(jawsMako,
IDOMColorSpaceDeviceRGB::create(jawsMako), 1.0f, 0.0f, 0.0f, 1.0f);
CAnnotationBorder annotationBorder(2.0f);
annotationBorder.type = CAnnotationBorder::eBTDashed;
annotationBorder.dash.resize(2);
annotationBorder.dash[0] = 4.0f;
@mako-sdk
mako-sdk / GlyphTransformImplementation.h
Last active Aug 13, 2019
Custom transform implementation to convert text to paths
View GlyphTransformImplementation.h
//-----------------------------------------------------------------------
// <copyright file="GlyphTransformImplementation.h" company="Global Graphics Software Ltd">
// Copyright (c) 2019 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>
//-----------------------------------------------------------------------
@mako-sdk
mako-sdk / DrawEllipse.cpp
Last active Sep 5, 2019
Method to draw an ellipse inside a rectangle using Bézier curves. Specify a square to draw a circle.
View DrawEllipse.cpp
// Draw an ellipse inside a rectangle using Bézier curves. Specify a square to draw a circle
void DrawEllipse(const IJawsMakoPtr jawsMako, IDOMFixedPagePtr& fixedPage, const FRect rect,
const double strokeThickness, const IDOMBrushPtr solidBrush)
{
// We can approximate a circle using four béziers. This is the parameter that is
// used for this purpose
double l = ((0.7071067812 - 0.5) * 8.0 / 3.0);
// And so we will offset the bézier control points by half that amount as the entire
// circle is one unit in diameter.
View MakeDeviceColor.cpp
// Define a spot color
IDOMColorPtr MakeDeviceColor(const IJawsMakoPtr &jawsMako, String name)
{
// Create a vector of colorants
IDOMColorSpaceDeviceN::CColorantInfoVect colorants;
// Add process color
colorants.append(IDOMColorSpaceDeviceN::CColorantInfo{ StringToU8String(name), 4, 0.5f, 0.6f, 0.0f, 0.4f });
// We will generate a color space with a DeviceCMYK alternate.
@mako-sdk
mako-sdk / makoconverter.cpp
Last active May 21, 2020
An enhanced MakoConverter sample that featuers a custom transform to flatten transparency and convert colors, speeding up writing to PDF/X-1a
View makoconverter.cpp
/*
* Copyright (C) 2013-2020 Global Graphics Software Ltd. All rights reserved
*
* Simple sample application for conversions using the JawsMako APIs.
*/
#include <algorithm>
#include <exception>
#include <iostream>
#include <stdexcept>
View ImagePdf.cs
public class ImagePdf
{
private readonly IJawsMako m_mako;
private readonly IDocumentAssembly m_assembly;
private readonly IDocument m_document;
private readonly string m_outputPdf;
public ImagePdf(IJawsMako jawsMako, string pdfPath)
{
m_mako = jawsMako;
@mako-sdk
mako-sdk / MakoPJLReporter.cpp
Last active Jul 23, 2020
This example code demonstrates using Mako to (1) parse PJL (as may be found in PCL, PCL/XL and PostScript) to discover information about the job such as a duplex setting and (2) getting information from print tickets that Mako populates as it interprets the document content. Optionally is can save the content to a PDF. It also demonstrates a tec…
View MakoPJLReporter.cpp
/*
* Copyright (C) 2020 Global Graphics Software Ltd. All rights reserved
*
* Simple sample application to report on job parameters in PJL-wrapped PCL, PCL/XL or Postscript, using Mako APIs.
*/
#include <algorithm>
#include <exception>
#include <iostream>
#include <stdexcept>
View DrawEllipse.cs
// Draw an ellipse inside a rectangle using Bézier curves. Specify a square to draw a circle
static void DrawEllipse(IJawsMako jawsMako, ref IDOMFixedPage fixedPage, FRect rect,
double strokeThickness, IDOMBrush solidBrush)
{
// We can approximate a circle using four béziers. This is the parameter that is
// used for this purpose
double l = ((0.7071067812 - 0.5) * 8.0 / 3.0);
// And so we will offset the bézier control points by half that amount as the entire
// circle is one unit in diameter.