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 :

  1. Cygwin + GCC (Microsoft Windows).
  2. Cygwin + MinGW (Microsoft Windows).
  3. Microsoft VC++ (Microsoft Windows).
  4. Borland C++ (Microsoft Windows).
  5. GCC (Linux, FreeBSD, NetBSD, Solaris).

 

Libharu can be used as static as well as a dynamic library. But when you use the static library it can be used by C and C++ and when you use it as shared-library, it can be used by many development languages like C++, javascript, Perl, PHP, Python, C#, Ruby and many more.

 

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 libharu package.

 

2. Now there are several kinds of makefile, for every compiler build the library with an appropriate makefile.

 

  • 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 libharu include folder.
  • Download the LPNG library 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

 

Thank You

 

About Author

Author Image
Satish Joshi

Satish has experience on web development believes in hard work and dedication. He is friendly and an honest person.

Request for Proposal

Name is required

Comment is required

Sending message..