Skip to content

Instantly share code, notes, and snippets.

Avatar

Mako SDK mako-sdk

View GitHub Profile
@mako-sdk
mako-sdk / MakoImageExtract.cs
Created Dec 7, 2021
C# example to extract images from a PDF
View MakoImageExtract.cs
/* -----------------------------------------------------------------------
* <copyright file="makoimageextract.cs" company="Global Graphics Software Ltd">
* Copyright (c) 2021 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 / 1_XamlToMakoDom.cs
Last active Nov 17, 2021
XAML WPF Canvas conversion to Mako DOM, leveraging the Abbreviated Geometry Syntax support introduced in Mako 6.3.0
View 1_XamlToMakoDom.cs
/* --------------------------------------------------------------------------------
* <copyright file="XamlToMakoDom.cs" company="Global Graphics Software Ltd">
* Copyright (c) 2021 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 / StreamingExample.cs
Created Oct 28, 2021
This C# example demonstrates the use of callbacks to manage stream I/O.
View StreamingExample.cs
using System;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using JawsMako;
namespace StreamingExamples
{
static class Program
{
@mako-sdk
mako-sdk / RetargetRenderingIntent.cpp
Created Jul 23, 2021
Mako sample that uses a custom transform to update the rendering intent property on DOM nodes
View RetargetRenderingIntent.cpp
// <copyright file="RetargetRenderingIntent.cpp" company="Global Graphics Software Ltd">
// Copyright (c) 2021 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 / applyPageRotation.cpp
Created Jun 9, 2021
Creates a IDOMFixedPage from an IPage, rotating content and cropbox as needed
View applyPageRotation.cpp
// Create a IDOMFixedPage from an IPage, rotating content and cropbox as needed
static bool applyPageRotation(IJawsMakoPtr jawsMako, IPagePtr page, IDOMFixedPagePtr& fixedPage, FRect& cropBox)
{
if (!page)
return false;
// Does the page have crop margins?
// Note: page->getCropBox() will return the cropbox dimensions if set, or the mediabox (absolute page size) dimensions if not
// A fixedPage() does not offer this guarantee, so fixedPage->getCropBox() may return an empty FRect() (ie one or more values < 0)
cropBox = page->getCropBox();
@mako-sdk
mako-sdk / TestFrameWriter.cpp
Created May 15, 2021
Create an image from scratch by writing values to a buffer then use IImageFrameWriter to generate an IDOMImage that can be be saved to disk
View TestFrameWriter.cpp
// -----------------------------------------------------------------------
// <copyright file="TestFrameWriter.cpp" company="Global Graphics Software Ltd">
// Copyright (c) 2021 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>
// -----------------------------------------------------------------------
View makoobjsep.cpp
/*
* Copyright (C) 2013-2021 Global Graphics Software Ltd. All rights reserved
*
* Simple sample application for object-based separations using the JawsMako APIs.
*/
#include <algorithm>
#include <exception>
#include <iostream>
#include <stdexcept>
@mako-sdk
mako-sdk / CheckLinearized.cpp
Created Apr 27, 2021
Short example that shows obtaining metadata and checking a specific value
View CheckLinearized.cpp
// CheckLinearized.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <jawsmako/jawsmako.h>
#include <jawsmako/pdfinput.h>
#include <edl/idommetadata.h>
using namespace JawsMako;
using namespace EDL;
@mako-sdk
mako-sdk / 1-DownloadPrintJobPayload.cs
Last active Apr 26, 2021
Mako and Universal Print
View 1-DownloadPrintJobPayload.cs
var printDocument = job.Documents.First();
var jobFile = new FileInfo("temp.oxps");
await using (var documentStream = await client.Print.Printers[printerId].Jobs[jobId].Documents[printDocument.Id].Content.Request().GetAsync())
{
Console.WriteLine("Downloading...");
await using var file = File.Create(jobFile.FullName);
await documentStream.CopyToAsync(file);
}
@mako-sdk
mako-sdk / makodistiller.cpp
Created Mar 23, 2021
A Mako converter that uses the IDistiller class for speedy conversion of PostScript to PDF
View makodistiller.cpp
/*
* Copyright (C) 2020-2021 Global Graphics Software Ltd. All rights reserved
*
* Simple sample application for converting PS to PDF using the JawsMako APIs.
*/
#include <algorithm>
#include <exception>
#include <iostream>
#include <stdexcept>