Open Source Go Library for PDF Document Generation

A tiny command line tool for watermarking PDF files using image or text

MarkPDF is simple and tiny open-source PDF document manipulation API to add text and image based watermarks in PDF documents. The API provides a set of commands and command line tool for document manipulation. It's pretty simple and fast to use. Using the commands, the developer can configure position, rotation, stretch and set opacity of PDF document.

The API is lightweigh with no external depednecies. Currenly the API supported adding only image and text as watermarks in your document. While using text watermakrs the API supports Courier, Helvetica and Times Roman fonts only and while using image watermark you can use PNG images.

.

Previous Next

Getting Started with MarkPDF

To install the MarkPDF on your system, you need to download the latest stable release then rename it and give it execute permission. 

Install MarkPDF via GitHub

mv markpdf_linux-amd64 markpdf  
sudo chmod +x markpdf

Generate PDF Document via Free Go Library

Generating PDF documents with Go is pretty simple. All you need to do is create a blank PDf document with A4 size by using pdf.NewPDF("A4") method of the API. You can set measurements of the doucment in centimeters using pdf.SetUnits("cm") method and similary draw grid in newly created PDF document using pdf.DrawUnitGrid() method.

Set Font in PDF using Free GO API

This lightweight open-source API allows basic document manipulation and genration operation for PDf document. Once you have create a new document, you need to set font and font styles. In order to set fonts, pdf.SetFont() method, set position using pdf.SetXY() method and color of the text using pdf.SetColor() method respectively.