I'm trying to build and use libharu (v2.3.0-RC3) library in order to create PDFs. My spec (Windows 7, Qt 5.9.1, Qt Creator 4.3.1, CMake 3.9.0 - rc5, GNU Make 3.82.90)
cmake -G "MinGW Makefiles" -DCMAKE_INCLUDE_PATH="C:\gnuwin32\include\" -DCMAKE_LIBRARY_PATH="C:\gnuwin32\lib\" -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release ..\
"C:\Qt\Projects\libharu\libharu\libharu_build\src\libhpdf.dll"-"C:\Qt\Projects\libharu\libharu\libharu_build\include\hpdf_config.h"
INCLUDEPATH += C:\Qt\Projects\libharu\libharu\include \
C:\Qt\Projects\libharu\libharu\libharu_build\include
LIBS += -LC:\Qt\Projects\libharu\libharu\libharu_build\src -lhpdf
- undefined reference to HPDF_Page_BeginText - undefined reference to HPDF_Page_LineTo - undefined reference to HPDF_Page_Stroke - undefined reference to HPDF_Page_MoveTo
Command-line output during assembly:
C:\Qt\Projects\libharu\libharu\libharu_build>cmake -G "MinGW Makefiles" -DCMAKE_INCLUDE_PATH="C:\gnuwin32\include" -DCMAKE_LIBRARY_PATH="C:\gnuwin32\lib\" -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release ..\
-- The C compiler identification is GNU 5.3.0
-- Check for working C compiler: C:/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/MinGW/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for include file dlfcn.h
-- Looking for include file dlfcn.h - found
-- Looking for include file inttypes.h
-- Looking for include file inttypes.h - found
-- Looking for include file memory.h
-- Looking for include file memory.h - found
-- Looking for include file stdint.h
-- Looking for include file stdint.h - found
-- Looking for include file stdlib.h
-- Looking for include file stdlib.h - found
-- Looking for include file strings.h
-- Looking for include file strings.h - found
-- Looking for include file string.h
-- Looking for include file string.h - found
-- Looking for include file sys/stat.h
-- Looking for include file sys/stat.h - found
-- Looking for include file sys/types.h
-- Looking for include file sys/types.h - found
-- Looking for include file unistd.h
-- Looking for include file unistd.h - found
-- Found ZLIB: C:/gnuwin32/lib/libz.dll.a (found version "1.2.3")
-- Found PNG: C:/gnuwin32/lib/libpng.dll.a (found version "1.2.37")
Summary of CMake build system results for the haru library
Install location variables which can be set by the user:
CMAKE_INSTALL_PREFIX: C:/Program Files (x86)/libharu
CMAKE_INSTALL_EXEC_PREFIX
CMAKE_INSTALL_BINDIR
CMAKE_INSTALL_LIBDIR
CMAKE_INSTALL_INCLUDEDIR
Other important CMake variables:
CMAKE_SYSTEM_NAME: Windows
UNIX:
WIN32: 1
APPLE:
MSVC: (MSVC_VERSION: )
MINGW: 1
MSYS:
CYGWIN:
BORLAND:
WATCOM:
CMAKE_BUILD_TYPE: Release
CMAKE_C_COMPILER CMAKE_C_FLAGS: C:/MinGW/bin/gcc.exe
Library options:
LIBHPDF_SHARED: ON
LIBHPDF_STATIC: ON
LIBHPDF_EXAMPLES: OFF
DEVPAK: OFF
Optional libraries:
HAVE_LIBZ: TRUE
HAVE_LIBPNG: TRUE
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Qt/Projects/libharu/libharu/libharu_build
C:\Qt\Projects\libharu\libharu\libharu_build>mingw32-make
Scanning dependencies of target hpdfs
[ 0%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_annotation.obj
[ 1%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_array.obj
[ 2%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_binary.obj
[ 3%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_boolean.obj
[ 4%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_catalog.obj
[ 5%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_destination.obj
[ 6%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_dict.obj
[ 6%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_doc_png.obj
[ 7%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_doc.obj
[ 8%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_encoder_cns.obj
[ 9%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_encoder_cnt.obj
[ 10%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_encoder_jp.obj
[ 11%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_encoder_kr.obj
[ 12%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_encoder.obj
[ 12%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_encrypt.obj
[ 13%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_encryptdict.obj
[ 14%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_error.obj
[ 15%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_ext_gstate.obj
[ 16%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_font_cid.obj
[ 17%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_font_tt.obj
[ 18%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_font_type1.obj
[ 18%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_font.obj
[ 19%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_fontdef_base14.obj
[ 20%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_fontdef_cid.obj
[ 21%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_fontdef_cns.obj
[ 22%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_fontdef_cnt.obj
[ 23%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_fontdef_jp.obj
[ 24%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_fontdef_kr.obj
[ 25%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_fontdef_tt.obj
[ 25%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_fontdef_type1.obj
[ 26%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_fontdef.obj
[ 27%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_gstate.obj
[ 28%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_image_ccitt.obj
[ 29%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_image_png.obj
[ 30%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_image.obj
[ 31%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_info.obj
[ 31%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_list.obj
[ 32%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_mmgr.obj
[ 33%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_name.obj
[ 34%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_namedict.obj
[ 35%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_null.obj
[ 36%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_number.obj
[ 37%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_objects.obj
[ 37%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_outline.obj
[ 38%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_page_label.obj
[ 39%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_page_operator.obj
[ 40%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_pages.obj
[ 41%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_real.obj
[ 42%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_streams.obj
[ 43%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_string.obj
[ 43%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_u3d.obj
[ 44%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_utils.obj
[ 45%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_xref.obj
[ 46%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_pdfa.obj
[ 47%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_3dmeasure.obj
[ 48%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_exdata.obj
[ 49%] Building C object src/CMakeFiles/hpdfs.dir/hpdf_encoder_utf.obj
[ 50%] Linking C static library libhpdfs.a
[ 50%] Built target hpdfs
Scanning dependencies of target hpdf
[ 50%] Building C object src/CMakeFiles/hpdf.dir/hpdf_annotation.obj
[ 51%] Building C object src/CMakeFiles/hpdf.dir/hpdf_array.obj
[ 52%] Building C object src/CMakeFiles/hpdf.dir/hpdf_binary.obj
[ 53%] Building C object src/CMakeFiles/hpdf.dir/hpdf_boolean.obj
[ 54%] Building C object src/CMakeFiles/hpdf.dir/hpdf_catalog.obj
[ 55%] Building C object src/CMakeFiles/hpdf.dir/hpdf_destination.obj
[ 56%] Building C object src/CMakeFiles/hpdf.dir/hpdf_dict.obj
[ 56%] Building C object src/CMakeFiles/hpdf.dir/hpdf_doc_png.obj
[ 57%] Building C object src/CMakeFiles/hpdf.dir/hpdf_doc.obj
[ 58%] Building C object src/CMakeFiles/hpdf.dir/hpdf_encoder_cns.obj
[ 59%] Building C object src/CMakeFiles/hpdf.dir/hpdf_encoder_cnt.obj
[ 60%] Building C object src/CMakeFiles/hpdf.dir/hpdf_encoder_jp.obj
[ 61%] Building C object src/CMakeFiles/hpdf.dir/hpdf_encoder_kr.obj
[ 62%] Building C object src/CMakeFiles/hpdf.dir/hpdf_encoder.obj
[ 62%] Building C object src/CMakeFiles/hpdf.dir/hpdf_encrypt.obj
[ 63%] Building C object src/CMakeFiles/hpdf.dir/hpdf_encryptdict.obj
[ 64%] Building C object src/CMakeFiles/hpdf.dir/hpdf_error.obj
[ 65%] Building C object src/CMakeFiles/hpdf.dir/hpdf_ext_gstate.obj
[ 66%] Building C object src/CMakeFiles/hpdf.dir/hpdf_font_cid.obj
[ 67%] Building C object src/CMakeFiles/hpdf.dir/hpdf_font_tt.obj
[ 68%] Building C object src/CMakeFiles/hpdf.dir/hpdf_font_type1.obj
[ 68%] Building C object src/CMakeFiles/hpdf.dir/hpdf_font.obj
[ 69%] Building C object src/CMakeFiles/hpdf.dir/hpdf_fontdef_base14.obj
[ 70%] Building C object src/CMakeFiles/hpdf.dir/hpdf_fontdef_cid.obj
[ 71%] Building C object src/CMakeFiles/hpdf.dir/hpdf_fontdef_cns.obj
[ 72%] Building C object src/CMakeFiles/hpdf.dir/hpdf_fontdef_cnt.obj
[ 73%] Building C object src/CMakeFiles/hpdf.dir/hpdf_fontdef_jp.obj
[ 74%] Building C object src/CMakeFiles/hpdf.dir/hpdf_fontdef_kr.obj
[ 75%] Building C object src/CMakeFiles/hpdf.dir/hpdf_fontdef_tt.obj
[ 75%] Building C object src/CMakeFiles/hpdf.dir/hpdf_fontdef_type1.obj
[ 76%] Building C object src/CMakeFiles/hpdf.dir/hpdf_fontdef.obj
[ 77%] Building C object src/CMakeFiles/hpdf.dir/hpdf_gstate.obj
[ 78%] Building C object src/CMakeFiles/hpdf.dir/hpdf_image_ccitt.obj
[ 79%] Building C object src/CMakeFiles/hpdf.dir/hpdf_image_png.obj
[ 80%] Building C object src/CMakeFiles/hpdf.dir/hpdf_image.obj
[ 81%] Building C object src/CMakeFiles/hpdf.dir/hpdf_info.obj
[ 81%] Building C object src/CMakeFiles/hpdf.dir/hpdf_list.obj
[ 82%] Building C object src/CMakeFiles/hpdf.dir/hpdf_mmgr.obj
[ 83%] Building C object src/CMakeFiles/hpdf.dir/hpdf_name.obj
[ 84%] Building C object src/CMakeFiles/hpdf.dir/hpdf_namedict.obj
[ 85%] Building C object src/CMakeFiles/hpdf.dir/hpdf_null.obj
[ 86%] Building C object src/CMakeFiles/hpdf.dir/hpdf_number.obj
[ 87%] Building C object src/CMakeFiles/hpdf.dir/hpdf_objects.obj
[ 87%] Building C object src/CMakeFiles/hpdf.dir/hpdf_outline.obj
[ 88%] Building C object src/CMakeFiles/hpdf.dir/hpdf_page_label.obj
[ 89%] Building C object src/CMakeFiles/hpdf.dir/hpdf_page_operator.obj
[ 90%] Building C object src/CMakeFiles/hpdf.dir/hpdf_pages.obj
[ 91%] Building C object src/CMakeFiles/hpdf.dir/hpdf_real.obj
[ 92%] Building C object src/CMakeFiles/hpdf.dir/hpdf_streams.obj
[ 93%] Building C object src/CMakeFiles/hpdf.dir/hpdf_string.obj
[ 93%] Building C object src/CMakeFiles/hpdf.dir/hpdf_u3d.obj
[ 94%] Building C object src/CMakeFiles/hpdf.dir/hpdf_utils.obj
[ 95%] Building C object src/CMakeFiles/hpdf.dir/hpdf_xref.obj
[ 96%] Building C object src/CMakeFiles/hpdf.dir/hpdf_pdfa.obj
[ 97%] Building C object src/CMakeFiles/hpdf.dir/hpdf_3dmeasure.obj
[ 98%] Building C object src/CMakeFiles/hpdf.dir/hpdf_exdata.obj
[ 99%] Building C object src/CMakeFiles/hpdf.dir/hpdf_encoder_utf.obj
[100%] Linking C shared library libhpdf.dll
[100%] Built target hpdf
File сontains hpdf_config.h
/* include/hpdf_config.h.in. Generated from configure.in by autoheader. */
/* Define to 1 if you have the <dlfcn.h> header file. */
#define LIBHPDF_HAVE_DLFCN_H
/* Define to 1 if you have the <inttypes.h> header file. */
#define LIBHPDF_HAVE_INTTYPES_H
/* Define to 1 if you have the `png' library (-lpng). */
#define LIBHPDF_HAVE_LIBPNG
/* Define to 1 if you have the `z' library (-lz). */
#define LIBHPDF_HAVE_LIBZ
/* Define to 1 if you have the <memory.h> header file. */
#define LIBHPDF_HAVE_MEMORY_H
/* Define to 1 if you have the <stdint.h> header file. */
#define LIBHPDF_HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#define LIBHPDF_HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#define LIBHPDF_HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#define LIBHPDF_HAVE_STRING_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#define LIBHPDF_HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#define LIBHPDF_HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#define LIBHPDF_HAVE_UNISTD_H
/* debug build */
/* #undef LIBHPDF_DEBUG */
/* debug trace enabled */
/* #undef LIBHPDF_DEBUG_TRACE */
/* libpng is not available */
/* #undef LIBHPDF_HAVE_NOPNGLIB */
/* #undef HPDF_NOPNGLIB */
/* zlib is not available */
/* #undef LIBHPDF_HAVE_NOZLIB */
/* Define to the address where bug reports for this package should be sent. */
#define LIBHPDF_PACKAGE_BUGREPORT "TODO"
/* Define to the full name of this package. */
#define LIBHPDF_PACKAGE_NAME "libHaru-2.2.0-gcc"
/* Define to the full name and version of this package. */
#define LIBHPDF_PACKAGE_STRING "libHaru-2.2.0-gcc"
/* Define to the one symbol short name of this package. */
#define LIBHPDF_PACKAGE_TARNAME "TODO"
/* Define to the version of this package. */
#define LIBHPDF_PACKAGE_VERSION "2.2.0"
/* Define to 1 if you have the ANSI C header files. */
#define LIBHPDF_STDC_HEADERS
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef LIBHPDF_size_t */
The contents of the "src" directory
C:\Qt\Projects\libharu\libharu\libharu_build\src>dir
11.07.2017 11:30 <DIR> .
11.07.2017 11:30 <DIR> ..
11.07.2017 11:29 <DIR> CMakeFiles
11.07.2017 11:29 2 585 cmake_install.cmake
11.07.2017 11:30 815 942 libhpdf.dll
11.07.2017 11:30 194 034 libhpdf.dll.a
11.07.2017 11:30 929 178 libhpdfs.a
11.07.2017 11:29 76 899 Makefile
The contents of the file "main"
#include <QCoreApplication>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <setjmp.h>
#include <hpdf.h>
#ifndef HPDF_NOPNGLIB
jmp_buf env;
#ifdef HPDF_DLL
void __stdcall
#else
void
#endif
error_handler (HPDF_STATUS error_no,
HPDF_STATUS detail_no,
void *user_data)
{
printf ("ERROR: error_no=%04X, detail_no=%u\n", (HPDF_UINT)error_no,
(HPDF_UINT)detail_no);
longjmp(env, 1);
}
void
show_description (HPDF_Page page,
float x,
float y,
const char *text)
{
char buf[255];
HPDF_Page_MoveTo (page, x, y - 10);
HPDF_Page_LineTo (page, x, y + 10);
HPDF_Page_MoveTo (page, x - 10, y);
HPDF_Page_LineTo (page, x + 10, y);
HPDF_Page_Stroke (page);
HPDF_Page_SetFontAndSize (page, HPDF_Page_GetCurrentFont (page), 8);
HPDF_Page_SetRGBFill (page, 0, 0, 0);
HPDF_Page_BeginText (page);
#ifdef __WIN32__
_snprintf(buf, 255, "(x=%d,y=%d)", (int)x, (int)y);
#else
snprintf(buf, 255, "(x=%d,y=%d)", (int)x, (int)y);
#endif /* __WIN32__ */
HPDF_Page_MoveTextPos (page, x - HPDF_Page_TextWidth (page, buf) - 5,
y - 10);
HPDF_Page_ShowText (page, buf);
HPDF_Page_EndText (page);
HPDF_Page_BeginText (page);
HPDF_Page_MoveTextPos (page, x - 20, y - 25);
HPDF_Page_ShowText (page, text);
HPDF_Page_EndText (page);
}
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
HPDF_Doc pdf;
HPDF_Font font;
HPDF_Page page;
char fname[256];
HPDF_Destination dst;
HPDF_Image image;
HPDF_Image image1;
HPDF_Image image2;
HPDF_Image image3;
double x;
double y;
double angle;
double angle1;
double angle2;
double rad;
double rad1;
double rad2;
double iw;
double ih;
strcpy (fname, argv[0]);
strcat (fname, ".pdf");
pdf = HPDF_New (error_handler, NULL);
if (!pdf) {
printf ("error: cannot create PdfDoc object\n");
return 1;
}
/* error-handler */
if (setjmp(env)) {
HPDF_Free (pdf);
return 1;
}
HPDF_SetCompressionMode (pdf, HPDF_COMP_ALL);
/* create default-font */
font = HPDF_GetFont (pdf, "Helvetica", NULL);
/* add a new page object. */
page = HPDF_AddPage (pdf);
HPDF_Page_SetWidth (page, 550);
HPDF_Page_SetHeight (page, 500);
dst = HPDF_Page_CreateDestination (page);
HPDF_Destination_SetXYZ (dst, 0, HPDF_Page_GetHeight (page), 1);
HPDF_SetOpenAction(pdf, dst);
HPDF_Page_BeginText (page);
HPDF_Page_SetFontAndSize (page, font, 20);
HPDF_Page_MoveTextPos (page, 220, HPDF_Page_GetHeight (page) - 70);
HPDF_Page_ShowText (page, "ImageDemo");
HPDF_Page_EndText (page);
/* load image file. */
#ifndef __WIN32__
image = HPDF_LoadPngImageFromFile (pdf, "pngsuite/basn3p02.png");
#else
image = HPDF_LoadPngImageFromFile (pdf, "pngsuite\\basn3p02.png");
#endif
/* image1 is masked by image2. */
#ifndef __WIN32__
image1 = HPDF_LoadPngImageFromFile (pdf, "pngsuite/basn3p02.png");
#else
image1 = HPDF_LoadPngImageFromFile (pdf, "pngsuite\\basn3p02.png");
#endif
/* image2 is a mask image. */
#ifndef __WIN32__
image2 = HPDF_LoadPngImageFromFile (pdf, "pngsuite/basn0g01.png");
#else
image2 = HPDF_LoadPngImageFromFile (pdf, "pngsuite\\basn0g01.png");
#endif
/* image3 is a RGB-color image. we use this image for color-mask
* demo.
*/
#ifndef __WIN32__
image3 = HPDF_LoadPngImageFromFile (pdf, "pngsuite/maskimage.png");
#else
image3 = HPDF_LoadPngImageFromFile (pdf, "pngsuite\\maskimage.png");
#endif
iw = HPDF_Image_GetWidth (image);
ih = HPDF_Image_GetHeight (image);
HPDF_Page_SetLineWidth (page, 0.5);
x = 100;
y = HPDF_Page_GetHeight (page) - 150;
/* Draw image to the canvas. (normal-mode with actual size.)*/
HPDF_Page_DrawImage (page, image, x, y, iw, ih);
show_description (page, x, y, "Actual Size");
x += 150;
/* Scalling image (X direction) */
HPDF_Page_DrawImage (page, image, x, y, iw * 1.5, ih);
show_description (page, x, y, "Scalling image (X direction)");
x += 150;
/* Scalling image (Y direction). */
HPDF_Page_DrawImage (page, image, x, y, iw, ih * 1.5);
show_description (page, x, y, "Scalling image (Y direction)");
x = 100;
y -= 120;
/* Skewing image. */
angle1 = 10;
angle2 = 20;
rad1 = angle1 / 180 * 3.141592;
rad2 = angle2 / 180 * 3.141592;
HPDF_Page_GSave (page);
HPDF_Page_Concat (page, iw, tan(rad1) * iw, tan(rad2) * ih, ih, x, y);
HPDF_Page_ExecuteXObject (page, image);
HPDF_Page_GRestore (page);
show_description (page, x, y, "Skewing image");
x += 150;
/* Rotating image */
angle = 30; /* rotation of 30 degrees. */
rad = angle / 180 * 3.141592; /* Calcurate the radian value. */
HPDF_Page_GSave (page);
HPDF_Page_Concat (page, iw * cos(rad),
iw * sin(rad),
ih * -sin(rad),
ih * cos(rad),
x, y);
HPDF_Page_ExecuteXObject (page, image);
HPDF_Page_GRestore (page);
show_description (page, x, y, "Rotating image");
x += 150;
/* draw masked image. */
/* Set image2 to the mask image of image1 */
HPDF_Image_SetMaskImage (image1, image2);
HPDF_Page_SetRGBFill (page, 0, 0, 0);
HPDF_Page_BeginText (page);
HPDF_Page_MoveTextPos (page, x - 6, y + 14);
HPDF_Page_ShowText (page, "MASKMASK");
HPDF_Page_EndText (page);
HPDF_Page_DrawImage (page, image1, x - 3, y - 3, iw + 6, ih + 6);
show_description (page, x, y, "masked image");
x = 100;
y -= 120;
/* color mask. */
HPDF_Page_SetRGBFill (page, 0, 0, 0);
HPDF_Page_BeginText (page);
HPDF_Page_MoveTextPos (page, x - 6, y + 14);
HPDF_Page_ShowText (page, "MASKMASK");
HPDF_Page_EndText (page);
HPDF_Image_SetColorMask (image3, 0, 255, 0, 0, 0, 255);
HPDF_Page_DrawImage (page, image3, x, y, iw, ih);
show_description (page, x, y, "Color Mask");
/* save the document to a file */
HPDF_SaveToFile (pdf, fname);
/* clean up */
HPDF_Free (pdf);
return a.exec();
}
#else
int main()
{
printf("WARNING: if you want to run this demo, \n"
"make libhpdf with HPDF_USE_PNGLIB option.\n");
return 0;
}
#endif /* HPDF_NOPNGLIB */
If in a file "hpdf.h" remove lines, project is building. Functionality does not work.
//#ifdef HPDF_DLL_MAKE
# define HPDF_EXPORT(A) __declspec(dllexport) A __stdcall
//#else
//# ifdef HPDF_DLL_MAKE_CDECL
//# define HPDF_EXPORT(A) __declspec(dllexport) A
//# else
//# ifdef HPDF_SHARED_MAKE
//# define HPDF_EXPORT(A) extern A
//# endif /* HPDF_SHARED_MAKE */
//# endif /* HPDF_DLL_MAKE_CDECL */
//#endif /* HPDF_DLL_MAKE */
I will be grateful for your help!
It is necessary to connect libraries in this manner (in a file .pro):
LIBS += -LC:\Qt\Projects\libharu\libharu\libharu_build\src\ -lhpdfs
LIBS += -LC:\gnuwin32\lib\ -lz