LibHaru Installation and Usage
Posted By Satish Joshi | 28-May-2019
What is LibHaru?
libHaru is an open source and cross-platform library for generating PDF files for applications written in C & C++. However, it is not intended for reading and editing existing PDF files.
Basically, it supports the following features :
- Generating PDF files with lines, text, and images.
- Embedding PNG, Jpeg images.
- Creating encrypted PDF files.
- Outline, text annotation, link annotation.
- Compressing document with deflate-decode.
- Supporting CJK fonts and encodings.
Supporting Compilers and Programming Languages :
It is written in ANSI C and can be compiled with any C compiler. As it is tested on the following environment :
- Cygwin + GCC (Microsoft Windows).
- Cygwin + MinGW (Microsoft Windows).
- Microsoft VC++ (Microsoft Windows).
- Borland C++ (Microsoft Windows).
- GCC (Linux, FreeBSD, NetBSD, Solaris).
Installation Process :
You can download its ZIP file through http://libharu.org/ according to the latest stable version.
For Linux Support, you can refer to this link: https://github.com/libharu/libharu/wiki/Installation.
After being downloaded the suitable version you can follow these steps in Windows Operating System :
1. Unpack the
2. Now there are several kinds of
- Microsoft VC++ Compiler (In My Case) :
NMAKE -f script/Makefile.msvc
- Borland C++ :
make -f script/Makefile.bcc.
Note: If you want to create a DLL then you can use Makefile.msvc_dll (or Makefile.bcc32_dll) instead.
Or In case if you use "Visual Studio .NET", use "Visual Studio .NET Command Prompt" to build Haru. But some warnings regarding optimization may occur because the compiler included in "Visual Studio .NET" does not have an optimizing feature. You can use "Microsoft Visual C++ Toolkit 2003" and "Microsoft Platform SDK" instead of as it has its optimizing feature.
Error Handling :
While executing it through VC++ compiler you will get some issues which I got. So these are the following steps you can follow to avoid any issues while you build up the library.
- Download the ZLIB library from https://zlib.net/ and copy the zlib.h and Zconf.h to
- Download the
LPNGlibrary from http://www.libpng.org/pub/png/libpng.html and copy its png.h, pnglibconf.h, and pngconf.h to the same path.
In case you can refer to this link https://github.com/libharu/libharu/issues/135 for more help