PDFedit5 readme ============== TOC === License Contact Prerequisites Base (kernel), pdfedit5-core-dev package Tests Gui Documentation Configuration Configure features Libraries and binaries specification Installation directories Compilation Installation Cygwin build FreeBSD build NetBSD installation Debian package RPM based distros Gentoo package Altlinux 64b PDFedit devel package License ======= PDFedit5 is distributed under terms of GNU GPL in version 2. See doc/LICENSE.GPL for full license text. See doc/AUTHORS for full list of authors and contributors. For other more detailed documentation, look into "doc" subdirectory. File doc/user/user_doc.html contain more detailed installation instructions (in the Installation section) and list of required libraries. Contact ======= Feel free to contact me with any question via mail at info@danielripoll.me Prerequisites ============= Base (kernel), pdfedit5-code-dev package, xcb --------------------------------------- Boost libraries must be installed. See detailed description about configure parameters if you have some unusual installation. Freetype library is almost necessary, because nearly all PDFs use these fonts. T1 font library is also recommended. Tests ----- Unlike PDFedit, PDFEdit5 is still on development and and haven't been tested yet against CPPUNIT library, so don't blame if something didn't work. Indeed, nothing work at this right moment. See detailed description about configure parameters if you have some unusual installation. Tools ----- All tools use boost-program-options library so it has to be installed on your system if you want to compile them (see later how to enable them). Some distributions use a separate package (e.g. Debian) but most others include it directly into boost package. add_image tool uses libpng and its headers so libpng-dev package has to be installed. Gui --- Make sure you have all needed libraries (qt5, boost and xcb) along with their headers. You also need the environment variable QTDIR to be set to directory in which the Qt toolkit (version 5) is installed. Many distributions already set this when installing Qt, but some of them don't. In that case, you have to set the QTDIR manually. Usually it is set to something like /usr/lib/qt5 or /usr/share/qt5 (use e. g. export QTDIR=/usr/share/qt35to set the variable if this is your case). Also, while usually not needed, QMAKESPEC may be set to match your system type. For most systems it is unnecessary to set it, although it may be needed if you cross-compile (like producing i386 binaries on amd64 platform) or in some rare configurations. Once you set QTDIR, you may try typing "ls $QTDIR/mkspecs". QMAKESPEC should be set to name of one of the directories that are in mkspecs subdirectory in the Qt directory. See https://qt-project.org/wiki/Category:Tools or http://qt-project.org/doc/qt-5/qmake-manual.html for more information. QTDIR is used also for qmake (tool for generating makefiles from QT project files) detection. By default, this is stored somewhere under QTDIR directory (typically QTDIR/bin/), but there are also platforms, where this is not exactly true. If you have such a platform, try to use --with-qmake-dir parameter to configure (see bellow) Documentation ============= There are 3 levels of documentation in this project. * Basic - in the form of the man page which is always installed * doxygen - programming documentation extracted from sources and processed by doxygen tool. Obviously, doxygen has to be installed. This documentation is not created and installed by default and you have to explicitly enable it by --enable-doxygen-doc parameter to ./configure Result documentation is placed in the DOC_PATH/doxygen directory (DOC_PATH is PREFIX/share/doc/pdfedit) It is strongly recommended for pdfedit-core-dev package done by distributors. * user manual - html pages with user manual about PDFedit usage. This documentation is not created by default and you have to enable it by configure parameter --enable-user-manual. We are using xml based docbook format, so you have to have docbook xsl and xsltproc installed. Result documentation is placed in the DOC_PATH/manual directory. * advanced - design documentation which describes inner data structures, algorithms and relations from the programmer perspective. This one is useful if you want to develop PDFedit5 or 3rd party application based on PDFedit5. This documentation is not created by default too and you have to enable it by configure parameter --enable-advanced-doc. We are using xml based docbook format, so you have to have docbook xsl and xsltproc installed. Result documentation is placed in the DOC_PATH/design/ directory. Configuration ============= Run: ./configure [parameters] NOTE for those who use sources from GIT. configure is NO MORE part of the GIT tree!!! You have to generate it. This can be done simply by $ autoconf in the root of the checkout project. Note that you have to have autoconf package installed on your machine. Simple run without any parameter results in default configuration where application is compiled in release mode (optimizations turned on, debug symbols are not present, compilation warnings are eliminated), GUI is enabled, doxygen documentation is generated, no kernel tests (stored in src/kernel/tests/) are compiled and application will be installed into the /usr/local/pdfedit directory. Configuration enables also compilation and installation in so called pdfedit-core-dev package which prepares all libraries and header files for 3rd party application which want to reuse our core (kernel) functionality (see more in the Pdfedit devel package bellow). This is not done by default and you have to enable it explicitly by --enable-pdfedit-dev-core configure parameter. Note that development package and gui can be mixed together but also single dev. package can be created by disabling gui (see bellow). pdfedit-dev-core installation comes with pdfedit-core-dev-config script which can be used by 3rd party code for its configuration to correctly set compiler flags include paths, libraries and so on. Configure features ------------------ You can change this behavior with following parameters (feature is used if --enable- prefix is used, contrary --disable- prefix turns off this feature - e.g. if feature name stack-protector => --enable-stack-protector uses this feature): -stack-protector - adds stack protector parameter to the compilation flags. Disabled by default, because not all compilers support this feature (gcc > 4.1 supports it) -release - controls compilation flags for release mode (no debugging needed). This is used by default. It means that optimizations are turned on, debug information is not included in the result binary. If you want to debug or do some development, --disable-release is strongly recommended. -debug-info - if --enable-release is used and you still need debug information (e.g. when application crashes to have some reasonable stack traces) use --enable-debug-info. This parameter feature would be ignored if --disable-release is used. -observer-debug - just for developers only. Disabled by default. If turned on, some more debug information is added to the kernel code to enable debugging observers based code. -gui - Creates GUI for PDFedit5 (pdfedit5 binary). Enabled by default. If --disable-gui is used, no GUI (no pdfedit binary is created). -kernel-tests - Compiles all kernel tests (in src/kernel/tests). Disabled by default and intended for developers/testers only. Note that this requires to have CPPUNIT installed on your system. -tools - Compiles all tools which are available in src/tools. Disabled by default and intended for those interested in simple examples of pdfedit-core-dev library usage and those who need some simple tools for pdf manipulation/analyzes and don't want to use GUI or scripting (pdf_to_text, flattener, delinerizator, pdf_object_comparer, etc.). Note that you need also --enable-pdfedit-core-dev for tools. -doxygen-doc - generates also doxygen documentation useful for programmers. Disabled by default. Note that doxygen has to be installed for this feature. -user-manual - generates also docbook user manual documentation. Disabled by default. Note that docbook and its prerequisites have to be installed for this feature. -advanced-doc - generates also docbook design documentation. Disabled by default. Note that docbook and its prerequisites have to be installed for this feature. -pdfedit-core-dev - generates libraries needed for 3rd party applications which want to use pdfedit kernel core. Moreover make install will install also header files, libraries and pdfedit-core-dev-config helper script (see Installation directories bellow). This option is disabled by default. -poratability-flags - adds compiler flags which force c99/c++98 standard and posix/ansi portability. This option is enabled by default. Default configuration process will check for the number of CPUs/cores and use this value for make jobs parallelization (each make will use different CPU/core). You can change this behavior with --with-parallel-make=VALUE where VALUE is one of the: - auto (default) - (on Linux - checks /proc/cpuinfo and use the CPU counts for the number of parallel make jobs). - off - no parallelization - number - the number of parallel make jobs (positive number expected) Default behavior (no need for --with-parallel-make parameter) should be OK in almost all situations (with benefit of shorter built time), however if you have specific requirements when you don't want/can't use all your CPUs/cores for compilation you can use either off or precise number of parallel jobs. Libraries and binaries specification ------------------------------------ You can also control search paths for required libraries and binaries: - Freetype2 font library ./configure --with-ft-prefix=PATH_TO_YOUR_FREETYPE2 resp. (for T1) - T1 font library ./configure --with-t1-includes=PATH_TO_YOUR_T1_HEADERS \ --with-t1-library=PATH_TO_YOUR_T1_LIB - CPPUnit ./configure --with-cppunit-prefix=PATH_TO_YOUR_CPPUNIT - Boost ./configure --with-boost=YOUR_BOOST_INSTALLATION_PATH \ --with-boost-libdir=YOUR_BOOST_LIB_PATH - qmake is searched in $QTDIR/bin, /usr/bin, /usr/local/bin, /usr/lib/qt5/bin and in directories in $PATH. If you have qmake installed in other directory, use: ./configure --with-qmake=QMAKE_BINARY_WITH_PATH - QT comes with lrelease binary which is used for localization data files translation. This binary is searched in $QTDIR/bin, /usr/bin, /usr/local/bin, /usr/lib/qt5/bin and in directories in $PATH. If it is not found on your system, please use ./configure --with-lrelease-bin=LRELEASE_BINARY_WITH_PATH - doxygen is searched in /usr/bin , /usr/local/bin and current PATH directories. If you have doxygen installed in other directory, use: ./configure --with-doxygen=DOXYGEN_BINARY_WITH_PATH - xsltproc is searched in /usr/bin , /usr/local/bin and current PATH directories. If you have xsltproc installed in other directory, use: ./configure --with-xsltproc=XSLTPROC_BINARY_WITH_PATH - docbook xslt files are necessary for xsltproc to generate correct output from docbook xml files. There are many places where these files can be found. As many systems use different directories and there is no general way to detect, we are using file doc/tools/docbook_xslt_paths to define all possible directories which are searched. If you are sure that you have installed package with this file (usually stored ...html/dobook.xsl) add its absolute path to this file (each directory should be on the separate line and can use wildchars). If you report missing directory for your platform, we can add it in the next release. See ./configure --help for more information about this parameters. Installation directories ------------------------ All files are by default installed under /usr/local subdirectory (binary into /usr/local/bin, config files into /usr/local/share/pdfedit etc.). This location can be changed by --prefix parameter to configure (PREFIX in the following). PDFedit binary location can be controlled by --exec-prefix (EPREFIX in the following) and it is stored under EPREFIX/bin. EPREFIX is the same like PREFIX by default. Documentation files are copied to PREFIX/share/pdfedit/doc, configuration files and scripts are copied to PREFIX/share/pdfedit and man page is copied to PREFIX/share/man/man1. If pdfedit5-core-dev is configured, all relevant header files are copied into INCLUDEDIR/pdfedit5-version (INCLUDEDIR=PREFIX/include by default), static libraries are copied into LIBDIR/pdfedit-version (LIBDIR=EPREFIX/lib by default) and pdfedit5-core-dev-config script copied into the binary path as described for PDFedit bunary. If you need to change installation root (e. g. if you are packager and want to create package or use chrooted environment) use --with-root-dir=YOUR_INSTALLATION_ROOT_DIR Everything will then be installed with complete directory structure relative to that directory instead of real root directory (using correct PREFIX and EPREFIX of course). Note that you cannot just execute PDFedit from that directory straight away, as the files must be present in real root directory for editor to function properly. If you want just to move the installation elsewhere (in your home directory, for example), use --prefix parameter for that. Installation directories for specific parts (binary, documentation, configuration files) can be also controlled by configure parameters. --bindir controls directory where the pdfedit binary is copied --libdir controls directory where the pdfedit-core-dev libraries are installed --includedir controls directory where the pdfedit-core-dev header files are installed --docdir controls directory where documentation is copied --mandir controls directory where the man page is copied. Note that we provide only man 1 pdfedit, so that man page is actually copied under man1 sub-directory under specified one. --datadir controls directory where configuration files are stored (files are actually stored in pdfedit package name subdirectory) You can use following variables if you want to customize above directories: prefix - value set as --prefix (usually /usr/local) exec_prefix - value set as --exec_prefix (usually same as PREFIX) datarootdir - root directory for all pdfedit data (usually PREFIX/share) version - current version package_name - installed package name Example for multiple simultaneous versions installation: # Note that quotes are necessary here because bash (and some other # shells may too) would run subshell for $(expression) otherwise # Also note that man page will be overwritten by each installation. ./configure --bindir='$(exec_prefix)/$(package_name)-$(version)' \ --docdir='$(datarootdir)/doc/$(package_name)-$(version)' \ --datadir='$(datarootdir)/$(package_name)-$(version)' Compilation =========== After configure successfully finishes, run "make" in this directory to start compilation (note that GNU make is preferred bacause we are using some GNU make features which might be not available with other make implementations). If you need (for what ever reason) to change or explicitly specify other than default compiler, you can do it during configuration phase by passing your compiler as CC and CXX configure parameters. The first one stands for c files compiler while the second is used for c++ files. Lets say that we have gcc v 4.7 as default and want to compile with the newest gcc 4.8.2. Then you should do something like (name of compiler binary may vary on different systems - this one is for Debian): ./configure CC=gcc-4.8.2 CXX=g++-4.8.2 Note that CFLAGS and CXXFLAGS which can be standardly passed to configure are ignored by our configure script. However you can influence compiler parameters with the following variables: - ARCH for architecture specific parameters - C_EXTRA for CC flags (-fmessage-length=0 -D_FORTIFY_SOURCE=2 -fno-strict-aliasing will be used if not defined) - CXX_EXTRA for CXX flags (-fmessage-length=0 -D_FORTIFY_SOURCE=2 -fno-strict-aliasing -fexceptions will be used if not defined) - EXTRA_UTILS_CFLAGS, EXTRA_KERNEL_CFLAGS, EXTRA_TESTS_CFLAGS, EXTRA_XPDF_CFLAGS used for CC flags for utils resp. kernel resp. tests directory (only for internal/developers usage) - EXTRA_UTILS_CXXFLAGS, EXTRA_KERNEL_CXXFLAGS, EXTRA_TESTS_CXXFLAGS, EXTRA_GUI_CXXFLAGS, EXTRA_XPDF_CXXFLAGS same like the above for CXX Installation ============ To install editor, run make install Note that all files will be installed according to defined prefix and if --with-root-dir was specified for configure, then prefix is relative to the specified root. Cygwin build ============ PATH in cygwin must contain these three directories /bin (most required executables are stashed here) /usr/X11R6/bin (some libraries are here) /usr/lib/qt5/bin (qmake must be in PATH) You can use cygwin_build.bat to start the build process (you will need to set CYGWIN_ROOT in the file first). This will create the package in /tmp/pdfedit5-package and create pack.bat to pack the package with 7-zip Please note that the original authors from PDFedit have received reports about PDFedit failing to compile under some Cygwin releases. The problem turned out to be related to implementation of c++ standard wrt. to some functions definitions (e.g. mkstemp) under Cygwin. The only reasonable solution is turning off portability and c/c++ standards compiler flags. Please use --enable-portability-flags=no if you encounters these problems. FreeBSD build ============= Here is the short howto for PDFedit compilation and installation on FreeBSD 6.2 (Qt 3.38, Xorg 7.2). Thanks to Hao Chen. PDFedit5 is still not available in FreeBSD, but we left here as a legacy # untar current sources (this was done for 0.3.1 version) tar zxvf pdfedit-0.3.1.tar.bz2 cd pdfedit-0.3.1 setenv QTDIR /usr/local setenv QMAKESPEC /usr/local/share/qt/mkspecs/freebsd-g++ setenv LOCALBASE /usr/local ./configure --with-t1-library="${LOCALBASE}/lib" \ --with-t1-includes="${LOCALBASE}/include" #make sure you see this: #checking for T1_InitLib in -lt1... yes #using t1 library Our makefiles use some extensions of GNU make, so it is recomended to use gmake instead! NetBSD installation =================== Package for NetBSD for the old PDFedit is available on http://pkgsrc.se/wip/pdfedit As for PDFedit5 nothing is realeased yet Debian package ============== We haven't already got any package or official repo, so please wait until the project is finished See http://packages.debian.org/unstable/utils/pdfedit The package for the Ubuntu can by found at http://packages.ubuntu.com/gutsy/utils/pdfedit And if you want to create deb package by your self, Eric Doviak (thanks for this howto) suggests: First, install the packages necessary to build PDF Editor. # apt-get install dh-make libboost-dev Then, download the tarball from Sourceforge and extracted the files: $ tar -zxf pdfedit_1.0.0.tar.gz Next, enter the pdfedit-1.0.0/ directory and run dh_make $ cd pdfedit-1.0.0/ $ dh_make --createorig Choose to create a single binary. After running dh_make, open the pdfedit-1.0.0/debian/rules file and comment out (#) line 48: # $(MAKE) distclean Then, run: $ export QTDIR=/usr/share/qt5 $ dpkg-buildpackage That creates the DEB package that you can install with: # dpkg -i pdfedit_1.0.0-1_i386.deb RPM based distros ================= * We have nothing yet, so please wait. Also I develop mainly in Fedora, so you have a clue which distro will have first the package Gentoo package ============== Package is not yet on any repository, the old PDFedit is available on sunrise overlay repository which should be available in following way: emerge -va layman echo "source /usr/portage/local/layman/make.conf" >> /etc/make.conf layman -f -a sunrise pdfedit is then installed by: ACCEPT_KEYWORDS=~x86 emerge -av pdfedit Altlinux 64b ============ Altlinux has boost libraries stored in /usr/lib64 directory. This directory is not searched by default. Therefore you have to set library path by hand with --with-boost-libdir=/usr/lib64. PDFedit5 devel package ===================== PDFedit5 core functionality (read as non-gui) can be reused by 3rd party applications. For this purpose, we have provided separate configuration options and installation targets as described above. If you want to use this package following steps are required: * install pdfedit-core-dev package (either from distribution package if available or from sources as described above). * There are two possibilities to properly setup compiler and linker flags to compile your application correctly. - manual Makefile way You should use EPREFIX/pdfedit-core-dev-config script e.g. this way in Makefile: CXXFLAGS = $(shell pdfedit-core-dev-config --cflags) LDFLAGS = $(shell pdfedit-core-dev-config --libs) - autoconf way pdfedit source package comes with the config/pdfedit5-core-dev.m4 autoconf macro file which exports AX_PDFEDIT5_CORE_DEV macro. Just call it and use the exported variables PDFEDIT5_CORE_DEV_CPPFLAGS and PDFEDIT5_CODE_DEV_LDFLAGS in your Makefile. Read more about possible parameters directly in the file. * update your sources which are using pdfedit-core-dev: - initialize library by: if(pdfedit_core_dev_init()) { // Fatal error in initialization exit(); } before you call any PDFedit related code - cleanup library stuff at the end when pdfedit-core-dev is no longer used by: pdfedit5_core_dev_destroy(); [See doxygen documentation for these functions for more information]
meisterluk/pdfedit5
Fork of PDFedit which has the intention to move the code from Qt3 to Qt5, xlib to xcb, xpdf to poppler and QSA to QtScript
C++NOASSERTION