Commit 82f308f1 authored by Kitware Robot's avatar Kitware Robot Committed by David C. Lonie
Browse files

libharu 2017-03-28 (cb4935f2)

Code extracted from:

    https://gitlab.kitware.com/third-party/libharu.git

at commit cb4935f2a2a9957d469a1598f08700d4fbe34f93 (for/vtk).
parents
* -whitespace
Makefile
Makefile.in
acconfig.h
aclocal.m4
autom4te.cache
buildmk.stamp
config.h.in
config.cache
config.log
config.status
meta_cc
meta_ccld
mkinstalldirs
missing
install-sh
*.lo
*.la
.deps
*.plg
*.opt
*.ncb
.libs
_libs
*.o
*.a
*.tmp
*.so
*.so.*
cscope.out
config.guess
config.sub
configure
configure.in~
libtool
ltmain.sh
_configs.sed
CMakeCache.txt
CMakeFiles
CPackConfig.cmake
CPackSourceConfig.cmake
cmake_install.cmake
depcomp
libHaru news
-------------------------------------------------------------------------------
Version 2.3.0 RC2 (2011.10.12)
- Changed package naming, no other changes.
Version 2.3.0 RC1 (2011.09.28)
- Added support for 3dMeasures of subtype PD3 and 3DC, projection annotations,
ExData and javascript attached to a U3D model. (Robert Würfel)
- Added support for 1- and 2-byte UTF8 codes. (Clayman)
- Added full PDF/A1-b support. (Petr Pytelka)
- Added support for CCITT compression for B/W images. (Petr Pytelka)
- Add support for TwoPageLeft and TwoPageRight layouts. (Vincent Dupont)
- Const-ified arrays used in the sources. (Ilkka Lehtoranta)
- Fixed build with libpng 1.5.0
- Fixed bug in HPDF_GetContents() - isize variable was not initialized.
(Vincent Dupont)
- Fixed possible endless loop in PNG handling code.
(reported by Mathew Waters)
- Fixed several issues based on the warnings generated by clang-analyzer.
(Daniel Höpfl)
- Fixed quite a number of warnings. (Davide Achilli)
- Added 'd' postfix to debug build, fixed wrong filename. (Wim Dumon)
- Fixed HPDF_Text_Rect() not to split words in some obscure cases.
Version 2.2.0 (2010.10.12)
- Greatly improved U3D support (Nikhil Soman)
- Markup Annotations
- Free Text Annotations
- Line Annotations
- Circle and Squre Annotations
- Text Markup Annotations
- Rubber Stamp Annotations
- Popup Annotations
- Added VB.Net bindings. (Matt Underwood)
- Added CMake build system (experimental). (Werner Smekal)
- Added preliminary ICC support. (vbrasseur at gmail dot com)
- Added HPDF_Image_AddSMask(). (patch by Adam Blokus)
- Added HPDF_LoadPngImageFromMem() and HPDF_LoadJpegImageFromMem().
(patch by Adam Blokus)
- Added HPDF_GetContents().
- Added HPDF_Page_SetZoom().
- Added support for CMYK in HPDF_Image_LoadRawImageFromMem().
- Applied a bunch of fixes and improvements from bug report #13.
- HPDF_Page_TextRect() corrections and improvements. (Ralf Junker)
- Fixed build failure when zlib was not found. (Werner Smekal)
- Fixed build with newer libtool versions.
- Fixed external build. (thanks to Jeremiah Willcock)
- Fixed memleak in HPDF_EmbeddedFile_New(). (Ralf Junker)
- Fixed uninitialized fields in HPDF_Type1FontDef_New(). (Ralf Junker)
- Fixed issue with grayscale PNG images. (Ralf Junker)
- Fixed missing parentheses from empty string object. (Ralf Junker)
- Fixed bug #21 (Build fails on Win CE because of errno and errno.h usage).
- Fixed bug #18 (Missing compiler flag -fexceptions)
- Fixed bug #11 (sqrtf() is missing on Winblows).
- Fixed bug #10 (missing HPDF_LoadPngImageFromMem from win32/msvc/libhpdf.def).
- Fixed bug #7 (HPDF_String_SetValue() is declared twice).
- Fixed bug #6 (possible NULL dereference in HPDF_LoadPngImageFromFile2()).
- Fixed bug #5 (possible NULL derefernce in HPDF_LoadRawImageFromFile()).
- Fixed bug #4 (possible NULL dereference in HPDF_AToI()).
- Fixed bug #2 (Ruby binding: hpdf_insert_page has stray printf).
Version 2.1.0 (2008.05.27)
- Added initial support for Alpha channel in RGB and palette-based PNG images.
- Added HPDF_GetTTFontDefFromFile() function. This closes [FR #1604475] (HPDF_FONT_EXISTS not error)
- Added FreeBasic bindings. (Klaus Siebke)
- Added Python bindings. (Li Jun)
- Added U3D support. (Michail Vidiassov)
- Changed the build system to use autotools.
- Fixed bug #1682456 (NULL dereference in LoadType1FontFromStream()).
- Fixed bug #1628096 (NULL pointer may be dereferenced).
Version 2.0.8 (2006.11.25)
- Fixed a problem of HPDF_Circle() which causes buffer overflow.
- Added HPDF_Ellipse().
Version 2.0.7 (2006.11.05)
- Fixed a bug of HPDF_Annotation_New() (the values of bottom and top are set
upside down).
- Added HPDF_Page_GetCurrentPos2(), HPDF_Page_GetCurrentTextPos2() and
HPDF_Image_GetSize2().
Version 2.0.6 (2006.10.16)
- Added opacity and blend-mode featurs.
- Added slide-show functions (contributed by Adrian Nelson).
- Added an interface for VB6 (contributed by Ko, Chi-Chih).
- Fixed a bug that HPDF_MemStream_Rewrite() may cause segmentation fault.
- Fixed a bug of error checking of HPDF_Page_Concat().
- Fixed a bug of calculation for the position of text showing.
Version 2.0.5 (2006.09.20)
- Fixed a bug that an image which loaded by HPDF_LoadRawImageFromFile() or
HPDF_LoadRawImageFromMem() is not compressed.
- Added C# interface.
- Added viewer-preference feature.
- Fixed a bug that HPDF_SetPassword does not raise error when NULL string set
to owner-password.
- Fixed a bug that causes program crash when using interlaced PNG images.
Version 2.0.4 (2006.08.25)
- Fixed a bug of the TrueType font feature related to composit glyph.
Version 2.0.3 (2006.08.20)
- Fixed a bug that HPDF_Page_TextRect() always returns
HPDF_PAGE_INSUFFICIENT_SPACE.
- Added delayed loading function for a png image (HPDF_LoadPngImageFromFile2).
*change HPDF_SaveToStream function.
*correct hpdf_ttfontdef.c to avoid warning from a compiler.
Version 2.0.2
- Modified HPDF_Page_ShowTextNextLine() to invoking HPDF_Page_MoveToNextLine()
if it is invoked with null or zero-length text.
- Fixed a bug in which HPDF_Page_MeasureText() returns wrong value when using
CID fonts.
- Changed the feature of HPDF_Page_MeasureText().
- Added Japanese word wrap feature to HPDF_Page_MeasureText() and
HPDF_Page_TextRect().
- Fixed typos of HPDF_PageLayout values.
- Modified options of makefile for BCC32 to multi-thread.
rebuild libz.a, libpng.a for BCC32 with -WM option.
Version 2.0.1a (2006-08-03)
- Fixed a bug that HPDFPage::draw_image does not work correctly. (Ruby module
only.)
Version 2.0.1 (2006-07-29)
- Fixed a bug that HPDF_TextRect() does not work correctly when using CID fonts.
- Added HPDF_Font_GetAscent(), HPDF_Font_GetDescent(), HPDF_Font_GetXHeight(),
HPDF_Font_GetCapHeight().
# CMakeLists.txt
#
# Copyright (C) 2008 Werner Smekal
#
# Process this file with cmake to produce Makefiles or project files
# for your specific compiler tool set
#
# TODO:
# - shared and static library
# - packaging
# - devpackage
# =======================================================================
# libharu project
# =======================================================================
project(vtklibharu C)
# determine compiler name
set(COMPILER_LABEL "unknown")
if(CMAKE_COMPILER_IS_GNUCC)
set(COMPILER_LABEL "gcc")
endif(CMAKE_COMPILER_IS_GNUCC)
if(MSVC)
set(COMPILER_LABEL "vc")
endif(MSVC)
# information about libharu
set(LIBHPDF_MAJOR 2)
set(LIBHPDF_MINOR 2)
set(LIBHPDF_PATCH 0)
set(LIBHPDF_VERSION ${LIBHPDF_MAJOR}.${LIBHPDF_MINOR}.${LIBHPDF_PATCH})
set(LIBHPDF_DESCRIPTION "libHaru is a free, cross platform, open source library for generating PDF files.")
set(LIBHPDF_PACKAGE_NAME "libHaru-${LIBHPDF_VERSION}-${COMPILER_LABEL}")
# we want cmake version 2.4.8 at least
# KITWARE_LIBHARU_CHANGE VTK has a more stringent requirement:
if(FALSE)
cmake_minimum_required(VERSION 2.4.8 FATAL_ERROR)
endif()
# Location where the haru cmake build system first looks for cmake modules
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules)
# set library name, msvc does not append 'lib' automatically
# KITWARE_LIBHARU_CHANGE Not needed for VTK:
if(FALSE)
if(MSVC)
set(LIBHPDF_NAME lib)
set(CMAKE_DEBUG_POSTFIX "d")
endif(MSVC)
set(LIBHPDF_NAME ${LIBHPDF_NAME}hpdf)
set(LIBHPDF_NAME_STATIC ${LIBHPDF_NAME}s)
else()
set(LIBHPDF_NAME vtklibharu)
set(LIBHPDF_NAME_STATIC vtklibharu)
endif()
# =======================================================================
# command line options
# =======================================================================
# KITWARE_LIBHARU_CHANGE Force these to match VTK's settings:
if(FALSE)
option(LIBHPDF_SHARED "Build shared lib" YES)
option(LIBHPDF_STATIC "Build static lib" YES)
option(LIBHPDF_EXAMPLES "Build libharu examples" NO)
option(DEVPAK "Create DevPackage" NO)
else()
if(BUILD_SHARED_LIBS)
set(LIBHPDF_SHARED ON)
set(LIBHPDF_STATIC OFF)
else()
set(LIBHPDF_SHARED OFF)
set(LIBHPDF_STATIC ON)
endif()
set(LIBHPDF_EXAMPLES OFF)
set(DEVPAK OFF)
endif()
# Enable exceptions on linux if required
# (eg if you are using libharu in a C++ environment,
# and you want your error-callback to throw an exception,
# you will need to enable this for the exception to be
# able to throw through the libharu callstack).
if (CMAKE_COMPILER_IS_GNUCC OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang"))
# KITWARE_LIBHARU_CHANGE Our usage of libharu requires use of exceptions:
if (FALSE)
option (LIBHPDF_ENABLE_EXCEPTIONS "Enable exceptions" NO)
else()
set(LIBHPDF_ENABLE_EXCEPTIONS ON)
endif()
if (LIBHPDF_ENABLE_EXCEPTIONS)
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fexceptions")
endif (LIBHPDF_ENABLE_EXCEPTIONS)
endif ()
if(DEVPAK AND NOT WIN32)
message( STATUS "DevPackage only available for Win32. Set DEVPAK to OFF." )
set(DEVPAK OFF)
endif(DEVPAK AND NOT WIN32)
if(DEVPAK AND LIBHPDF_EXAMPLES)
message( STATUS "Examples are not build for DevPackage. Set LIBHPDF_EXAMPLES to OFF." )
set(LIBHPDF_EXAMPLES OFF)
endif(DEVPAK AND LIBHPDF_EXAMPLES)
# KITWARE_LIBHARU_CHANGE This is redundant with earlier logic:
if(FALSE)
if(BUILD_SHARED_LIBS)
set(LIBHPDF_SHARED ON)
endif(BUILD_SHARED_LIBS)
endif()
# =======================================================================
# look for headers and libraries
# =======================================================================
include(haru)
include(summary)
# KITWARE_LIBHARU_CHANGE We hardcode linkage to vtk's zlib and png libs:
if(FALSE)
# check zlib availibility
find_package(ZLIB)
if(ZLIB_FOUND)
include_directories(${ZLIB_INCLUDE_DIR})
set(ADDITIONAL_LIBRARIES ${ZLIB_LIBRARIES})
endif(ZLIB_FOUND)
# check png availibility
find_package(PNG)
if(PNG_FOUND)
include_directories(${PNG_INCLUDE_DIR})
add_definitions(${PNG_DEFINITIONS})
set(ADDITIONAL_LIBRARIES ${ADDITIONAL_LIBRARIES} ${PNG_LIBRARIES})
endif(PNG_FOUND)
else()
include_directories(${vtkzlib_INCLUDE_DIR} ${vtkpng_INCLUDE_DIR})
set(ADDITIONAL_LIBRARIES ${vtkzlib_LIBRARIES} ${vtkpng_LIBRARIES})
endif()
# =======================================================================
# configure header files, add compiler flags
# =======================================================================
# add definitions and directories to include
#if(CMAKE_COMPILER_IS_GNUCC)
# add_definitions("-Wall")
#endif(CMAKE_COMPILER_IS_GNUCC)
if(MSVC_VERSION GREATER 1399)
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE)
endif(MSVC_VERSION GREATER 1399)
# KITWARE_LIBHARU_CHANGE s/CMAKE_<...>/PROJECT_<...>/
include_directories(${PROJECT_SOURCE_DIR}/include)
# these are options
# KITWARE_LIBHARU_CHANGE Not needed for VTK:
if(FALSE)
option (LIBHPDF_DEBUG "Enable HPDF Debug")
option (LIBHPDF_DEBUG_TRACE "Enable HPDF Debug trace")
else()
set(LIBHPDF_DEBUG OFF)
set(LIBHPDF_DEBUG_TRACE OFF)
endif()
# I'll guess what these were supposed to be
set (LIBHPDF_PACKAGE_STRING "${LIBHPDF_PACKAGE_NAME}")
set (LIBHPDF_PACKAGE_VERSION ${LIBHPDF_VERSION})
# I have no idea
set (LIBHPDF_PACKAGE_BUGREPORT "TODO")
set (LIBHPDF_PACKAGE_TARNAME "TODO")
# Just set to 1, we'll assume they are always available.
# If not, then someone will have to add some tests in here to correctly determine
# the headers existance.
set (LIBHPDF_STDC_HEADERS 1)
# Don't do anything with this, it doesn't seem to be used anywhere anyhow
# set (LIBHPDF_size_t ???)
# KITWARE_LIBHARU_CHANGE We hardcode linkage to vtk's zlib and png libs:
if(FALSE)
# support all of the different variations of LIBPNG defines in HARU
set (LIBHPDF_HAVE_LIBPNG ${PNG_FOUND})
if (NOT PNG_FOUND)
set (LIBHPDF_HAVE_NOPNGLIB 1)
set (HPDF_NOPNGLIB 1)
endif (NOT PNG_FOUND)
# support different zlib defines
set (LIBHPDF_HAVE_LIBZ ${ZLIB_FOUND})
if (NOT ZLIB_FOUND)
set (LIBHPDF_HAVE_NOZLIB 1)
endif (NOT ZLIB_FOUND)
else()
set(LIBHPDF_HAVE_LIBPNG 1)
set(LIBHPDF_HAVE_LIBZ 1)
endif()
# create hpdf_config.h
# KITWARE_LIBHARU_CHANGE s/CMAKE_<...>/PROJECT_<...>/
configure_file(
${PROJECT_SOURCE_DIR}/include/hpdf_config.h.cmake
${PROJECT_BINARY_DIR}/include/hpdf_config.h
)
include_directories(${PROJECT_BINARY_DIR}/include)
# create DevPackage file
# KITWARE_LIBHARU_CHANGE s/CMAKE_<...>/PROJECT_<...>/
if(DEVPAK)
configure_file(
${PROJECT_SOURCE_DIR}/libharu.DevPackage.cmake
${PROJECT_BINARY_DIR}/libharu.DevPackage
)
endif(DEVPAK)
# =======================================================================
# create library and demos
# =======================================================================
add_subdirectory(src)
# KITWARE_LIBHARU_CHANGE The demo directory is removed to save space:
if(FALSE)
add_subdirectory(demo)
endif()
# =======================================================================
# installation configuration
# =======================================================================
set(
haru_HDRS
include/hpdf.h
include/hpdf_types.h
include/hpdf_consts.h
include/hpdf_version.h
include/hpdf_annotation.h
include/hpdf_catalog.h
include/hpdf_conf.h
include/hpdf_destination.h
include/hpdf_doc.h
include/hpdf_encoder.h
include/hpdf_encrypt.h
include/hpdf_encryptdict.h
include/hpdf_error.h
include/hpdf_ext_gstate.h
include/hpdf_font.h
include/hpdf_fontdef.h
include/hpdf_gstate.h
include/hpdf_image.h
include/hpdf_info.h
include/hpdf_list.h
include/hpdf_mmgr.h
include/hpdf_objects.h
include/hpdf_outline.h
include/hpdf_pages.h
include/hpdf_page_label.h
include/hpdf_streams.h
include/hpdf_u3d.h
include/hpdf_utils.h
include/hpdf_pdfa.h
include/hpdf_3dmeasure.h
include/hpdf_exdata.h
# KITWARE_LIBHARU_CHANGE s/CMAKE_<...>/PROJECT_<...>/
${PROJECT_BINARY_DIR}/include/hpdf_config.h
# KITWARE_LIBHARU_CHANGE Add mangling header
include/vtk_haru_mangle.h
)
# install header files
# KITWARE_LIBHARU_CHANGE Let VTK handle install
if(FALSE)
install(FILES ${haru_HDRS} DESTINATION include)
# install various files
install(FILES README CHANGES INSTALL DESTINATION .)
if(NOT DEVPAK)
install(DIRECTORY if DESTINATION .)
endif(NOT DEVPAK)
if(DEVPAK)
# KITWARE_LIBHARU_CHANGE s/CMAKE_<...>/PROJECT_<...>/
install(FILES ${PROJECT_BINARY_DIR}/libharu.DevPackage DESTINATION .)
endif(DEVPAK)
else()
if (NOT VTK_INSTALL_NO_DEVELOPMENT)
install(FILES
${haru_HDRS}
DESTINATION "${VTK_ISNTALL_INCLUDE_DIR}/vtklibharu"
COMPONENT Development
)
endif()
endif()
# =======================================================================
# print out some information
# =======================================================================
# KITWARE_LIBHARU_CHANGE Needless verbosity:
if(FALSE)
summary()
endif()
# =======================================================================
# packing stuff
# =======================================================================
# KITWARE_LIBHARU_CHANGE Let VTK handle install
if(FALSE)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY ${LIBHPDF_DESCRIPTION})
set(CPACK_PACKAGE_VENDOR "Werner Smekal")
set(CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/README)
set(CPACK_PACKAGE_VERSION_MAJOR "${LIBHPDF_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${LIBHPDF_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${LIBHPDF_PATCH}")
set(CPACK_PACKAGE_FILE_NAME "libHaru-${LIBHPDF_VERSION}-${COMPILER_LABEL}")
set(CPACK_STRIP_FILES ON)
if(WIN32)
set(CPACK_GENERATOR ZIP)
else(WIN32)
set(CPACK_GENERATOR TGZ)
endif(WIN32)
INCLUDE( CPack )
endif()
Installation
------------
Installing libHaru on Linux/Unix is as easy as this:
./configure && make && make install
You might want to look at ./configure options though.
See more details installation instructions here:
http://libharu.org/wiki/Documentation/Install
Windows binaries are available in the download section:
http://libharu.org/wiki/Download
#
# URL http://libharu.org/
#
# Copyright 2000-2006 (c) Takeshi Kanno
# Copyright 2007-2009 (c) Antony Dovgal et al.
#
See INSTALL for instructions on how to install libHaru.
*
* What is Haru Free PDF Library?
*
Haru is a free, cross platform, open-sourced software library for generating
PDF. It supports the following features.
1. Generating PDF files with lines, text, images.
2. Outline, text annotation, link annotation.
3. Compressing document with deflate-decode.
4. Embedding PNG, Jpeg images.
5. Embedding Type1 font and TrueType font.
6. Creating encrypted PDF files.
7. Using various character set (ISO8859-1~16, MSCP1250~8, KOI8-R).
8. Supporting CJK fonts and encodings.
You can add the feature of PDF creation by using Haru without understanding
complicated internal structure of PDF.
*
* The differences from the previous version
*
The biggest differences are that all code is written in C.
To our regret, because internal structures changed greatly, The API is not
compatible with previous version.
However, the new-version has the following advantages compared with the
previous version.
1. Supported shared-library build.
A new-version library is able to be built as shared-library.
2. The performance has been greatly improved.
A new-version library is about 4-15 times faster than a previous version.
3. Supported more features.
TrueType font, 128 bit encryption, arc function, and so on.
*
* Supporting platforms
*
Haru is written in ANSI-C and should compile easily with any compliant C
compiler.
I inspected Haru in the following environment and make files for these
environments are included in a package.
1. Cygwin + GCC (Microsoft Windows)
2. Cygwin + MinGW (Microsoft Windows)
3. MSYS + MinGW (Microsoft Windows)
3. Microsoft VC++ (Microsoft Windows)
4. Borland C++ (Microsoft Windows)
5. GCC (Linux, FreeBSD, NetBSD, Solaris...)
Also on platforms except the above, it is easy to build HARU. If you success to build HARU on other platforms, please send makefile to me.
In addition, ZLIB and PNGLIB are required when you want to use the features of
compression and embedding PNG images. (In the case of Windows, static library
files for several compilers are included in the package for WIndows. In the
case of most of UNIX, these libraries are usually installed.)
*
* Available development environment
*
Haru can work as both static-library (.a, .lib) and shared-library (.so, .dll).
When you use it as static-library, It can be used by C and a C++.
But when you use it as shared-library, it can be used by many development
languages which support shared library.
So far, Haru provides bindings for Ruby, Delphi/Free Pascal and C#.
If you write bindings for other programing languages, please notice me!
*
* Runtime environment of programs using Haru
*
1. static-library
No runtime files are required.
2. shared-library
In Windows, you have to distribute libhpdf.dll with a program. In UNIX you
have to distribute libhpdf.so* with a program.
NOTE:
In the UNIX environment, there are the cases that libz.so, libpng.so.x are
necessary. About this, please refer to the documentation of PNGLIB and ZLIB.
*
* License
*
Haru is distributed under the ZLIB/LIBPNG License. Because ZLIB/LIBPNG License
is one of the freest licenses, You can use Haru for various purposes.
The license of Haru is as follows.
Copyright (C) 1999-2006 Takeshi Kanno
Copyright (C) 2007-2009 Antony Dovgal
This software is provided 'as-is', without any express or implied warranty.
In no event will the authors be held liable for any damages arising from the
use of this software.
Permission is granted to anyone to use this software for any purpose,including
commercial applications, and to alter it and redistribute it freely, subject
to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim
that you wrote the original software. If you use this software in a
product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
*
* Acknowledgment