Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
re-arranging page sequence in a pdf document
C++ C
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
src
.gitignore
CMakeLists.txt
README.mkd

README.mkd

Description

This toy is for re-arranging page sequence in a pdf document, preparing for printing on both sides of paper. If the paper size of an PDF is small enough to fit in half of a real-world A4 paper in printing, we could simply print two pages on one side of the paper. After applying this toy to the PDF, the post-processing would be rather easier.

Building

quadpager depends on libPoDoFo. So install it first.

  • modify src/CMakeLists.txt to fit your circumstance.
  • choose your desired compiler and prefix.

    mkdir build
    cd build
    cmake .. -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_INSTALL_PREFIX=/opt
    sudo make install
    

Usage

  • quadpager input.pdf output.pdf
  • Use printers which support duplex printing;
  • Choose 'short-side' or relevant;
  • Cut the paper pile from middle, and then see the magic.

Tips

On Linux, one can install libPoDoFo thru package management system, such as pacman, aptitude. However on OS X, if you do not want to use MacPorts, which would install plenty of redundant libraries or so, the building task is sometimes tricky. Homebrew has not provided formula for libPoDoFo yet. libPoDoFo provides its own FindFREETYPE.cmake module which would not work properly on OS X. De facto, freetype library on OS X resides in /usr/x11/ by default. But libPoDoFo's package finder would not search there. So fix it manually. The SVN version of libPoDoFo does not have this issue.

Another issue is that if you have not install libJPEG and do not want to use any features related to libJPEG, you should manually delete the line ${LIBJPEG_LIBRARIES} from PODOFO_LIB_DEPENDS. Or cmake would end incompletely. Finally, if you would like to build both static and shared library, add the option -DPODOFO_BUILD_STATIC=1 -DPODOFO_BUILD_SHARED=1 to cmake, and add -DPODOFO_BUILD_LIB_ONLY=1 if you regard other tools, tests, examples useless.

Work-around for install_name in linking libPoDoFo (on OS X)

Add below lines in top level CMakeLists.txt:

    IF(APPLE)
      SET(CMAKE_INSTALL_NAME_DIR @rpath)
      SET(CMAKE_BUILD_WITH_INSTALL_RPATH ON)
    ENDIF(APPLE)

If you prefer absolute path or so, add this:

    set(cmake_install_name_dir ${cmake_install_prefix}/lib)

and -Wl linking message passing in compiling quadpager could be simply eliminated.

Something went wrong with that request. Please try again.