Skip to main content
Skip table of contents

Mako project templates in Visual Studio

Introduction

If you are developing in C++ or C# using Visual Studio, you may find these project templates useful. You can create new Mako projects with pre-included boilerplate code to save time on repetitive coding. For example, here is the boilerplate code for the Mako C++ Create PDF template.

Create PDF boilerplate (C++)
CPP
/* -----------------------------------------------------------------------
 * <copyright file="main.cpp" company="Global Graphics Software Ltd">
 *  Copyright (c) 2025 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 <iostream>

#include <jawsmako/jawsmako.h>
#include <jawsmako/pdfoutput.h>

using namespace JawsMako;
using namespace EDL;

int main()
{
    try
    {
	    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);
        
	    // TODO
        
	    IPDFOutput::create(mako)->writeAssembly(assembly, "test.pdf");
	}
    catch (IError& e)
    {
        const String errorFormatString = getEDLErrorString(e.getErrorCode());
        std::wcerr << L"Exception thrown: " << e.getErrorDescription(errorFormatString) << std::endl;
        return static_cast<int>(e.getErrorCode());
    }
    catch (std::exception& e)
    {
        std::wcerr << L"std::exception thrown: " << e.what() << std::endl;
        return 1;
    }

    return 0;
}

It creates all necessary objects for a Mako document, indicating where to add custom code. This is saved as a PDF, but you can choose another format if preferred.

How to use

Chose the templates you want to use and download the zip files to your computer. You will then need to navigate to your designated project templates folder for Visual Studio. The default location for this should be: %USERPROFILE%\Documents\Visual Studio 2022\Templates\ProjectTemplates.

image-20250819-161941.png

Simply add the zip files to this folder, without unzipping. The templates are then visible as an option when creating a new project in Visual Studio.

image-20250819-161935.png

Once you have created a new project, just add the NuGet Packages you need and you are good to go. See Using NuGet packages for more details.

Template files

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.