0

I'm trying to set up Podofo to Combining two PDF files from a vector std::vector<const wchar_t*> inputfiles;

here are my steps in detail (maybe it's very basic to many people but not to me):

  • download [podofo-0.9.7]
  • In vs2019, add #include "..podofo.h" and general/linker to COPYING.LIB settings (I'm not sure this)
  • build project i got error podofo_config.h not found so i changed file's name from podofo_config.h.in
  • on build, I got the following error:

enter image description here

  • I have read some post but there is very little information. I seem to need CMake, zlib,.. (I'm very new to building this type of project)

  • I have downloaded CMake3.30.3 and zlib1211

  • use CMake.exe to build zlib.lib but I can't find the exported library :

    enter image description here

Also what do I need to do to link zlib.lib with podofo? because when using Cmake to build podofo I get this error:

enter image description here Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR) (do I need to copy-paste into that directory)

How do I get over this problem?

Thanks a ton!

Yen Dang
  • 268
  • 2
  • 9

2 Answers2

1

Since it's better late than never, let me share what I found about building a Static version of the library with Visual Studio.

Download the PoDoFo project from GitHub

https://github.com/podofo/podofo

Download the precompiled 3rd party Dependencies from GitHub

https://github.com/podofo/podofo-deps

I personally placed both folders in C:\PoDoFoProj, so if you use another directory, make the required adjustments when building later. The structure we have so far is

C:\PoDoFoProj\podofo-deps-master
C:\PoDoFoProj\podofo-master

Now there is one little adjustmet that has to be made - Copy the 4 lib files from

C:\PoDoFoProj\podofo-deps-master\3rdparty\openssl\lib\Win64

to

C:\PoDoFoProj\podofo-deps-master\3rdparty\openssl\lib\

This is a workaround for the problem I have reported here - https://github.com/podofo/podofo/issues/57

Make a "build" dir in the podofo-master dir (the path should be C:\PoDoFoProj\podofo-master\build)

Using the command prompt navigate to that directory, and type:

cmake .. -DZLIB_LIBRARY="C:\PoDoFoProj\podofo-deps-master\3rdparty\zlib\lib\Win64\zlib.lib" -DZLIB_INCLUDE_DIR=C:\PoDoFoProj\podofo-deps-master\3rdparty\zlib\include -DPODOFO_BUILD_STATIC=TRUE -DOPENSSL_ROOT_DIR=C:\PoDoFoProj\podofo-deps-master\3rdparty\openssl -DJPEG_LIBRARY=C:\PoDoFoProj\podofo-deps-master\3rdparty\libjpeg\lib\Win64\jpeg.lib -DJPEG_INCLUDE_DIR="C:\PoDoFoProj\podofo-deps-master\3rdparty\libjpeg\include" -DTIFF_LIBRARY=C:\PoDoFoProj\podofo-deps-master\3rdparty\libtiff\lib\Win64\tiff.lib -DTIFF_INCLUDE_DIR=C:\PoDoFoProj\podofo-deps-master\3rdparty\libtiff\include -DPNG_LIBRARY=C:\PoDoFoProj\podofo-deps-master\3rdparty\libpng\lib\Win64\png.lib -DPNG_PNG_INCLUDE_DIR=C:\PoDoFoProj\podofo-deps-master\3rdparty\libpng\include -DLIBIDN_INCLUDE_DIR=C:\PoDoFoProj\podofo-deps-master\3rdparty\libidn\include -DLIBIDN_LIBRARY=C:\PoDoFoProj\podofo-deps-master\3rdparty\libidn\lib\Win64\idn.lib -DFREETYPE_LIBRARY=C:\PoDoFoProj\podofo-deps-master\3rdparty\freetype\lib\Win64\freetype.lib -DFREETYPE_INCLUDE_DIRS=C:\PoDoFoProj\podofo-deps-master\3rdparty\freetype\include\freetype2 -DFontconfig_LIBRARY=C:\PoDoFoProj\podofo-deps-master\3rdparty\fontconfig\lib\Win64\fontconfig.lib -DFontconfig_INCLUDE_DIR=C:\PoDoFoProj\podofo-deps-master\3rdparty\fontconfig\include -DLIBXML2_LIBRARY=C:\PoDoFoProj\podofo-deps-master\3rdparty\libxml2\lib\Win64\libxml2.lib -DLIBXML2_INCLUDE_DIR=C:\PoDoFoProj\podofo-deps-master\3rdparty\libxml2\include

Then the Visual Studio solution will appear here - C:\PoDoFoProj\podofo-master\build\PoDoFo.sln

Open it to build the HelloWorld example. (Optionally set the projects 'podofo_private' and 'podofo_static' to use /MP - they are pretty big and multi-processor compilation would speed up the process significantly)

Edit, May 2023

  1. The CMake argument for Static Build has been changed to -DPODOFO_BUILD_STATIC=TRUE
  2. When compiling with Visual Studio, "Enable Unity (Jumbo) Build" from the project configuration makes the compilation much faster than just /MP
0

Finally, I decided to go with the easier solution of wrapping by .net or using aspose.

The problem has been resolved :)

Yen Dang
  • 268
  • 2
  • 9