Merged in selmf/yacreader/mac_build (pull request #49)

Mac build
This commit is contained in:
Luis Ángel San Martín 2017-05-23 13:24:14 +00:00
commit 383f002497
58 changed files with 5930 additions and 486 deletions

View File

@ -1,5 +1,6 @@
COMPILATION GUIDE FOR LINUX/UNIX USERS
**********************************
**************************************
YACReader and YACReaderLibrary are build using qmake. To build and install the program, run:
qmake-qt5 CONFIG+=[Options]
@ -8,15 +9,12 @@ make install
from the source dir. For seperate builds of YACReader or YACReaderLibrary, enter their respective subfolders and run the commands from there.
For the headless version of YACReaderLibrary enter the YACReaderLibrary folder and run:
qmake-qt5 YACReaderLibraryServer.pro
This will select the build config for the headless version instead of the gui version. You can then continue the build as described above.
The headless version of YACReaderLibrary is located in the YACReaderLibraryServer folder. To build it, enter the folder and run the steps as
described above.
Dependencies:
-----------------------
-------------
- Qt >= 5.3 with the following modules:
- declarative
@ -29,8 +27,8 @@ Dependencies:
- sql-sqlite
- network
- poppler-qt5
- qrencode
- a pdf rendering backend, poppler-qt5 or pdfium (optional, see below)
- qrencode (optional)
- sqllite
- glu
- a decompression backend, either 7zip or unarr (see below)
@ -40,7 +38,7 @@ silently fail and only show a white page if the proper qml modules (declarative,
Decompression backend:
--------------------------------------
----------------------
YACReader supports two decompression backends:
@ -59,12 +57,31 @@ If you chose to build YACReader with p7zip as a backend on Linux/Unix, please ta
- p7zip 9.20.1 has known bugs that are fixed only in the later versions
- a system update that replaces p7zip 9.20.1 with a later version will make YACReader unusable
If your system already ships with p7zip > 9.20.1 you can place 7z.so and the Codecs folder with the Rar29.so from p7zip 9.20.1 in /usr/lib/yacreader
If your system already ships with p7zip > 9.20.1 you can place 7z.so and the Codecs folder with the Rar29.so file from p7zip 9.20.1 in /usr/lib/yacreader
YACReader will check this folder first and can thus continue using 7zip as a backend with p7zip > 9.20.1 installed on your system.
Pdf backend:
------------
Starting with version 8.6.0 YACReader supports the following pdf render backends:
- poppler (Linux default)
- pdfium
- pdfkit (macOS only, macOS default)
- no_pdf (disables pdf support)
To select one of them just add CONFIG+=[backend] when running qmake.
While the Poppler backend is well-tested and has been the standard for YACReader for a long time, its performance is a bit lacking.
Pdfium, the pdf render engine developed by Google's Chromium project and used in the
Chrome browser, offers much better performance (about 10x as fast on some pdf files we tested).
However, at the time of this writing, it isn't easily available as an installable package and a bit challenging to build.
If you are interested in using this backend, you can find further informations on how to proceed in the dependencies subfolder.
Other build options:
------------------------------
--------------------
You can adjust the installation prefix as well als the path make install uses to install the files.
Use "qmake PREFIX=DIR" to configure YACReader for your systems default prefix (for example "/", "/usr", "/usr/local").
@ -83,15 +100,12 @@ qmake-qt5 CONFIG+=no_opengl
This will remove any dependency on desktop OpenGL and hardlock YACReader's coverflow to software rendering. Please note that it
doesn't actually remove OpenGL from the build, the Qt toolkit will still make use of it.
Pdf support can be disabled by using the no_pdf option:
qmake-qt5 CONFIG+=no_pdf
This also removes the need for the poppler-qt5 library to be installed.
DO YOU WANT TO HELP YACREADER?
******************************
If you're compiling YACReader because there is no package available for your Linux distribution please consider creating and submitting a package.
While we do provide packages for .deb based distributions aus well as an AUR package for Archlinux we are in need of packagers especially for RPM based
distributions. If you are interested, please contact selmf on the YACReader forums or write an email to info@yacreader.com
While we do provide packages for .deb based distributions as well as an AUR package for Archlinux we are in need of packagers especially for RPM based
distributions. If you are interested, please contact selmf on the YACReader forums or write an email to info@yacreader.com
If you have already created a package for your Linux distribution please let us know so whe can add it to our downloads list ;)

View File

@ -11,6 +11,7 @@ QMAKE_MAC_SDK = macosx10.12
#load default build flags
include (../config.pri)
include (../dependencies/pdf_backend.pri)
unix:!macx{
QMAKE_CXXFLAGS += -std=c++11
@ -27,7 +28,7 @@ CONFIG(force_angle) {
SOURCES += main.cpp
INCLUDEPATH += ../common \
../custom_widgets
../custom_widgets
!CONFIG(no_opengl):CONFIG(legacy_gl_widget) {
INCLUDEPATH += ../common/gl_legacy \
@ -39,63 +40,24 @@ INCLUDEPATH += ../common \
win32 {
CONFIG(force_angle) {
message("using ANGLE")
LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32 -lshell32 -lopengl32 -lglu32 -luser32
LIBS += -loleaut32 -lole32 -lshell32 -lopengl32 -lglu32 -luser32
#linking extra libs are necesary for a successful compilation, a better approach should be
#to remove any OpenGL (desktop) dependencies
#the OpenGL stuff should be migrated to OpenGL ES
DEFINES += FORCE_ANGLE
} else {
LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32 -lshell32 -lopengl32 -lglu32 -luser32
LIBS += -loleaut32 -lole32 -lshell32 -lopengl32 -lglu32 -luser32
}
!CONFIG(no_pdf) {
!CONFIG(pdfium) {
LIBS += -lpoppler-qt5
INCLUDEPATH += ../dependencies/poppler/include/qt5
} else {
DEFINES += "USE_PDFIUM"
contains(QMAKE_TARGET.arch, x86_64): {
LIBS += -L$$PWD/../dependencies/pdfium/x64 -lpdfium
} else {
LIBS += -L$$PWD/../dependencies/pdfium/x86 -lpdfium
}
INCLUDEPATH += ../dependencies/pdfium/public
}
} else {
DEFINES += "NO_PDF"
}
QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT /GL
QMAKE_LFLAGS_RELEASE += /LTCG
CONFIG -= embed_manifest_exe
}
unix:!macx{
!CONFIG(no_pdf){
!CONFIG(pdfium){
INCLUDEPATH += /usr/include/poppler/qt5
LIBS += -L/usr/lib -lpoppler-qt5
} else {
DEFINES += "USE_PDFIUM"
INCLUDEPATH += /usr/include/pdfium
LIBS += -L/usr/lib/pdfium -lpdfium -lfreetype
#static pdfium libraries have to be included *before* dynamic libraries
#LIBS += -L/usr/lib/pdfium -Wl,--start-group -lpdfium -lfpdfapi -lfxge -lfpdfdoc \
# -lfxcrt -lfx_agg -lfxcodec -lfx_lpng -lfx_libopenjpeg -lfx_lcms2 -ljpeg \
# -lfx_zlib -lfdrm -lfxedit -lformfiller -lpdfwindow -lpdfium -lbigint -ljavascript \
# -lfxedit -Wl,--end-group -lfreetype
}
} else {
DEFINES += "NO_PDF"
}
!CONFIG(no_opengl) {
unix:!macx:!CONFIG(no_opengl) {
LIBS += -lGLU
}
}
macx{
#INCLUDEPATH += "/Volumes/Mac OS X Lion/usr/X11/include"
#isEqual(QT_MAJOR_VERSION, 5) {
@ -107,20 +69,11 @@ macx{
#LIBS += -L/usr/local/lib -lpoppler-qt4
#}
#TODO: pdfium support
!CONFIG(no_pdf) {
DEFINES += "USE_PDFKIT"
} else {
DEFINES += "NO_PDF"
}
CONFIG += objective_c
QT += macextras gui-private
LIBS += -framework Foundation -framework ApplicationServices -framework AppKit
OBJECTIVE_SOURCES += ../common/pdf_comic.mm
}
QT += network widgets core
@ -167,7 +120,7 @@ HEADERS += ../common/comic.h \
../common/exit_check.h \
../common/scroll_management.h \
../common/opengl_checker.h \
../common/pdf_comic.h
../common/pdf_comic.h
!CONFIG(no_opengl) {
CONFIG(legacy_gl_widget) {
@ -214,10 +167,6 @@ SOURCES += ../common/comic.cpp \
../common/scroll_management.cpp \
../common/opengl_checker.cpp
CONFIG(pdfium) {
SOURCES+= ../common/pdf_comic.cpp
}
!CONFIG(no_opengl) {
CONFIG(legacy_gl_widget) {
message("using legacy YACReaderFlowGL (QGLWidget) source code")
@ -310,4 +259,4 @@ manpage.files = ../YACReader.1
#remove leftover doc files when 'make clean' is invoked
QMAKE_CLEAN += "../changelog" "../README"
}
}

View File

@ -17,6 +17,7 @@ DEFINES += SERVER_RELEASE NOMINMAX YACREADER_LIBRARY
QMAKE_MAC_SDK = macosx10.12
#load default build flags
include (../config.pri)
include (../dependencies/pdf_backend.pri)
CONFIG(legacy_gl_widget) {
INCLUDEPATH += ../common/gl_legacy \
@ -28,30 +29,13 @@ CONFIG(legacy_gl_widget) {
win32 {
CONFIG(force_angle) {
message("using ANGLE")
LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32 -lshell32 -lopengl32 -lglu32 -luser32
LIBS += -loleaut32 -lole32 -lshell32 -lopengl32 -lglu32 -luser32
#linking extra libs are necesary for a successful compilation, a better approach should be
#to remove any OpenGL (desktop) dependencies
#the OpenGL stuff should be migrated to OpenGL ES
DEFINES += FORCE_ANGLE
} else {
LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32 -lshell32 -lopengl32 -lglu32 -luser32
}
!CONFIG(no_pdf) {
!CONFIG(pdfium) {
LIBS += -lpoppler-qt5
INCLUDEPATH += ../dependencies/poppler/include/qt5
} else {
DEFINES += "USE_PDFIUM"
contains(QMAKE_TARGET.arch, x86_64): {
LIBS += -L$$PWD/../dependencies/pdfium/x64 -lpdfium
} else {
LIBS += -L$$PWD/../dependencies/pdfium/x86 -lpdfium
}
INCLUDEPATH += ../dependencies/pdfium/public
}
} else {
DEFINES += "NO_PDF"
LIBS += -loleaut32 -lole32 -lshell32 -lopengl32 -lglu32 -luser32
}
QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT /GL
@ -60,27 +44,9 @@ win32 {
}
unix:!macx{
!CONFIG(no_pdf){
!CONFIG(pdfium){
INCLUDEPATH += /usr/include/poppler/qt5
LIBS += -L/usr/lib -lpoppler-qt5
} else {
DEFINES += "USE_PDFIUM"
INCLUDEPATH += /usr/include/pdfium
LIBS += -L/usr/lib/pdfium -lfreetype
#static pdfium libraries have to be included *before* dynamic libraries
#LIBS += -L/usr/lib/pdfium -Wl,--start-group -lpdfium -lfpdfapi -lfxge -lfpdfdoc \
# -lfxcrt -lfx_agg -lfxcodec -lfx_lpng -lfx_libopenjpeg -lfx_lcms2 -ljpeg \
# -lfx_zlib -lfdrm -lfxedit -lformfiller -lpdfwindow -lpdfium -lbigint -ljavascript \
# -lfxedit -Wl,--end-group -lfreetype
}
} else {
DEFINES += "NO_PDF"
}
!CONFIG(no_opengl) {
LIBS += -lGLU
LIBS += -lGLU
}
}
@ -96,16 +62,8 @@ macx{
#}
#QT += macextras
!CONFIG(no_pdf){
#TODO:support for pdfium on mac
DEFINES += "USE_PDFKIT"
} else {
DEFINES += "NO_PDF"
}
LIBS += -framework Foundation -framework ApplicationServices -framework AppKit
OBJECTIVE_SOURCES += $$PWD/../common/pdf_comic.mm
CONFIG += objective_c
QT += macextras gui-private
}
@ -261,11 +219,6 @@ SOURCES += comic_flow.cpp \
yacreader_comics_selection_helper.cpp \
yacreader_comic_info_helper.cpp
CONFIG(pdfium) {
SOURCES += ../common/pdf_comic.cpp
}
!CONFIG(no_opengl) {
CONFIG(legacy_gl_widget) {
message("using legacy YACReaderFlowGL (QGLWidget) source code")

View File

@ -16,69 +16,22 @@ QMAKE_MAC_SDK = macosx10.12
#load default build flags
#do a basic dependency check
include(headless_config.pri)
include(../dependencies/pdf_backend.pri)
win32 {
LIBS += -L../dependencies/poppler/lib -loleaut32 -lole32 -lshell32 -luser32
!CONFIG(no_pdf) {
!CONFIG(pdfium) {
LIBS += -lpoppler-qt5
INCLUDEPATH += ../dependencies/poppler/include/qt5
} else {
DEFINES += "USE_PDFIUM"
contains(QMAKE_TARGET.arch, x86_64): {
LIBS += -L$$PWD/../dependencies/pdfium/x64 -lpdfium
} else {
LIBS += -L$$PWD/../dependencies/pdfium/x86 -lpdfium
}
INCLUDEPATH += ../dependencies/pdfium/public
}
} else {
DEFINES += "NO_PDF"
}
LIBS += -loleaut32 -lole32 -lshell32 -luser32
QMAKE_CXXFLAGS_RELEASE += /MP /Ob2 /Oi /Ot /GT /GL
QMAKE_LFLAGS_RELEASE += /LTCG
CONFIG -= embed_manifest_exe
}
unix:!macx{
!CONFIG(no_pdf){
!CONFIG(pdfium){
INCLUDEPATH += /usr/include/poppler/qt5
LIBS += -L/usr/lib -lpoppler-qt5
} else {
#static pdfium libraries have to be included *before* dynamic libraries
DEFINES += "USE_PDFIUM"
INCLUDEPATH += /usr/include/pdfium
LIBS += -L/usr/lib/pdfium -lfreetype
#static pdfium libraries have to be included *before* dynamic libraries
#LIBS += -L/usr/lib/pdfium -Wl,--start-group -lpdfium -lfpdfapi -lfxge -lfpdfdoc \
# -lfxcrt -lfx_agg -lfxcodec -lfx_lpng -lfx_libopenjpeg -lfx_lcms2 -ljpeg \
# -lfx_zlib -lfdrm -lfxedit -lformfiller -lpdfwindow -lpdfium -lbigint -ljavascript \
# -lfxedit -Wl,--end-group -lfreetype
}
} else {
DEFINES += "NO_PDF"
}
}
macx{
#TODO:support for pdfium on mac
!CONFIG(no_pdf) {
DEFINES += "USE_PDFKIT"
} else {
DEFINES += "NO_PDF"
macx {
LIBS += -framework Foundation -framework ApplicationServices -framework AppKit
CONFIG += objective_c
}
LIBS += -framework Foundation -framework ApplicationServices -framework AppKit
OBJECTIVE_SOURCES += $$PWD/../common/pdf_comic.mm
CONFIG += objective_c
}
unix{
CONFIG += c++11
unix {
CONFIG += c++11
}
#CONFIG += release
@ -95,7 +48,7 @@ HEADERS += ../YACReaderLibrary/library_creator.h \
../common/folder.h \
../common/library_item.h \
../common/comic.h \
../common/pdf_comic.h \
../common/pdf_comic.h \
../common/bookmarks.h \
../common/qnaturalsorting.h \
../common/yacreader_global.h \
@ -127,11 +80,6 @@ SOURCES += ../YACReaderLibrary/library_creator.cpp \
console_ui_library_creator.cpp \
main.cpp
CONFIG(pdfium) {
SOURCES += ../common/pdf_comic.cpp
}
include(../YACReaderLibrary/server/server.pri)
CONFIG(7zip){
include(../compressed_archive/wrapper.pri)
@ -182,7 +130,7 @@ else:CONFIG(server_bundled) {
else {
INSTALLS += bin server translation
message("No build type specified. Defaulting to standalone server build (CONFIG+=server_standalone).")
message("If you wish to run YACReaderLibraryServer on a system with an existing install of YACReaderLibrary, please specify CONFIG+=server_bundled as an option when running qmake.")
message("If you wish to run YACReaderLibraryServer on a system with an existing install of YACReaderLibrary, please specify CONFIG+=server_bundled as an option when running qmake.")
}
bin.path = $$BINDIR
@ -200,4 +148,4 @@ translation.files = ../release/languages/yacreaderlibrary_*
#manpage.path = $$DATADIR/man/man1
#manpage.files = ../YACReaderLibrary.1
}
}

View File

@ -8,26 +8,7 @@ QT_VERSION = $$split(QT_VERSION, ".")
QT_VER_MAJ = $$member(QT_VERSION, 0)
QT_VER_MIN = $$member(QT_VERSION, 1)
lessThan(QT_VER_MAJ, 5) {
error(YACReader requires Qt 5 or newer but Qt $$[QT_VERSION] was detected.)
}
lessThan(QT_VER_MIN, 3){
error ("You need at least Qt 5.3 to build YACReader or YACReaderLibrary")
}
!CONFIG(unarr):!CONFIG(7zip) {
unix {
!macx {
CONFIG+=unarr
}
else {
CONFIG+=7zip
}
}
win32 {
CONFIG+=7zip
}
}
include (../config.pri)
unix {
!macx {
@ -68,4 +49,4 @@ unix {
message("Missing dependency: sqlite3")
}
}
}
}

View File

@ -4,11 +4,14 @@ rm -R *.app
rm -R YACReader-*
rm -R *.dmg
cd YACReader
make clean
make distclean
rm -R YACReader.app
cd ..
cd YACReaderLibrary
make clean
make distclean
rm -R YACReaderLibrary.app
cd ..
cd YACReaderLibraryServer
make distclean
rm -R YACReaderLibraryServer.app
cd ..

View File

@ -1,52 +1,56 @@
#! /bin/bash
if [ $2 == "clean" ]; then
VERSION=${1:-"8.6.0"}
if [ "$2" == "clean" ]; then
./cleanOSX.sh
fi
hash qmake 2>/dev/null || { echo >&2 "Qmake command not available. Please add the bin subfolder of your Qt installation to the PATH environment variable."; exit 1; }
echo "Compiling YACReader"
cd ./YACReader
/Users/luisangel/my_dev/Qt5.5.1/5.5/clang_64/bin/qmake YACReader.pro -spec macx-clang "CONFIG+=release"
cd YACReader
qmake
make
cd ..
echo "Compiling YACReaderLibrary"
cd ./YACReaderLibrary
/Users/luisangel/my_dev/Qt5.5.1/5.5/clang_64/bin/qmake YACReaderLibrary.pro -spec macx-clang "CONFIG+=release"
cd YACReaderLibrary
qmake
make
cd ..
echo "Compiling YACReaderLibraryServer"
cd ./YACReaderLibrary
make clean
/Users/luisangel/my_dev/Qt5.5.1/5.5/clang_64/bin/qmake YACReaderLibraryServer.pro -spec macx-clang "CONFIG+=release"
cd YACReaderLibraryServer
qmake
make
cd ..
echo "Configuring release apps"
cp -R ./YACReader/YACReader.app ./YACReader.app
cp -R ./YACReaderLibrary/YACReaderLibrary.app ./YACReaderLibrary.app
cp -R ./YACReaderLibrary/YACReaderLibraryServer.app ./YACReaderLibraryServer.app
cp -R YACReader/YACReader.app YACReader.app
cp -R YACReaderLibrary/YACReaderLibrary.app YACReaderLibrary.app
cp -R YACReaderLibraryServer/YACReaderLibraryServer.app YACReaderLibraryServer.app
./releaseOSX.sh
echo "Copying to destination folder"
dest='YACReader-'$1' MacOSX-Intel'
mkdir "$dest"
cp -R ./YACReader.app "./${dest}/YACReader.app"
cp -R ./YACReaderLibrary.app "./${dest}/YACReaderLibrary.app"
cp -R ./YACReaderLibraryServer.app "./${dest}/YACReaderLibraryServer"
dest="YACReader-$VERSION MacOSX-Intel"
mkdir -p "$dest"
cp -R YACReader.app "${dest}/YACReader.app"
cp -R YACReaderLibrary.app "${dest}/YACReaderLibrary.app"
cp -R YACReaderLibraryServer.app "${dest}/YACReaderLibraryServer"
cp ./COPYING.txt "./${dest}/"
cp ./README.txt "./${dest}/"
cp COPYING.txt "${dest}/"
cp README.txt "${dest}/"
#mkdir "./${dest}/icons/"
#cp ./images/db.png "./${dest}/icons/"
#cp ./images/coversPackage.png "./${dest}/icons/"
#mkdir -p "${dest}/icons/"
#cp images/db.png "${dest}/icons/"
#cp images/coversPackage.png "${dest}/icons/"
echo "Creating dmg package"
#tar -czf "${dest}".tar.gz "${dest}"
#hdiutil create "${dest}".dmg -srcfolder "./${dest}" -ov
./create-dmg --volname 'YACReader '$1' Installer' --volicon icon.icns --window-size 600 403 --icon-size 128 --app-drop-link 485 90 --background background.png --icon YACReader 80 90 --icon YACReaderLibrary 235 90 --eula COPYING.txt --icon YACReaderLibraryServer 470 295 --icon README.txt 120 295 --icon COPYING.txt 290 295 "./${dest}.dmg" "./${dest}"
./dependencies/create-dmg/create-dmg --volname "YACReader $VERSION Installer" --volicon icon.icns --window-size 600 403 --icon-size 128 --app-drop-link 485 90 --background background.png --icon YACReader 80 90 --icon YACReaderLibrary 235 90 --eula COPYING.txt --icon YACReaderLibraryServer 470 295 --icon README.txt 120 295 --icon COPYING.txt 290 295 "$dest.dmg" "$dest"
echo "Done!"

View File

@ -6,7 +6,7 @@
#include "extract_delegate.h"
extern"C" {
#include "unarr.h"
#include <unarr.h>
}
CompressedArchive::CompressedArchive(const QString & filePath, QObject *parent) :

View File

@ -4,7 +4,7 @@
#include <QObject>
#include "extract_delegate.h"
extern"C" {
#include "unarr.h"
#include <unarr.h>
}
class CompressedArchive : public QObject

View File

@ -11,13 +11,17 @@ unix:!macx:exists (/usr/include/unarr.h) {
LIBS+=-lunarr
DEFINES+=use_unarr
}
else:macx:exists (../../dependencies/unarr/libunarr.dynlib) {
LIBS += -L../../dependencies/unarr/ -lunarr
else:macx:exists (../../dependencies/unarr/macx/libunarr.a) {
message(Found prebuilt unarr library in dependencies directory.)
INCLUDEPATH += $$PWD/../../dependencies/unarr/macx
LIBS += -L$$PWD/../../dependencies/unarr/macx -lunarr -lz -lbz2
DEFINES+=use_unarr
}
else:win32:exists (../../dependencies/unarr/unarr.dll) {
LIBS += -L../../dependencies/unarr/ -lunarr
else:win32:exists (../../dependencies/unarr/win/unarr.h) {
message(Found prebuilt unarr library in dependencies directory.)
INCLUDEPATH += $$PWD/../../dependencies/unarr/win
LIBS += -L../../dependencies/unarr/win/ -lunarr
DEFINES+=use_unarr
}
@ -33,4 +37,4 @@ else:exists ($$PWD/unarr-master) {
else {
error(Missing dependency: unarr decrompression backend. Please install libunarr on your system\
or provide a copy of the unarr source code in compressed_archive/unarr/unarr-master)
}
}

View File

@ -24,17 +24,25 @@ CONFIG(no_opengl) {
DEFINES += NO_OPENGL
}
#default values for decompression backends
!CONFIG(unarr):!CONFIG(7zip) {
unix {
!macx {
CONFIG+=unarr
}
else {
CONFIG+=7zip
}
CONFIG += unarr
}
win32 {
CONFIG+=7zip
}
}
CONFIG += 7zip
}
}
#default values for pdf render backend
win32:!CONFIG(poppler):!CONFIG(pdfium) {
CONFIG += pdfium
}
unix:!macx:!CONFIG(poppler):!CONFIG(pdfium) {
CONFIG += poppler
}
macx:!CONFIG(pdfkit):!CONFIG(pdfium) {
CONFIG += pdfium
}

View File

@ -1,221 +0,0 @@
#! /bin/bash
# Create a read-only disk image of the contents of a folder
set -e;
function pure_version() {
echo '1.0.0.2'
}
function version() {
echo "create-dmg $(pure_version)"
}
function usage() {
version
echo "Creates a fancy DMG file."
echo "Usage: $(basename $0) options... image.dmg source_folder"
echo "All contents of source_folder will be copied into the disk image."
echo "Options:"
echo " --volname name"
echo " set volume name (displayed in the Finder sidebar and window title)"
echo " --volicon icon.icns"
echo " set volume icon"
echo " --background pic.png"
echo " set folder background image (provide png, gif, jpg)"
echo " --window-pos x y"
echo " set position the folder window"
echo " --window-size width height"
echo " set size of the folder window"
echo " --icon-size icon_size"
echo " set window icons size (up to 128)"
echo " --icon file_name x y"
echo " set position of the file's icon"
echo " --hide-extension file_name"
echo " hide the extension of file"
echo " --custom-icon file_name custom_icon_or_sample_file x y"
echo " set position and custom icon"
echo " --app-drop-link x y"
echo " make a drop link to Applications, at location x,y"
echo " --eula eula_file"
echo " attach a license file to the dmg"
echo " --no-internet-enable"
echo " disable automatic mount&copy"
echo " --version show tool version number"
echo " -h, --help display this help"
exit 0
}
WINX=10
WINY=60
WINW=500
WINH=350
ICON_SIZE=128
while test "${1:0:1}" = "-"; do
case $1 in
--volname)
VOLUME_NAME="$2"
shift; shift;;
--volicon)
VOLUME_ICON_FILE="$2"
shift; shift;;
--background)
BACKGROUND_FILE="$2"
BACKGROUND_FILE_NAME="$(basename $BACKGROUND_FILE)"
BACKGROUND_CLAUSE="set background picture of opts to file \".background:$BACKGROUND_FILE_NAME\""
shift; shift;;
--icon-size)
ICON_SIZE="$2"
shift; shift;;
--window-pos)
WINX=$2; WINY=$3
shift; shift; shift;;
--window-size)
WINW=$2; WINH=$3
shift; shift; shift;;
--icon)
POSITION_CLAUSE="${POSITION_CLAUSE}set position of item \"$2\" to {$3, $4}
"
shift; shift; shift; shift;;
--hide-extension)
HIDING_CLAUSE="${HIDING_CLAUSE}set the extension hidden of item \"$2\" to true"
shift; shift;;
--custom-icon)
shift; shift; shift; shift; shift;;
-h | --help)
usage;;
--version)
version; exit 0;;
--pure-version)
pure_version; exit 0;;
--app-drop-link)
APPLICATION_LINK=$2
APPLICATION_CLAUSE="set position of item \"Applications\" to {$2, $3}
"
shift; shift; shift;;
--eula)
EULA_RSRC=$2
shift; shift;;
--no-internet-enable)
NOINTERNET=1
shift;;
-*)
echo "Unknown option $1. Run with --help for help."
exit 1;;
esac
done
test -z "$2" && {
echo "Not enough arguments. Invoke with --help for help."
exit 1
}
DMG_PATH="$1"
DMG_DIRNAME="$(dirname "$DMG_PATH")"
DMG_DIR="$(cd $DMG_DIRNAME > /dev/null; pwd)"
DMG_NAME="$(basename "$DMG_PATH")"
DMG_TEMP_NAME="$DMG_DIR/rw.${DMG_NAME}"
SRC_FOLDER="$(cd "$2" > /dev/null; pwd)"
test -z "$VOLUME_NAME" && VOLUME_NAME="$(basename "$DMG_PATH" .dmg)"
AUX_PATH="$(dirname $0)/support"
test -d "$AUX_PATH" || {
echo "Cannot find support directory: $AUX_PATH"
exit 1
}
if [ -f "$SRC_FOLDER/.DS_Store" ]; then
echo "Deleting any .DS_Store in source folder"
rm "$SRC_FOLDER/.DS_Store"
fi
# Create the image
echo "Creating disk image..."
test -f "${DMG_TEMP_NAME}" && rm -f "${DMG_TEMP_NAME}"
ACTUAL_SIZE=`du -sm "$SRC_FOLDER" | sed -e 's/ .*//g'`
DISK_IMAGE_SIZE=$(expr $ACTUAL_SIZE + 20)
hdiutil create -srcfolder "$SRC_FOLDER" -volname "${VOLUME_NAME}" -fs HFS+ -fsargs "-c c=64,a=16,e=16" -format UDRW -size ${DISK_IMAGE_SIZE}m "${DMG_TEMP_NAME}"
# mount it
echo "Mounting disk image..."
MOUNT_DIR="/Volumes/${VOLUME_NAME}"
# try unmount dmg if it was mounted previously (e.g. developer mounted dmg, installed app and forgot to unmount it)
echo "Unmounting disk image..."
DEV_NAME=$(hdiutil info | egrep '^/dev/' | sed 1q | awk '{print $1}')
test -d "${MOUNT_DIR}" && hdiutil detach "${DEV_NAME}"
echo "Mount directory: $MOUNT_DIR"
DEV_NAME=$(hdiutil attach -readwrite -noverify -noautoopen "${DMG_TEMP_NAME}" | egrep '^/dev/' | sed 1q | awk '{print $1}')
echo "Device name: $DEV_NAME"
if ! test -z "$BACKGROUND_FILE"; then
echo "Copying background file..."
test -d "$MOUNT_DIR/.background" || mkdir "$MOUNT_DIR/.background"
cp "$BACKGROUND_FILE" "$MOUNT_DIR/.background/$BACKGROUND_FILE_NAME"
fi
if ! test -z "$APPLICATION_LINK"; then
echo "making link to Applications dir"
echo $MOUNT_DIR
ln -s /Applications "$MOUNT_DIR/Applications"
fi
if ! test -z "$VOLUME_ICON_FILE"; then
echo "Copying volume icon file '$VOLUME_ICON_FILE'..."
cp "$VOLUME_ICON_FILE" "$MOUNT_DIR/.VolumeIcon.icns"
SetFile -c icnC "$MOUNT_DIR/.VolumeIcon.icns"
fi
# run applescript
APPLESCRIPT=$(mktemp -t createdmg)
cat "$AUX_PATH/template.applescript" | sed -e "s/WINX/$WINX/g" -e "s/WINY/$WINY/g" -e "s/WINW/$WINW/g" -e "s/WINH/$WINH/g" -e "s/BACKGROUND_CLAUSE/$BACKGROUND_CLAUSE/g" -e "s/ICON_SIZE/$ICON_SIZE/g" | perl -pe "s/POSITION_CLAUSE/$POSITION_CLAUSE/g" | perl -pe "s/APPLICATION_CLAUSE/$APPLICATION_CLAUSE/g" | perl -pe "s/HIDING_CLAUSE/$HIDING_CLAUSE/" >"$APPLESCRIPT"
echo "Running Applescript: /usr/bin/osascript \"${APPLESCRIPT}\" \"${VOLUME_NAME}\""
"/usr/bin/osascript" "${APPLESCRIPT}" "${VOLUME_NAME}" || true
echo "Done running the applescript..."
sleep 4
rm "$APPLESCRIPT"
# make sure it's not world writeable
echo "Fixing permissions..."
chmod -Rf go-w "${MOUNT_DIR}" &> /dev/null || true
echo "Done fixing permissions."
# make the top window open itself on mount:
echo "Blessing started"
bless --folder "${MOUNT_DIR}" --openfolder "${MOUNT_DIR}"
echo "Blessing finished"
if ! test -z "$VOLUME_ICON_FILE"; then
# tell the volume that it has a special file attribute
SetFile -a C "$MOUNT_DIR"
fi
# unmount
echo "Unmounting disk image..."
hdiutil detach "${DEV_NAME}"
# compress image
echo "Compressing disk image..."
hdiutil convert "${DMG_TEMP_NAME}" -format UDZO -imagekey zlib-level=9 -o "${DMG_DIR}/${DMG_NAME}"
rm -f "${DMG_TEMP_NAME}"
# adding EULA resources
if [ ! -z "${EULA_RSRC}" -a "${EULA_RSRC}" != "-null-" ]; then
echo "adding EULA resources"
"${AUX_PATH}/dmg-license.py" "${DMG_DIR}/${DMG_NAME}" "${EULA_RSRC}"
fi
if [ ! -z "${NOINTERNET}" -a "${NOINTERNET}" == 1 ]; then
echo "not setting 'internet-enable' on the dmg"
else
hdiutil internet-enable -yes "${DMG_DIR}/${DMG_NAME}"
fi
echo "Disk image done"
exit 0

56
dependencies/pdf_backend.pri vendored Normal file
View File

@ -0,0 +1,56 @@
CONFIG(no_pdf) {
DEFINES += "NO_PDF"
}
CONFIG(pdfium) {
DEFINES += "USE_PDFIUM"
SOURCES += ../common/pdf_comic.cpp
win32 {
INCLUDEPATH += $$PWD/pdfium/win/public
contains(QMAKE_TARGET.arch, x86_64): {
LIBS += -L$$PWD/pdfium/win/x64 -lpdfium
} else {
LIBS += -L$$PWD/pdfium/win/x86 -lpdfium
}
}
unix {
macx {
LIBS += -L$$PWD/pdfium/macx/bin -lpdfium
INCLUDEPATH += $$PWD/pdfium/macx/include
}
!macx {
INCLUDEPATH += /usr/include/pdfium
LIBS += -L/usr/lib/pdfium -lpdfium -lfreetype
}
}
}
CONFIG(pdfkit) {
!macx {
error (Pdfkit is macOS only)
} else {
DEFINES += "USE_PDFKIT"
OBJECTIVE_SOURCES += ../common/pdf_comic.mm
}
}
CONFIG(poppler) {
win32 {
contains(QMAKE_TARGET.arch, x86_64): {
error ("We currently don't ship precompiled poppler libraries for 64 bit builds")
}
INCLUDEPATH += $$PWD/poppler/include/qt5
LIBS += -L$$PWD/poppler/lib -lpoppler-qt5
#Add extra paths for dll dependencies so the executables don't crash when launching
#from QtCreator
LIBS += -L$$PWD/poppler/bin
LIBS += -L$$PWD/poppler/dependencies/bin
}
unix:!macx {
INCLUDEPATH += /usr/include/poppler/qt5
LIBS += -L/usr/lib -lpoppler-qt5
}
unix:macx {
error (Poppler backend is currently not supported on macOS)
}
}

18
dependencies/pdfium/macx/VERSION vendored Normal file
View File

@ -0,0 +1,18 @@
YACReader for macOS uses a precompiled single static library version of pdfium.
pdfium branch used for building: chromium/3071 (current beta)
build parameters used (gn args):
pdf_enable_xfa = false
pdf_enable_v8 = false
pdf_is_complete_lib = true
is_official_build = true
symbol_level = 0
Instructions on building pdfium can be found at https://pdfium.googlesource.com/pdfium
It is recommended to always use the branch the current stable version of chromium uses.
To get the pdfium branch corresponding to Chromium stable, look at
http://omahaproxy.appspot.com and search for the true_branch variable associated with
the current stable dev channel of Chromium.

BIN
dependencies/pdfium/macx/bin/libpdfium.a vendored Normal file

Binary file not shown.

View File

@ -0,0 +1,46 @@
// Copyright 2017 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef PUBLIC_CPP_FPDF_DELETERS_H_
#define PUBLIC_CPP_FPDF_DELETERS_H_
#include "public/fpdf_dataavail.h"
#include "public/fpdf_formfill.h"
#include "public/fpdf_structtree.h"
#include "public/fpdf_text.h"
#include "public/fpdfview.h"
// Custom deleters for using FPDF_* types with std::unique_ptr<>.
struct FPDFAvailDeleter {
inline void operator()(FPDF_AVAIL avail) { FPDFAvail_Destroy(avail); }
};
struct FPDFBitmapDeleter {
inline void operator()(FPDF_BITMAP bitmap) { FPDFBitmap_Destroy(bitmap); }
};
struct FPDFDocumentDeleter {
inline void operator()(FPDF_DOCUMENT doc) { FPDF_CloseDocument(doc); }
};
struct FPDFFormHandleDeleter {
inline void operator()(FPDF_FORMHANDLE form) {
FPDFDOC_ExitFormFillEnvironment(form);
}
};
struct FPDFTextPageDeleter {
inline void operator()(FPDF_TEXTPAGE text) { FPDFText_ClosePage(text); }
};
struct FPDFPageDeleter {
inline void operator()(FPDF_PAGE page) { FPDF_ClosePage(page); }
};
struct FPDFStructTreeDeleter {
inline void operator()(FPDF_STRUCTTREE tree) { FPDF_StructTree_Close(tree); }
};
#endif // PUBLIC_CPP_FPDF_DELETERS_H_

View File

@ -0,0 +1,466 @@
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#ifndef PUBLIC_FPDF_EDIT_H_
#define PUBLIC_FPDF_EDIT_H_
#include <stdint.h>
// NOLINTNEXTLINE(build/include)
#include "fpdfview.h"
#define FPDF_ARGB(a, r, g, b) \
((uint32_t)(((uint32_t)(b)&0xff) | (((uint32_t)(g)&0xff) << 8) | \
(((uint32_t)(r)&0xff) << 16) | (((uint32_t)(a)&0xff) << 24)))
#define FPDF_GetBValue(argb) ((uint8_t)(argb))
#define FPDF_GetGValue(argb) ((uint8_t)(((uint16_t)(argb)) >> 8))
#define FPDF_GetRValue(argb) ((uint8_t)((argb) >> 16))
#define FPDF_GetAValue(argb) ((uint8_t)((argb) >> 24))
// The page object constants.
#define FPDF_PAGEOBJ_UNKNOWN 0
#define FPDF_PAGEOBJ_TEXT 1
#define FPDF_PAGEOBJ_PATH 2
#define FPDF_PAGEOBJ_IMAGE 3
#define FPDF_PAGEOBJ_SHADING 4
#define FPDF_PAGEOBJ_FORM 5
#define FPDF_FILLMODE_ALTERNATE 1
#define FPDF_FILLMODE_WINDING 2
#define FPDF_FONT_TYPE1 1
#define FPDF_FONT_TRUETYPE 2
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
// Create a new PDF document.
//
// Returns a handle to a new document, or NULL on failure.
DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_CreateNewDocument();
// Create a new PDF page.
//
// document - handle to document.
// page_index - suggested index of the page to create. If it is larger than
// document's current last index(L), the created page index is
// the next available index -- L+1.
// width - the page width.
// height - the page height.
//
// Returns the handle to the new page.
//
// The page should be closed with CPDF_ClosePage() when finished as
// with any other page in the document.
DLLEXPORT FPDF_PAGE STDCALL FPDFPage_New(FPDF_DOCUMENT document,
int page_index,
double width,
double height);
// Delete the page at |page_index|.
//
// document - handle to document.
// page_index - the index of the page to delete.
DLLEXPORT void STDCALL FPDFPage_Delete(FPDF_DOCUMENT document, int page_index);
// Get the rotation of |page|.
//
// page - handle to a page
//
// Returns one of the following indicating the page rotation:
// 0 - No rotation.
// 1 - Rotated 90 degrees clockwise.
// 2 - Rotated 180 degrees clockwise.
// 3 - Rotated 270 degrees clockwise.
DLLEXPORT int STDCALL FPDFPage_GetRotation(FPDF_PAGE page);
// Set rotation for |page|.
//
// page - handle to a page.
// rotate - the rotation value, one of:
// 0 - No rotation.
// 1 - Rotated 90 degrees clockwise.
// 2 - Rotated 180 degrees clockwise.
// 3 - Rotated 270 degrees clockwise.
DLLEXPORT void STDCALL FPDFPage_SetRotation(FPDF_PAGE page, int rotate);
// Insert |page_obj| into |page|.
//
// page - handle to a page
// page_obj - handle to a page object. The |page_obj| will be automatically
// freed.
DLLEXPORT void STDCALL FPDFPage_InsertObject(FPDF_PAGE page,
FPDF_PAGEOBJECT page_obj);
// Get number of page objects inside |page|.
//
// page - handle to a page.
//
// Returns the number of objects in |page|.
DLLEXPORT int STDCALL FPDFPage_CountObject(FPDF_PAGE page);
// Get object in |page| at |index|.
//
// page - handle to a page.
// index - the index of a page object.
//
// Returns the handle to the page object, or NULL on failed.
DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPage_GetObject(FPDF_PAGE page, int index);
// Checks if |page| contains transparency.
//
// page - handle to a page.
//
// Returns TRUE if |page| contains transparency.
DLLEXPORT FPDF_BOOL STDCALL FPDFPage_HasTransparency(FPDF_PAGE page);
// Generate the content of |page|.
//
// page - handle to a page.
//
// Returns TRUE on success.
//
// Before you save the page to a file, or reload the page, you must call
// |FPDFPage_GenerateContent| or any changes to |page| will be lost.
DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GenerateContent(FPDF_PAGE page);
// Checks if |pageObject| contains transparency.
//
// pageObject - handle to a page object.
//
// Returns TRUE if |pageObject| contains transparency.
DLLEXPORT FPDF_BOOL STDCALL
FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT pageObject);
// Get type of |pageObject|.
//
// pageObject - handle to a page object.
//
// Returns one of the FPDF_PAGEOBJ_* values on success, FPDF_PAGEOBJ_UNKNOWN on
// error.
DLLEXPORT int STDCALL FPDFPageObj_GetType(FPDF_PAGEOBJECT pageObject);
// Transform |pageObject| by the given matrix.
//
// page_object - handle to a page object.
// a - matrix value.
// b - matrix value.
// c - matrix value.
// d - matrix value.
// e - matrix value.
// f - matrix value.
//
// The matrix is composed as:
// |a c e|
// |b d f|
// and can be used to scale, rotate, shear and translate the |page_object|.
DLLEXPORT void STDCALL FPDFPageObj_Transform(FPDF_PAGEOBJECT page_object,
double a,
double b,
double c,
double d,
double e,
double f);
// Transform all annotations in |page|.
//
// page - handle to a page.
// a - matrix value.
// b - matrix value.
// c - matrix value.
// d - matrix value.
// e - matrix value.
// f - matrix value.
//
// The matrix is composed as:
// |a c e|
// |b d f|
// and can be used to scale, rotate, shear and translate the |page| annotations.
DLLEXPORT void STDCALL FPDFPage_TransformAnnots(FPDF_PAGE page,
double a,
double b,
double c,
double d,
double e,
double f);
// Create a new image object.
//
// document - handle to a document.
//
// Returns a handle to a new image object.
DLLEXPORT FPDF_PAGEOBJECT STDCALL
FPDFPageObj_NewImageObj(FPDF_DOCUMENT document);
// Create a new image object.
// DEPRECATED. Please use FPDFPageObj_NewImageObj() above.
//
// document - handle to a document.
//
// Returns a handle to a new image object.
DLLEXPORT FPDF_PAGEOBJECT STDCALL
FPDFPageObj_NewImgeObj(FPDF_DOCUMENT document);
// Load an image from a JPEG image file and then set it into |image_object|.
//
// pages - pointer to the start of all loaded pages, may be NULL.
// nCount - number of |pages|, may be 0.
// image_object - handle to an image object.
// fileAccess - file access handler which specifies the JPEG image file.
//
// Returns TRUE on success.
//
// The image object might already have an associated image, which is shared and
// cached by the loaded pages. In that case, we need to clear the cached image
// for all the loaded pages. Pass |pages| and page count (|nCount|) to this API
// to clear the image cache. If the image is not previously shared, or NULL is a
// valid |pages| value.
DLLEXPORT FPDF_BOOL STDCALL
FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages,
int nCount,
FPDF_PAGEOBJECT image_object,
FPDF_FILEACCESS* fileAccess);
// Load an image from a JPEG image file and then set it into |image_object|.
//
// pages - pointer to the start of all loaded pages, may be NULL.
// nCount - number of |pages|, may be 0.
// image_object - handle to an image object.
// fileAccess - file access handler which specifies the JPEG image file.
//
// Returns TRUE on success.
//
// The image object might already have an associated image, which is shared and
// cached by the loaded pages. In that case, we need to clear the cached image
// for all the loaded pages. Pass |pages| and page count (|nCount|) to this API
// to clear the image cache. If the image is not previously shared, or NULL is a
// valid |pages| value. This function loads the JPEG image inline, so the image
// content is copied to the file. This allows |fileAccess| and its associated
// data to be deleted after this function returns.
DLLEXPORT FPDF_BOOL STDCALL
FPDFImageObj_LoadJpegFileInline(FPDF_PAGE* pages,
int nCount,
FPDF_PAGEOBJECT image_object,
FPDF_FILEACCESS* fileAccess);
// Set the transform matrix of |image_object|.
//
// image_object - handle to an image object.
// a - matrix value.
// b - matrix value.
// c - matrix value.
// d - matrix value.
// e - matrix value.
// f - matrix value.
//
// The matrix is composed as:
// |a c e|
// |b d f|
// and can be used to scale, rotate, shear and translate the |page| annotations.
//
// Returns TRUE on success.
DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetMatrix(FPDF_PAGEOBJECT image_object,
double a,
double b,
double c,
double d,
double e,
double f);
// Set |bitmap| to |image_object|.
//
// pages - pointer to the start of all loaded pages, may be NULL.
// nCount - number of |pages|, may be 0.
// image_object - handle to an image object.
// bitmap - handle of the bitmap.
//
// Returns TRUE on success.
DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetBitmap(FPDF_PAGE* pages,
int nCount,
FPDF_PAGEOBJECT image_object,
FPDF_BITMAP bitmap);
// Create a new path object at an initial position.
//
// x - initial horizontal position.
// y - initial vertical position.
//
// Returns a handle to a new path object.
DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPageObj_CreateNewPath(float x, float y);
// Create a closed path consisting of a rectangle.
//
// x - horizontal position for the left boundary of the rectangle.
// y - vertical position for the bottom boundary of the rectangle.
// w - width of the rectangle.
// h - height of the rectangle.
//
// Returns a handle to the new path object.
DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPageObj_CreateNewRect(float x,
float y,
float w,
float h);
// Set the stroke RGBA of a path. Range of values: 0 - 255.
//
// path - the handle to the path object.
// R - the red component for the path stroke color.
// G - the green component for the path stroke color.
// B - the blue component for the path stroke color.
// A - the stroke alpha for the path.
//
// Returns TRUE on success.
DLLEXPORT FPDF_BOOL FPDFPath_SetStrokeColor(FPDF_PAGEOBJECT path,
unsigned int R,
unsigned int G,
unsigned int B,
unsigned int A);
// Set the stroke width of a path.
//
// path - the handle to the path object.
// width - the width of the stroke.
//
// Returns TRUE on success
DLLEXPORT FPDF_BOOL FPDFPath_SetStrokeWidth(FPDF_PAGEOBJECT path, float width);
// Set the fill RGBA of a path. Range of values: 0 - 255.
//
// path - the handle to the path object.
// R - the red component for the path fill color.
// G - the green component for the path fill color.
// B - the blue component for the path fill color.
// A - the fill alpha for the path.
//
// Returns TRUE on success.
DLLEXPORT FPDF_BOOL FPDFPath_SetFillColor(FPDF_PAGEOBJECT path,
unsigned int R,
unsigned int G,
unsigned int B,
unsigned int A);
// Get the fill RGBA of a path. Range of values: 0 - 255.
//
// path - the handle to the path object.
// R - the red component of the path fill color.
// G - the green component of the path fill color.
// B - the blue component of the path fill color.
// A - the fill alpha of the path.
//
// Returns TRUE on success.
DLLEXPORT FPDF_BOOL FPDFPath_GetFillColor(FPDF_PAGEOBJECT path,
unsigned int* R,
unsigned int* G,
unsigned int* B,
unsigned int* A);
// Move a path's current point.
//
// path - the handle to the path object.
// x - the horizontal position of the new current point.
// y - the vertical position of the new current point.
//
// Note that no line will be created between the previous current point and the
// new one.
//
// Returns TRUE on success
DLLEXPORT FPDF_BOOL FPDFPath_MoveTo(FPDF_PAGEOBJECT path, float x, float y);
// Add a line between the current point and a new point in the path.
//
// path - the handle to the path object.
// x - the horizontal position of the new point.
// y - the vertical position of the new point.
//
// The path's current point is changed to (x, y).
//
// Returns TRUE on success
DLLEXPORT FPDF_BOOL FPDFPath_LineTo(FPDF_PAGEOBJECT path, float x, float y);
// Add a cubic Bezier curve to the given path, starting at the current point.
//
// path - the handle to the path object.
// x1 - the horizontal position of the first Bezier control point.
// y1 - the vertical position of the first Bezier control point.
// x2 - the horizontal position of the second Bezier control point.
// y2 - the vertical position of the second Bezier control point.
// x3 - the horizontal position of the ending point of the Bezier curve.
// y3 - the vertical position of the ending point of the Bezier curve.
//
// Returns TRUE on success
DLLEXPORT FPDF_BOOL FPDFPath_BezierTo(FPDF_PAGEOBJECT path,
float x1,
float y1,
float x2,
float y2,
float x3,
float y3);
// Close the current subpath of a given path.
//
// path - the handle to the path object.
//
// This will add a line between the current point and the initial point of the
// subpath, thus terminating the current subpath.
//
// Returns TRUE on success
DLLEXPORT FPDF_BOOL FPDFPath_Close(FPDF_PAGEOBJECT path);
// Set the drawing mode of a path.
//
// path - the handle to the path object.
// fillmode - the filling mode to be set: 0 for no fill, 1 for alternate, 2 for
// winding.
// stroke - a boolean specifying if the path should be stroked or not.
//
// Returns TRUE on success
DLLEXPORT FPDF_BOOL FPDFPath_SetDrawMode(FPDF_PAGEOBJECT path,
int fillmode,
FPDF_BOOL stroke);
// Create a new text object using one of the standard PDF fonts.
//
// document - handle to the document.
// font - string containing the font name, without spaces.
// font_size - the font size for the new text object.
//
// Returns a handle to a new text object, or NULL on failure
DLLEXPORT FPDF_PAGEOBJECT STDCALL FPDFPageObj_NewTextObj(FPDF_DOCUMENT document,
FPDF_BYTESTRING font,
float font_size);
// Set the text for a textobject. If it had text, it will be replaced.
//
// text_object - handle to the text object.
// text - string containing the text to be added.
//
// Returns TRUE on success
DLLEXPORT FPDF_BOOL STDCALL FPDFText_SetText(FPDF_PAGEOBJECT text_object,
FPDF_BYTESTRING text);
// Returns a font object loaded from a stream of data. The font is loaded
// into the document. The caller does not need to free the returned object.
//
// document - handle to the document.
// data - the stream of data, which will be copied by the font object.
// size - size of the stream, in bytes.
// font_type - FPDF_FONT_TYPE1 or FPDF_FONT_TRUETYPE depending on the font
// type.
// cid - a boolean specifying if the font is a CID font or not.
//
// Returns NULL on failure
DLLEXPORT FPDF_FONT STDCALL FPDFText_LoadFont(FPDF_DOCUMENT document,
const uint8_t* data,
uint32_t size,
int font_type,
FPDF_BOOL cid);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#endif // PUBLIC_FPDF_EDIT_H_

View File

@ -0,0 +1,39 @@
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#ifndef PUBLIC_FPDF_SEARCHEX_H_
#define PUBLIC_FPDF_SEARCHEX_H_
// NOLINTNEXTLINE(build/include)
#include "fpdfview.h"
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
// Get the character index in |text_page| internal character list.
//
// text_page - a text page information structure.
// nTextIndex - index of the text returned from |FPDFText_GetText|.
//
// Returns the index of the character in internal character list. -1 for error.
DLLEXPORT int STDCALL
FPDFText_GetCharIndexFromTextIndex(FPDF_TEXTPAGE text_page, int nTextIndex);
// Get the text index in |text_page| internal character list.
//
// text_page - a text page information structure.
// nCharIndex - index of the character in internal character list.
//
// Returns the index of the text returned from |FPDFText_GetText|. -1 for error.
DLLEXPORT int STDCALL
FPDFText_GetTextIndexFromCharIndex(FPDF_TEXTPAGE text_page, int nCharIndex);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#endif // PUBLIC_FPDF_SEARCHEX_H_

View File

@ -0,0 +1,143 @@
// Copyright 2016 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#ifndef PUBLIC_FPDF_STRUCTTREE_H_
#define PUBLIC_FPDF_STRUCTTREE_H_
// NOLINTNEXTLINE(build/include)
#include "fpdfview.h"
#ifdef __cplusplus
extern "C" {
#endif
// Function: FPDF_StructTree_GetForPage
// Get the structure tree for a page.
// Parameters:
// page - Handle to the page. Returned by FPDF_LoadPage
// function.
// Return value:
// A handle to the structure tree or NULL on error.
DLLEXPORT FPDF_STRUCTTREE STDCALL FPDF_StructTree_GetForPage(FPDF_PAGE page);
// Function: FPDF_StructTree_Close
// Release the resource allocate by FPDF_StructTree_GetForPage.
// Parameters:
// struct_tree - Handle to the struct tree. Returned by
// FPDF_StructTree_LoadPage function.
// Return value:
// NULL
DLLEXPORT void STDCALL FPDF_StructTree_Close(FPDF_STRUCTTREE struct_tree);
// Function: FPDF_StructTree_CountChildren
// Count the number of children for the structure tree.
// Parameters:
// struct_tree - Handle to the struct tree. Returned by
// FPDF_StructTree_LoadPage function.
// Return value:
// The number of children, or -1 on error.
DLLEXPORT int STDCALL
FPDF_StructTree_CountChildren(FPDF_STRUCTTREE struct_tree);
// Function: FPDF_StructTree_GetChildAtIndex
// Get a child in the structure tree.
// Parameters:
// struct_tree - Handle to the struct tree. Returned by
// FPDF_StructTree_LoadPage function.
// index - The index for the child, 0-based.
// Return value:
// The child at the n-th index or NULL on error.
DLLEXPORT FPDF_STRUCTELEMENT STDCALL
FPDF_StructTree_GetChildAtIndex(FPDF_STRUCTTREE struct_tree, int index);
// Function: FPDF_StructElement_GetAltText
// Get the alt text for a given element.
// Parameters:
// struct_element - Handle to the struct element.
// buffer - A buffer for output the alt text. May be NULL.
// buflen - The length of the buffer, in bytes. May be 0.
// Return value:
// The number of bytes in the title, including the terminating NUL
// character. The number of bytes is returned regardless of the
// |buffer| and |buflen| parameters.
// Comments:
// Regardless of the platform, the |buffer| is always in UTF-16LE
// encoding. The string is terminated by a UTF16 NUL character. If
// |buflen| is less than the required length, or |buffer| is NULL,
// |buffer| will not be modified.
DLLEXPORT unsigned long STDCALL
FPDF_StructElement_GetAltText(FPDF_STRUCTELEMENT struct_element,
void* buffer,
unsigned long buflen);
// Function: FPDF_StructElement_GetType
// Get the type (/S) for a given element.
// Parameters:
// struct_element - Handle to the struct element.
// buffer - A buffer for output. May be NULL.
// buflen - The length of the buffer, in bytes. May be 0.
// Return value:
// The number of bytes in the type, including the terminating NUL
// character. The number of bytes is returned regardless of the
// |buffer| and |buflen| parameters.
// Comments:
// Regardless of the platform, the |buffer| is always in UTF-16LE
// encoding. The string is terminated by a UTF16 NUL character. If
// |buflen| is less than the required length, or |buffer| is NULL,
// |buffer| will not be modified.
DLLEXPORT unsigned long STDCALL
FPDF_StructElement_GetType(FPDF_STRUCTELEMENT struct_element,
void* buffer,
unsigned long buflen);
// Function: FPDF_StructElement_GetTitle
// Get the title (/T) for a given element.
// Parameters:
// struct_element - Handle to the struct element.
// buffer - A buffer for output. May be NULL.
// buflen - The length of the buffer, in bytes. May be 0.
// Return value:
// The number of bytes in the title, including the terminating NUL
// character. The number of bytes is returned regardless of the
// |buffer| and |buflen| parameters.
// Comments:
// Regardless of the platform, the |buffer| is always in UTF-16LE
// encoding. The string is terminated by a UTF16 NUL character. If
// |buflen| is less than the required length, or |buffer| is NULL,
// |buffer| will not be modified.
DLLEXPORT unsigned long STDCALL
FPDF_StructElement_GetTitle(FPDF_STRUCTELEMENT struct_element,
void* buffer,
unsigned long buflen);
// Function: FPDF_StructElement_CountChildren
// Count the number of children for the structure element.
// Parameters:
// struct_element - Handle to the struct element.
// Return value:
// The number of children, or -1 on error.
DLLEXPORT int STDCALL
FPDF_StructElement_CountChildren(FPDF_STRUCTELEMENT struct_element);
// Function: FPDF_StructElement_GetChildAtIndex
// Get a child in the structure element.
// Parameters:
// struct_tree - Handle to the struct element.
// index - The index for the child, 0-based.
// Return value:
// The child at the n-th index or NULL on error.
// Comments:
// If the child exists but is not an element, then this function will
// return NULL. This will also return NULL for out of bounds indices.
DLLEXPORT FPDF_STRUCTELEMENT STDCALL
FPDF_StructElement_GetChildAtIndex(FPDF_STRUCTELEMENT struct_element,
int index);
#ifdef __cplusplus
} // extern "C"
#endif
#endif // PUBLIC_FPDF_STRUCTTREE_H_

File diff suppressed because it is too large Load Diff

13
dependencies/pdfium/win/public/README vendored Normal file
View File

@ -0,0 +1,13 @@
public/ README
The header files in this directory are the only ones that should ever be
included by an embedder of PDFium. If there arises a need for functionality
beyond what is present here, then a new API must be added here to provide it.
These header files must be entirely contained in this directory; they must
never include other header files from outside of it.
These files must compile cleanly without warnings on both C and C++ compilers.
Changes to these files must be carefully considered to avoid breaking
compatibility.

View File

@ -0,0 +1,198 @@
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#ifndef PUBLIC_FPDF_DATAAVAIL_H_
#define PUBLIC_FPDF_DATAAVAIL_H_
#include <stddef.h>
// NOLINTNEXTLINE(build/include)
#include "fpdfview.h"
#define PDF_LINEARIZATION_UNKNOWN -1
#define PDF_NOT_LINEARIZED 0
#define PDF_LINEARIZED 1
#define PDF_DATA_ERROR -1
#define PDF_DATA_NOTAVAIL 0
#define PDF_DATA_AVAIL 1
#define PDF_FORM_ERROR -1
#define PDF_FORM_NOTAVAIL 0
#define PDF_FORM_AVAIL 1
#define PDF_FORM_NOTEXIST 2
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
// Interface for checking whether sections of the file are available.
typedef struct _FX_FILEAVAIL {
// Version number of the interface. Must be 1.
int version;
// Reports if the specified data section is currently available. A section is
// available if all bytes in the section are available.
//
// Interface Version: 1
// Implementation Required: Yes
//
// pThis - pointer to the interface structure.
// offset - the offset of the data section in the file.
// size - the size of the data section.
//
// Returns true if the specified data section at |offset| of |size|
// is available.
FPDF_BOOL (*IsDataAvail)(struct _FX_FILEAVAIL* pThis,
size_t offset,
size_t size);
} FX_FILEAVAIL;
typedef void* FPDF_AVAIL;
// Create a document availability provider.
//
// file_avail - pointer to file availability interface.
// file - pointer to a file access interface.
//
// Returns a handle to the document availability provider, or NULL on error.
//
// |FPDFAvail_Destroy| must be called when done with the availability provider.
DLLEXPORT FPDF_AVAIL STDCALL FPDFAvail_Create(FX_FILEAVAIL* file_avail,
FPDF_FILEACCESS* file);
// Destroy the |avail| document availability provider.
//
// avail - handle to document availability provider to be destroyed.
DLLEXPORT void STDCALL FPDFAvail_Destroy(FPDF_AVAIL avail);
// Download hints interface. Used to receive hints for further downloading.
typedef struct _FX_DOWNLOADHINTS {
// Version number of the interface. Must be 1.
int version;
// Add a section to be downloaded.
//
// Interface Version: 1
// Implementation Required: Yes
//
// pThis - pointer to the interface structure.
// offset - the offset of the hint reported to be downloaded.
// size - the size of the hint reported to be downloaded.
//
// The |offset| and |size| of the section may not be unique. Part of the
// section might be already available. The download manager must deal with
// overlapping sections.
void (*AddSegment)(struct _FX_DOWNLOADHINTS* pThis,
size_t offset,
size_t size);
} FX_DOWNLOADHINTS;
// Checks if the document is ready for loading, if not, gets download hints.
//
// avail - handle to document availability provider.
// hints - pointer to a download hints interface.
//
// Returns one of:
// PDF_DATA_ERROR: A common error is returned. Data availability unknown.
// PDF_DATA_NOTAVAIL: Data not yet available.
// PDF_DATA_AVAIL: Data available.
//
// Applications should call this function whenever new data arrives, and process
// all the generated download hints, if any, until the function returns
// |PDF_DATA_ERROR| or |PDF_DATA_AVAIL|.
//
// Once all data is available, call |FPDFAvail_GetDocument| to get a document
// handle.
DLLEXPORT int STDCALL
FPDFAvail_IsDocAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* hints);
// Get document from the availability provider.
//
// avail - handle to document availability provider.
// password - password for decrypting the PDF file. Optional.
//
// Returns a handle to the document.
//
// When |FPDFAvail_IsDocAvail| returns TRUE, call |FPDFAvail_GetDocument| to
// retrieve the document handle.
DLLEXPORT FPDF_DOCUMENT STDCALL FPDFAvail_GetDocument(FPDF_AVAIL avail,
FPDF_BYTESTRING password);
// Get the page number for the first available page in a linearized PDF.
//
// doc - document handle.
//
// Returns the zero-based index for the first available page.
//
// For most linearized PDFs, the first available page will be the first page,
// however, some PDFs might make another page the first available page.
// For non-linearized PDFs, this function will always return zero.
DLLEXPORT int STDCALL FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc);
// Check if |page_index| is ready for loading, if not, get the
// |FX_DOWNLOADHINTS|.
//
// avail - handle to document availability provider.
// page_index - index number of the page. Zero for the first page.
// hints - pointer to a download hints interface. Populated if
// |page_index| is not available.
//
// Returns one of:
// PDF_DATA_ERROR: A common error is returned. Data availability unknown.
// PDF_DATA_NOTAVAIL: Data not yet available.
// PDF_DATA_AVAIL: Data available.
//
// This function can be called only after |FPDFAvail_GetDocument| is called.
// Applications should call this function whenever new data arrives and process
// all the generated download |hints|, if any, until this function returns
// |PDF_DATA_ERROR| or |PDF_DATA_AVAIL|. Applications can then perform page
// loading.
DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail,
int page_index,
FX_DOWNLOADHINTS* hints);
// Check if form data is ready for initialization, if not, get the
// |FX_DOWNLOADHINTS|.
//
// avail - handle to document availability provider.
// hints - pointer to a download hints interface. Populated if form is not
// ready for initialization.
//
// Returns one of:
// PDF_FORM_ERROR: A common eror, in general incorrect parameters.
// PDF_FORM_NOTAVAIL: Data not available.
// PDF_FORM_AVAIL: Data available.
// PDF_FORM_NOTEXIST: No form data.
//
// This function can be called only after |FPDFAvail_GetDocument| is called.
// The application should call this function whenever new data arrives and
// process all the generated download |hints|, if any, until the function
// |PDF_FORM_ERROR|, |PDF_FORM_AVAIL| or |PDF_FORM_NOTEXIST|.
// Applications can then perform page loading. It is recommend to call
// |FPDFDOC_InitFormFillEnvironment| when |PDF_FORM_AVAIL| is returned.
DLLEXPORT int STDCALL FPDFAvail_IsFormAvail(FPDF_AVAIL avail,
FX_DOWNLOADHINTS* hints);
// Check whether a document is a linearized PDF.
//
// avail - handle to document availability provider.
//
// Returns one of:
// PDF_LINEARIZED
// PDF_NOT_LINEARIZED
// PDF_LINEARIZATION_UNKNOWN
//
// |FPDFAvail_IsLinearized| will return |PDF_LINEARIZED| or |PDF_NOT_LINEARIZED|
// when we have 1k of data. If the files size less than 1k, it returns
// |PDF_LINEARIZATION_UNKNOWN| as there is insufficient information to determine
// if the PDF is linearlized.
DLLEXPORT int STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#endif // PUBLIC_FPDF_DATAAVAIL_H_

View File

@ -0,0 +1,325 @@
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#ifndef PUBLIC_FPDF_DOC_H_
#define PUBLIC_FPDF_DOC_H_
// NOLINTNEXTLINE(build/include)
#include "fpdfview.h"
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
// Unsupported action type.
#define PDFACTION_UNSUPPORTED 0
// Go to a destination within current document.
#define PDFACTION_GOTO 1
// Go to a destination within another document.
#define PDFACTION_REMOTEGOTO 2
// URI, including web pages and other Internet resources.
#define PDFACTION_URI 3
// Launch an application or open a file.
#define PDFACTION_LAUNCH 4
typedef struct _FS_QUADPOINTSF {
FS_FLOAT x1;
FS_FLOAT y1;
FS_FLOAT x2;
FS_FLOAT y2;
FS_FLOAT x3;
FS_FLOAT y3;
FS_FLOAT x4;
FS_FLOAT y4;
} FS_QUADPOINTSF;
// Get the first child of |bookmark|, or the first top-level bookmark item.
//
// document - handle to the document.
// bookmark - handle to the current bookmark. Pass NULL for the first top
// level item.
//
// Returns a handle to the first child of |bookmark| or the first top-level
// bookmark item. NULL if no child or top-level bookmark found.
DLLEXPORT FPDF_BOOKMARK STDCALL
FPDFBookmark_GetFirstChild(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark);
// Get the next sibling of |bookmark|.
//
// document - handle to the document.
// bookmark - handle to the current bookmark.
//
// Returns a handle to the next sibling of |bookmark|, or NULL if this is the
// last bookmark at this level.
DLLEXPORT FPDF_BOOKMARK STDCALL
FPDFBookmark_GetNextSibling(FPDF_DOCUMENT document, FPDF_BOOKMARK bookmark);
// Get the title of |bookmark|.
//
// bookmark - handle to the bookmark.
// buffer - buffer for the title. May be NULL.
// buflen - the length of the buffer in bytes. May be 0.
//
// Returns the number of bytes in the title, including the terminating NUL
// character. The number of bytes is returned regardless of the |buffer| and
// |buflen| parameters.
//
// Regardless of the platform, the |buffer| is always in UTF-16LE encoding. The
// string is terminated by a UTF16 NUL character. If |buflen| is less than the
// required length, or |buffer| is NULL, |buffer| will not be modified.
DLLEXPORT unsigned long STDCALL FPDFBookmark_GetTitle(FPDF_BOOKMARK bookmark,
void* buffer,
unsigned long buflen);
// Find the bookmark with |title| in |document|.
//
// document - handle to the document.
// title - the UTF-16LE encoded Unicode title for which to search.
//
// Returns the handle to the bookmark, or NULL if |title| can't be found.
//
// |FPDFBookmark_Find| will always return the first bookmark found even if
// multiple bookmarks have the same |title|.
DLLEXPORT FPDF_BOOKMARK STDCALL FPDFBookmark_Find(FPDF_DOCUMENT document,
FPDF_WIDESTRING title);
// Get the destination associated with |bookmark|.
//
// document - handle to the document.
// bookmark - handle to the bookmark.
//
// Returns the handle to the destination data, NULL if no destination is
// associated with |bookmark|.
DLLEXPORT FPDF_DEST STDCALL FPDFBookmark_GetDest(FPDF_DOCUMENT document,
FPDF_BOOKMARK bookmark);
// Get the action associated with |bookmark|.
//
// bookmark - handle to the bookmark.
//
// Returns the handle to the action data, or NULL if no action is associated
// with |bookmark|. When NULL is returned, |FPDFBookmark_GetDest| should be
// called to get the |bookmark| destination data.
DLLEXPORT FPDF_ACTION STDCALL FPDFBookmark_GetAction(FPDF_BOOKMARK bookmark);
// Get the type of |action|.
//
// action - handle to the action.
//
// Returns one of:
// PDFACTION_UNSUPPORTED
// PDFACTION_GOTO
// PDFACTION_REMOTEGOTO
// PDFACTION_URI
// PDFACTION_LAUNCH
DLLEXPORT unsigned long STDCALL FPDFAction_GetType(FPDF_ACTION action);
// Get the destination of |action|.
//
// document - handle to the document.
// action - handle to the action. |action| must be a |PDFACTION_GOTO| or
// |PDFACTION_REMOTEGOTO|.
//
// Returns a handle to the destination data.
//
// In the case of |PDFACTION_REMOTEGOTO|, you should first call
// |FPDFAction_GetFilePath| then load that document, the document handle from
// that document should pass as |document| to |FPDFAction_GetDest|.
DLLEXPORT FPDF_DEST STDCALL FPDFAction_GetDest(FPDF_DOCUMENT document,
FPDF_ACTION action);
// Get file path of a |PDFACTION_REMOTEGOTO| |action|.
//
// action - handle to the action. |action| must be a |PDFACTION_LAUNCH| or
// |PDFACTION_REMOTEGOTO|
// buffer - a buffer for output the path string. May be NULL.
// buflen - the length of the buffer, in bytes. May be 0.
//
// Returns the number of bytes in the file path, including the trailing UTF16
// NUL character.
//
// Regardless of the platform, the |buffer| is always in UTF-16LE encoding.
// If |buflen| is less than the returned length, or |buffer| is NULL, |buffer|
// will not be modified.
DLLEXPORT unsigned long STDCALL
FPDFAction_GetFilePath(FPDF_ACTION action, void* buffer, unsigned long buflen);
// Get the URI path of a |PDFACTION_URI| |action|.
//
// document - handle to the document.
// action - handle to the action. Must be a |PDFACTION_URI|.
// buffer - a buffer for the path string. May be NULL.
// buflen - the length of the buffer, in bytes. May be 0.
//
// Returns the number of bytes in the URI path, including trailing zeros.
//
// The |buffer| is always encoded in 7-bit ASCII. If |buflen| is less than the
// returned length, or |buffer| is NULL, |buffer| will not be modified.
DLLEXPORT unsigned long STDCALL FPDFAction_GetURIPath(FPDF_DOCUMENT document,
FPDF_ACTION action,
void* buffer,
unsigned long buflen);
// Get the page index of |dest|.
//
// document - handle to the document.
// dest - handle to the destination.
//
// Returns the page index containing |dest|. Page indices start from 0.
DLLEXPORT unsigned long STDCALL FPDFDest_GetPageIndex(FPDF_DOCUMENT document,
FPDF_DEST dest);
// Get the (x, y, zoom) location of |dest| in the destination page, if the
// destination is in [page /XYZ x y zoom] syntax.
//
// dest - handle to the destination.
// hasXVal - out parameter; true if the x value is not null
// hasYVal - out parameter; true if the y value is not null
// hasZoomVal - out parameter; true if the zoom value is not null
// x - out parameter; the x coordinate, in page coordinates.
// y - out parameter; the y coordinate, in page coordinates.
// zoom - out parameter; the zoom value.
// Returns TRUE on successfully reading the /XYZ value.
//
// Note the [x, y, zoom] values are only set if the corresponding hasXVal,
// hasYVal or hasZoomVal flags are true.
DLLEXPORT FPDF_BOOL STDCALL FPDFDest_GetLocationInPage(FPDF_DEST dest,
FPDF_BOOL* hasXCoord,
FPDF_BOOL* hasYCoord,
FPDF_BOOL* hasZoom,
FS_FLOAT* x,
FS_FLOAT* y,
FS_FLOAT* zoom);
// Find a link at point (|x|,|y|) on |page|.
//
// page - handle to the document page.
// x - the x coordinate, in the page coordinate system.
// y - the y coordinate, in the page coordinate system.
//
// Returns a handle to the link, or NULL if no link found at the given point.
//
// You can convert coordinates from screen coordinates to page coordinates using
// |FPDF_DeviceToPage|.
DLLEXPORT FPDF_LINK STDCALL FPDFLink_GetLinkAtPoint(FPDF_PAGE page,
double x,
double y);
// Find the Z-order of link at point (|x|,|y|) on |page|.
//
// page - handle to the document page.
// x - the x coordinate, in the page coordinate system.
// y - the y coordinate, in the page coordinate system.
//
// Returns the Z-order of the link, or -1 if no link found at the given point.
// Larger Z-order numbers are closer to the front.
//
// You can convert coordinates from screen coordinates to page coordinates using
// |FPDF_DeviceToPage|.
DLLEXPORT int STDCALL
FPDFLink_GetLinkZOrderAtPoint(FPDF_PAGE page, double x, double y);
// Get destination info for |link|.
//
// document - handle to the document.
// link - handle to the link.
//
// Returns a handle to the destination, or NULL if there is no destination
// associated with the link. In this case, you should call |FPDFLink_GetAction|
// to retrieve the action associated with |link|.
DLLEXPORT FPDF_DEST STDCALL FPDFLink_GetDest(FPDF_DOCUMENT document,
FPDF_LINK link);
// Get action info for |link|.
//
// link - handle to the link.
//
// Returns a handle to the action associated to |link|, or NULL if no action.
DLLEXPORT FPDF_ACTION STDCALL FPDFLink_GetAction(FPDF_LINK link);
// Enumerates all the link annotations in |page|.
//
// page - handle to the page.
// startPos - the start position, should initially be 0 and is updated with
// the next start position on return.
// linkAnnot - the link handle for |startPos|.
//
// Returns TRUE on success.
DLLEXPORT FPDF_BOOL STDCALL FPDFLink_Enumerate(FPDF_PAGE page,
int* startPos,
FPDF_LINK* linkAnnot);
// Get the rectangle for |linkAnnot|.
//
// linkAnnot - handle to the link annotation.
// rect - the annotation rectangle.
//
// Returns true on success.
DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetAnnotRect(FPDF_LINK linkAnnot,
FS_RECTF* rect);
// Get the count of quadrilateral points to the |linkAnnot|.
//
// linkAnnot - handle to the link annotation.
//
// Returns the count of quadrilateral points.
DLLEXPORT int STDCALL FPDFLink_CountQuadPoints(FPDF_LINK linkAnnot);
// Get the quadrilateral points for the specified |quadIndex| in |linkAnnot|.
//
// linkAnnot - handle to the link annotation.
// quadIndex - the specified quad point index.
// quadPoints - receives the quadrilateral points.
//
// Returns true on success.
DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot,
int quadIndex,
FS_QUADPOINTSF* quadPoints);
// Get meta-data |tag| content from |document|.
//
// document - handle to the document.
// tag - the tag to retrieve. The tag can be one of:
// Title, Author, Subject, Keywords, Creator, Producer,
// CreationDate, or ModDate.
// For detailed explanations of these tags and their respective
// values, please refer to PDF Reference 1.6, section 10.2.1,
// 'Document Information Dictionary'.
// buffer - a buffer for the tag. May be NULL.
// buflen - the length of the buffer, in bytes. May be 0.
//
// Returns the number of bytes in the tag, including trailing zeros.
//
// The |buffer| is always encoded in UTF-16LE. The |buffer| is followed by two
// bytes of zeros indicating the end of the string. If |buflen| is less than
// the returned length, or |buffer| is NULL, |buffer| will not be modified.
DLLEXPORT unsigned long STDCALL FPDF_GetMetaText(FPDF_DOCUMENT document,
FPDF_BYTESTRING tag,
void* buffer,
unsigned long buflen);
// Get the page label for |page_index| from |document|.
//
// document - handle to the document.
// page_index - the 0-based index of the page.
// buffer - a buffer for the page label. May be NULL.
// buflen - the length of the buffer, in bytes. May be 0.
//
// Returns the number of bytes in the page label, including trailing zeros.
//
// The |buffer| is always encoded in UTF-16LE. The |buffer| is followed by two
// bytes of zeros indicating the end of the string. If |buflen| is less than
// the returned length, or |buffer| is NULL, |buffer| will not be modified.
DLLEXPORT unsigned long STDCALL FPDF_GetPageLabel(FPDF_DOCUMENT document,
int page_index,
void* buffer,
unsigned long buflen);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#endif // PUBLIC_FPDF_DOC_H_

View File

@ -0,0 +1,98 @@
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#ifndef PUBLIC_FPDF_EXT_H_
#define PUBLIC_FPDF_EXT_H_
// NOLINTNEXTLINE(build/include)
#include "fpdfview.h"
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
// Unsupported XFA form.
#define FPDF_UNSP_DOC_XFAFORM 1
// Unsupported portable collection.
#define FPDF_UNSP_DOC_PORTABLECOLLECTION 2
// Unsupported attachment.
#define FPDF_UNSP_DOC_ATTACHMENT 3
// Unsupported security.
#define FPDF_UNSP_DOC_SECURITY 4
// Unsupported shared review.
#define FPDF_UNSP_DOC_SHAREDREVIEW 5
// Unsupported shared form, acrobat.
#define FPDF_UNSP_DOC_SHAREDFORM_ACROBAT 6
// Unsupported shared form, filesystem.
#define FPDF_UNSP_DOC_SHAREDFORM_FILESYSTEM 7
// Unsupported shared form, email.
#define FPDF_UNSP_DOC_SHAREDFORM_EMAIL 8
// Unsupported 3D annotation.
#define FPDF_UNSP_ANNOT_3DANNOT 11
// Unsupported movie annotation.
#define FPDF_UNSP_ANNOT_MOVIE 12
// Unsupported sound annotation.
#define FPDF_UNSP_ANNOT_SOUND 13
// Unsupported screen media annotation.
#define FPDF_UNSP_ANNOT_SCREEN_MEDIA 14
// Unsupported screen rich media annotation.
#define FPDF_UNSP_ANNOT_SCREEN_RICHMEDIA 15
// Unsupported attachment annotation.
#define FPDF_UNSP_ANNOT_ATTACHMENT 16
// Unsupported signature annotation.
#define FPDF_UNSP_ANNOT_SIG 17
// Interface for unsupported feature notifications.
typedef struct _UNSUPPORT_INFO {
// Version number of the interface. Must be 1.
int version;
// Unsupported object notification function.
// Interface Version: 1
// Implementation Required: Yes
//
// pThis - pointer to the interface structure.
// nType - the type of unsupported object. One of the |FPDF_UNSP_*| entries.
void (*FSDK_UnSupport_Handler)(struct _UNSUPPORT_INFO* pThis, int nType);
} UNSUPPORT_INFO;
// Setup an unsupported object handler.
//
// unsp_info - Pointer to an UNSUPPORT_INFO structure.
//
// Returns TRUE on success.
DLLEXPORT FPDF_BOOL STDCALL
FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info);
// Unknown page mode.
#define PAGEMODE_UNKNOWN -1
// Document outline, and thumbnails hidden.
#define PAGEMODE_USENONE 0
// Document outline visible.
#define PAGEMODE_USEOUTLINES 1
// Thumbnail images visible.
#define PAGEMODE_USETHUMBS 2
// Full-screen mode, no menu bar, window controls, or other decorations visible.
#define PAGEMODE_FULLSCREEN 3
// Optional content group panel visible.
#define PAGEMODE_USEOC 4
// Attachments panel visible.
#define PAGEMODE_USEATTACHMENTS 5
// Get the document's PageMode.
//
// doc - Handle to document.
//
// Returns one of the |PAGEMODE_*| flags defined above.
//
// The page mode defines how the document should be initially displayed.
DLLEXPORT int STDCALL FPDFDoc_GetPageMode(FPDF_DOCUMENT document);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#endif // PUBLIC_FPDF_EXT_H_

View File

@ -0,0 +1,44 @@
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#ifndef PUBLIC_FPDF_FLATTEN_H_
#define PUBLIC_FPDF_FLATTEN_H_
// NOLINTNEXTLINE(build/include)
#include "fpdfview.h"
// Flatten operation failed.
#define FLATTEN_FAIL 0
// Flatten operation succeed.
#define FLATTEN_SUCCESS 1
// Nothing to be flattened.
#define FLATTEN_NOTHINGTODO 2
// Flatten for normal display.
#define FLAT_NORMALDISPLAY 0
// Flatten for print.
#define FLAT_PRINT 1
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
// Flatten annotations and form fields into the page contents.
//
// page - handle to the page.
// nFlag - One of the |FLAT_*| values denoting the page usage.
//
// Returns one of the |FLATTEN_*| values.
//
// Currently, all failures return |FLATTEN_FAIL| with no indication of the
// cause.
DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#endif // PUBLIC_FPDF_FLATTEN_H_

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,284 @@
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#ifndef PUBLIC_FPDF_FWLEVENT_H_
#define PUBLIC_FPDF_FWLEVENT_H_
// NOLINTNEXTLINE(build/include)
#include "fpdfview.h"
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
typedef int FPDF_INT32;
typedef unsigned int FPDF_UINT32;
typedef float FPDF_FLOAT;
// Event types.
typedef enum {
FWL_EVENTTYPE_Mouse = 0,
FWL_EVENTTYPE_MouseWheel,
FWL_EVENTTYPE_Key,
} FWL_EVENTTYPE;
// Key flags.
typedef enum {
FWL_EVENTFLAG_ShiftKey = 1 << 0,
FWL_EVENTFLAG_ControlKey = 1 << 1,
FWL_EVENTFLAG_AltKey = 1 << 2,
FWL_EVENTFLAG_MetaKey = 1 << 3,
FWL_EVENTFLAG_KeyPad = 1 << 4,
FWL_EVENTFLAG_AutoRepeat = 1 << 5,
FWL_EVENTFLAG_LeftButtonDown = 1 << 6,
FWL_EVENTFLAG_MiddleButtonDown = 1 << 7,
FWL_EVENTFLAG_RightButtonDown = 1 << 8,
} FWL_EVENTFLAG;
// Mouse messages.
typedef enum {
FWL_EVENTMOUSECMD_LButtonDown = 1,
FWL_EVENTMOUSECMD_LButtonUp,
FWL_EVENTMOUSECMD_LButtonDblClk,
FWL_EVENTMOUSECMD_RButtonDown,
FWL_EVENTMOUSECMD_RButtonUp,
FWL_EVENTMOUSECMD_RButtonDblClk,
FWL_EVENTMOUSECMD_MButtonDown,
FWL_EVENTMOUSECMD_MButtonUp,
FWL_EVENTMOUSECMD_MButtonDblClk,
FWL_EVENTMOUSECMD_MouseMove,
FWL_EVENTMOUSECMD_MouseEnter,
FWL_EVENTMOUSECMD_MouseHover,
FWL_EVENTMOUSECMD_MouseLeave,
} FWL_EVENT_MOUSECMD;
// Mouse events.
struct FWL_EVENT_MOUSE {
FPDF_UINT32 command;
FPDF_DWORD flag;
FPDF_FLOAT x;
FPDF_FLOAT y;
};
// Mouse wheel events.
struct FWL_EVENT_MOUSEWHEEL {
FPDF_DWORD flag;
FPDF_FLOAT x;
FPDF_FLOAT y;
FPDF_FLOAT deltaX;
FPDF_FLOAT deltaY;
};
// Virtual keycodes.
typedef enum {
FWL_VKEY_Back = 0x08,
FWL_VKEY_Tab = 0x09,
FWL_VKEY_NewLine = 0x0A,
FWL_VKEY_Clear = 0x0C,
FWL_VKEY_Return = 0x0D,
FWL_VKEY_Shift = 0x10,
FWL_VKEY_Control = 0x11,
FWL_VKEY_Menu = 0x12,
FWL_VKEY_Pause = 0x13,
FWL_VKEY_Capital = 0x14,
FWL_VKEY_Kana = 0x15,
FWL_VKEY_Hangul = 0x15,
FWL_VKEY_Junja = 0x17,
FWL_VKEY_Final = 0x18,
FWL_VKEY_Hanja = 0x19,
FWL_VKEY_Kanji = 0x19,
FWL_VKEY_Escape = 0x1B,
FWL_VKEY_Convert = 0x1C,
FWL_VKEY_NonConvert = 0x1D,
FWL_VKEY_Accept = 0x1E,
FWL_VKEY_ModeChange = 0x1F,
FWL_VKEY_Space = 0x20,
FWL_VKEY_Prior = 0x21,
FWL_VKEY_Next = 0x22,
FWL_VKEY_End = 0x23,
FWL_VKEY_Home = 0x24,
FWL_VKEY_Left = 0x25,
FWL_VKEY_Up = 0x26,
FWL_VKEY_Right = 0x27,
FWL_VKEY_Down = 0x28,
FWL_VKEY_Select = 0x29,
FWL_VKEY_Print = 0x2A,
FWL_VKEY_Execute = 0x2B,
FWL_VKEY_Snapshot = 0x2C,
FWL_VKEY_Insert = 0x2D,
FWL_VKEY_Delete = 0x2E,
FWL_VKEY_Help = 0x2F,
FWL_VKEY_0 = 0x30,
FWL_VKEY_1 = 0x31,
FWL_VKEY_2 = 0x32,
FWL_VKEY_3 = 0x33,
FWL_VKEY_4 = 0x34,
FWL_VKEY_5 = 0x35,
FWL_VKEY_6 = 0x36,
FWL_VKEY_7 = 0x37,
FWL_VKEY_8 = 0x38,
FWL_VKEY_9 = 0x39,
FWL_VKEY_A = 0x41,
FWL_VKEY_B = 0x42,
FWL_VKEY_C = 0x43,
FWL_VKEY_D = 0x44,
FWL_VKEY_E = 0x45,
FWL_VKEY_F = 0x46,
FWL_VKEY_G = 0x47,
FWL_VKEY_H = 0x48,
FWL_VKEY_I = 0x49,
FWL_VKEY_J = 0x4A,
FWL_VKEY_K = 0x4B,
FWL_VKEY_L = 0x4C,
FWL_VKEY_M = 0x4D,
FWL_VKEY_N = 0x4E,
FWL_VKEY_O = 0x4F,
FWL_VKEY_P = 0x50,
FWL_VKEY_Q = 0x51,
FWL_VKEY_R = 0x52,
FWL_VKEY_S = 0x53,
FWL_VKEY_T = 0x54,
FWL_VKEY_U = 0x55,
FWL_VKEY_V = 0x56,
FWL_VKEY_W = 0x57,
FWL_VKEY_X = 0x58,
FWL_VKEY_Y = 0x59,
FWL_VKEY_Z = 0x5A,
FWL_VKEY_LWin = 0x5B,
FWL_VKEY_Command = 0x5B,
FWL_VKEY_RWin = 0x5C,
FWL_VKEY_Apps = 0x5D,
FWL_VKEY_Sleep = 0x5F,
FWL_VKEY_NumPad0 = 0x60,
FWL_VKEY_NumPad1 = 0x61,
FWL_VKEY_NumPad2 = 0x62,
FWL_VKEY_NumPad3 = 0x63,
FWL_VKEY_NumPad4 = 0x64,
FWL_VKEY_NumPad5 = 0x65,
FWL_VKEY_NumPad6 = 0x66,
FWL_VKEY_NumPad7 = 0x67,
FWL_VKEY_NumPad8 = 0x68,
FWL_VKEY_NumPad9 = 0x69,
FWL_VKEY_Multiply = 0x6A,
FWL_VKEY_Add = 0x6B,
FWL_VKEY_Separator = 0x6C,
FWL_VKEY_Subtract = 0x6D,
FWL_VKEY_Decimal = 0x6E,
FWL_VKEY_Divide = 0x6F,
FWL_VKEY_F1 = 0x70,
FWL_VKEY_F2 = 0x71,
FWL_VKEY_F3 = 0x72,
FWL_VKEY_F4 = 0x73,
FWL_VKEY_F5 = 0x74,
FWL_VKEY_F6 = 0x75,
FWL_VKEY_F7 = 0x76,
FWL_VKEY_F8 = 0x77,
FWL_VKEY_F9 = 0x78,
FWL_VKEY_F10 = 0x79,
FWL_VKEY_F11 = 0x7A,
FWL_VKEY_F12 = 0x7B,
FWL_VKEY_F13 = 0x7C,
FWL_VKEY_F14 = 0x7D,
FWL_VKEY_F15 = 0x7E,
FWL_VKEY_F16 = 0x7F,
FWL_VKEY_F17 = 0x80,
FWL_VKEY_F18 = 0x81,
FWL_VKEY_F19 = 0x82,
FWL_VKEY_F20 = 0x83,
FWL_VKEY_F21 = 0x84,
FWL_VKEY_F22 = 0x85,
FWL_VKEY_F23 = 0x86,
FWL_VKEY_F24 = 0x87,
FWL_VKEY_NunLock = 0x90,
FWL_VKEY_Scroll = 0x91,
FWL_VKEY_LShift = 0xA0,
FWL_VKEY_RShift = 0xA1,
FWL_VKEY_LControl = 0xA2,
FWL_VKEY_RControl = 0xA3,
FWL_VKEY_LMenu = 0xA4,
FWL_VKEY_RMenu = 0xA5,
FWL_VKEY_BROWSER_Back = 0xA6,
FWL_VKEY_BROWSER_Forward = 0xA7,
FWL_VKEY_BROWSER_Refresh = 0xA8,
FWL_VKEY_BROWSER_Stop = 0xA9,
FWL_VKEY_BROWSER_Search = 0xAA,
FWL_VKEY_BROWSER_Favorites = 0xAB,
FWL_VKEY_BROWSER_Home = 0xAC,
FWL_VKEY_VOLUME_Mute = 0xAD,
FWL_VKEY_VOLUME_Down = 0xAE,
FWL_VKEY_VOLUME_Up = 0xAF,
FWL_VKEY_MEDIA_NEXT_Track = 0xB0,
FWL_VKEY_MEDIA_PREV_Track = 0xB1,
FWL_VKEY_MEDIA_Stop = 0xB2,
FWL_VKEY_MEDIA_PLAY_Pause = 0xB3,
FWL_VKEY_MEDIA_LAUNCH_Mail = 0xB4,
FWL_VKEY_MEDIA_LAUNCH_MEDIA_Select = 0xB5,
FWL_VKEY_MEDIA_LAUNCH_APP1 = 0xB6,
FWL_VKEY_MEDIA_LAUNCH_APP2 = 0xB7,
FWL_VKEY_OEM_1 = 0xBA,
FWL_VKEY_OEM_Plus = 0xBB,
FWL_VKEY_OEM_Comma = 0xBC,
FWL_VKEY_OEM_Minus = 0xBD,
FWL_VKEY_OEM_Period = 0xBE,
FWL_VKEY_OEM_2 = 0xBF,
FWL_VKEY_OEM_3 = 0xC0,
FWL_VKEY_OEM_4 = 0xDB,
FWL_VKEY_OEM_5 = 0xDC,
FWL_VKEY_OEM_6 = 0xDD,
FWL_VKEY_OEM_7 = 0xDE,
FWL_VKEY_OEM_8 = 0xDF,
FWL_VKEY_OEM_102 = 0xE2,
FWL_VKEY_ProcessKey = 0xE5,
FWL_VKEY_Packet = 0xE7,
FWL_VKEY_Attn = 0xF6,
FWL_VKEY_Crsel = 0xF7,
FWL_VKEY_Exsel = 0xF8,
FWL_VKEY_Ereof = 0xF9,
FWL_VKEY_Play = 0xFA,
FWL_VKEY_Zoom = 0xFB,
FWL_VKEY_NoName = 0xFC,
FWL_VKEY_PA1 = 0xFD,
FWL_VKEY_OEM_Clear = 0xFE,
FWL_VKEY_Unknown = 0,
} FWL_VKEYCODE;
// Key event commands.
typedef enum {
FWL_EVENTKEYCMD_KeyDown = 1,
FWL_EVENTKEYCMD_KeyUp,
FWL_EVENTKEYCMD_Char,
} FWL_EVENTKEYCMD;
// Key events.
struct FWL_EVENT_KEY {
FPDF_UINT32 command;
FPDF_DWORD flag;
union {
// Virtual key code.
FPDF_UINT32 vkcode;
// Character code.
FPDF_DWORD charcode;
} code;
};
// Event types.
struct FWL_EVENT {
// Structure size.
FPDF_UINT32 size;
// FWL_EVENTTYPE.
FPDF_UINT32 type;
union {
struct FWL_EVENT_MOUSE mouse;
struct FWL_EVENT_MOUSEWHEEL wheel;
struct FWL_EVENT_KEY key;
} s;
};
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#endif // PUBLIC_FPDF_FWLEVENT_H_

View File

@ -0,0 +1,44 @@
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#ifndef PUBLIC_FPDF_PPO_H_
#define PUBLIC_FPDF_PPO_H_
// NOLINTNEXTLINE(build/include)
#include "fpdfview.h"
#ifdef __cplusplus
extern "C" {
#endif
// Import pages to a FPDF_DOCUMENT.
//
// dest_doc - The destination document for the pages.
// src_doc - The document to be imported.
// pagerange - A page range string, Such as "1,3,5-7". If |pagerange| is NULL,
// all pages from |src_doc| are imported.
// index - The page index to insert at.
//
// Returns TRUE on success.
DLLEXPORT FPDF_BOOL STDCALL FPDF_ImportPages(FPDF_DOCUMENT dest_doc,
FPDF_DOCUMENT src_doc,
FPDF_BYTESTRING pagerange,
int index);
// Copy the viewer preferences from |src_doc| into |dest_doc|.
//
// dest_doc - Document to write the viewer preferences into.
// src_doc - Document to read the viewer preferences from.
//
// Returns TRUE on success.
DLLEXPORT FPDF_BOOL STDCALL FPDF_CopyViewerPreferences(FPDF_DOCUMENT dest_doc,
FPDF_DOCUMENT src_doc);
#ifdef __cplusplus
} // extern "C"
#endif // __cplusplus
#endif // PUBLIC_FPDF_PPO_H_

View File

@ -0,0 +1,120 @@
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#ifndef PUBLIC_FPDF_PROGRESSIVE_H_
#define PUBLIC_FPDF_PROGRESSIVE_H_
// NOLINTNEXTLINE(build/include)
#include "fpdfview.h"
// Flags for progressive process status.
#define FPDF_RENDER_READER 0
#define FPDF_RENDER_TOBECOUNTINUED 1
#define FPDF_RENDER_DONE 2
#define FPDF_RENDER_FAILED 3
#ifdef __cplusplus
extern "C" {
#endif
// IFPDF_RENDERINFO interface.
typedef struct _IFSDK_PAUSE {
/**
* Version number of the interface. Currently must be 1.
**/
int version;
/*
* Method: NeedToPauseNow
* Check if we need to pause a progressive process now.
* Interface Version:
* 1
* Implementation Required:
* yes
* Parameters:
* pThis - Pointer to the interface structure itself
* Return Value:
* Non-zero for pause now, 0 for continue.
*
*/
FPDF_BOOL (*NeedToPauseNow)(struct _IFSDK_PAUSE* pThis);
// A user defined data pointer, used by user's application. Can be NULL.
void* user;
} IFSDK_PAUSE;
// Function: FPDF_RenderPageBitmap_Start
// Start to render page contents to a device independent bitmap
// progressively.
// Parameters:
// bitmap - Handle to the device independent bitmap (as the
// output buffer).
// Bitmap handle can be created by FPDFBitmap_Create
// function.
// page - Handle to the page. Returned by FPDF_LoadPage
// function.
// start_x - Left pixel position of the display area in the
// bitmap coordinate.
// start_y - Top pixel position of the display area in the bitmap
// coordinate.
// size_x - Horizontal size (in pixels) for displaying the page.
// size_y - Vertical size (in pixels) for displaying the page.
// rotate - Page orientation: 0 (normal), 1 (rotated 90 degrees
// clockwise),
// 2 (rotated 180 degrees), 3 (rotated 90 degrees
// counter-clockwise).
// flags - 0 for normal display, or combination of flags
// defined in fpdfview.h. With FPDF_ANNOT flag, it
// renders all annotations that does not require
// user-interaction, which are all annotations except
// widget and popup annotations.
// pause - The IFSDK_PAUSE interface.A callback mechanism
// allowing the page rendering process
// Return value:
// Rendering Status. See flags for progressive process status for the
// details.
//
DLLEXPORT int STDCALL FPDF_RenderPageBitmap_Start(FPDF_BITMAP bitmap,
FPDF_PAGE page,
int start_x,
int start_y,
int size_x,
int size_y,
int rotate,
int flags,
IFSDK_PAUSE* pause);
// Function: FPDF_RenderPage_Continue
// Continue rendering a PDF page.
// Parameters:
// page - Handle to the page. Returned by FPDF_LoadPage
// function.
// pause - The IFSDK_PAUSE interface.A callback mechanism
// allowing the page rendering process
// to be paused before it's finished. This can be NULL
// if you don't want to pause.
// Return value:
// The rendering status. See flags for progressive process status for
// the details.
DLLEXPORT int STDCALL FPDF_RenderPage_Continue(FPDF_PAGE page,
IFSDK_PAUSE* pause);
// Function: FPDF_RenderPage_Close
// Release the resource allocate during page rendering. Need to be
// called after finishing rendering or
// cancel the rendering.
// Parameters:
// page - Handle to the page. Returned by FPDF_LoadPage
// function.
// Return value:
// NULL
DLLEXPORT void STDCALL FPDF_RenderPage_Close(FPDF_PAGE page);
#ifdef __cplusplus
}
#endif
#endif // PUBLIC_FPDF_PROGRESSIVE_H_

View File

@ -0,0 +1,87 @@
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#ifndef PUBLIC_FPDF_SAVE_H_
#define PUBLIC_FPDF_SAVE_H_
// NOLINTNEXTLINE(build/include)
#include "fpdfview.h"
#ifdef __cplusplus
extern "C" {
#endif
// Structure for custom file write
typedef struct FPDF_FILEWRITE_ {
//
// Version number of the interface. Currently must be 1.
//
int version;
//
// Method: WriteBlock
// Output a block of data in your custom way.
// Interface Version:
// 1
// Implementation Required:
// Yes
// Comments:
// Called by function FPDF_SaveDocument
// Parameters:
// pThis - Pointer to the structure itself
// pData - Pointer to a buffer to output
// size - The size of the buffer.
// Return value:
// Should be non-zero if successful, zero for error.
//
int (*WriteBlock)(struct FPDF_FILEWRITE_* pThis,
const void* pData,
unsigned long size);
} FPDF_FILEWRITE;
/** @brief Incremental. */
#define FPDF_INCREMENTAL 1
/** @brief No Incremental. */
#define FPDF_NO_INCREMENTAL 2
/** @brief Remove security. */
#define FPDF_REMOVE_SECURITY 3
// Function: FPDF_SaveAsCopy
// Saves the copy of specified document in custom way.
// Parameters:
// document - Handle to document. Returned by
// FPDF_LoadDocument and FPDF_CreateNewDocument.
// pFileWrite - A pointer to a custom file write structure.
// flags - The creating flags.
// Return value:
// TRUE for succeed, FALSE for failed.
//
DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveAsCopy(FPDF_DOCUMENT document,
FPDF_FILEWRITE* pFileWrite,
FPDF_DWORD flags);
// Function: FPDF_SaveWithVersion
// Same as function ::FPDF_SaveAsCopy, except the file version of the
// saved document could be specified by user.
// Parameters:
// document - Handle to document.
// pFileWrite - A pointer to a custom file write structure.
// flags - The creating flags.
// fileVersion - The PDF file version. File version: 14 for 1.4,
// 15 for 1.5, ...
// Return value:
// TRUE if succeed, FALSE if failed.
//
DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion(FPDF_DOCUMENT document,
FPDF_FILEWRITE* pFileWrite,
FPDF_DWORD flags,
int fileVersion);
#ifdef __cplusplus
}
#endif
#endif // PUBLIC_FPDF_SAVE_H_

View File

@ -0,0 +1,316 @@
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#ifndef PUBLIC_FPDF_SYSFONTINFO_H_
#define PUBLIC_FPDF_SYSFONTINFO_H_
// NOLINTNEXTLINE(build/include)
#include "fpdfview.h"
/* Character sets for the font */
#define FXFONT_ANSI_CHARSET 0
#define FXFONT_DEFAULT_CHARSET 1
#define FXFONT_SYMBOL_CHARSET 2
#define FXFONT_SHIFTJIS_CHARSET 128
#define FXFONT_HANGEUL_CHARSET 129
#define FXFONT_GB2312_CHARSET 134
#define FXFONT_CHINESEBIG5_CHARSET 136
/* Font pitch and family flags */
#define FXFONT_FF_FIXEDPITCH 1
#define FXFONT_FF_ROMAN (1 << 4)
#define FXFONT_FF_SCRIPT (4 << 4)
/* Typical weight values */
#define FXFONT_FW_NORMAL 400
#define FXFONT_FW_BOLD 700
// Exported Functions
#ifdef __cplusplus
extern "C" {
#endif
/**
* Interface: FPDF_SYSFONTINFO
* Interface for getting system font information and font mapping
*/
typedef struct _FPDF_SYSFONTINFO {
/**
* Version number of the interface. Currently must be 1.
**/
int version;
/**
* Method: Release
* Give implementation a chance to release any data after the
* interface is no longer used
* Interface Version:
* 1
* Implementation Required:
* No
* Comments:
* Called by Foxit SDK during the final cleanup process.
* Parameters:
* pThis - Pointer to the interface structure itself
* Return Value:
* None
*/
void (*Release)(struct _FPDF_SYSFONTINFO* pThis);
/**
* Method: EnumFonts
* Enumerate all fonts installed on the system
* Interface Version:
* 1
* Implementation Required:
* No
* Comments:
* Implementation should call FPDF_AddIntalledFont() function for
* each font found.
* Only TrueType/OpenType and Type1 fonts are accepted by Foxit SDK.
* Parameters:
* pThis - Pointer to the interface structure itself
* pMapper - An opaque pointer to internal font mapper, used
* when calling FPDF_AddInstalledFont
* Return Value:
* None
*/
void (*EnumFonts)(struct _FPDF_SYSFONTINFO* pThis, void* pMapper);
/**
* Method: MapFont
* Use the system font mapper to get a font handle from requested
*parameters
* Interface Version:
* 1
* Implementation Required:
* Yes only if GetFont method is not implemented.
* Comments:
* If the system supports native font mapper (like Windows),
*implementation can implement this method to get a font handle.
* Otherwise, Foxit SDK will do the mapping and then call GetFont
*method.
* Only TrueType/OpenType and Type1 fonts are accepted by Foxit SDK.
* Parameters:
* pThis - Pointer to the interface structure itself
* weight - Weight of the requested font. 400 is normal and
*700 is bold.
* bItalic - Italic option of the requested font, TRUE or
*FALSE.
* charset - Character set identifier for the requested font.
*See above defined constants.
* pitch_family - A combination of flags. See above defined
*constants.
* face - Typeface name. Currently use system local encoding
*only.
* bExact - Pointer to a boolean value receiving the indicator
*whether mapper found the exact match.
* If mapper is not sure whether it's exact match,
*ignore this paramter.
* Return Value:
* An opaque pointer for font handle, or NULL if system mapping is
*not supported.
**/
void* (*MapFont)(struct _FPDF_SYSFONTINFO* pThis,
int weight,
FPDF_BOOL bItalic,
int charset,
int pitch_family,
const char* face,
FPDF_BOOL* bExact);
/**
* Method: GetFont
* Get a handle to a particular font by its internal ID
* Interface Version:
* 1
* Implementation Required:
* Yes only if MapFont method is not implemented.
* Comments:
* If the system mapping not supported, Foxit SDK will do the font
*mapping and use this method to get a font handle.
* Parameters:
* pThis - Pointer to the interface structure itself
* face - Typeface name. Currently use system local encoding
*only.
* Return Value:
* An opaque pointer for font handle.
**/
void* (*GetFont)(struct _FPDF_SYSFONTINFO* pThis, const char* face);
/**
* Method: GetFontData
* Get font data from a font
* Interface Version:
* 1
* Implementation Required:
* Yes
* Comments:
* Can read either full font file, or a particular TrueType/OpenType
*table
* Parameters:
* pThis - Pointer to the interface structure itself
* hFont - Font handle returned by MapFont or GetFont method
* table - TrueType/OpenType table identifier (refer to
*TrueType specification).
* 0 for the whole font file.
* buffer - The buffer receiving the font data. Can be NULL if
*not provided
* buf_size - Buffer size, can be zero if not provided
* Return Value:
* Number of bytes needed, if buffer not provided or not large
*enough,
* or number of bytes written into buffer otherwise.
**/
unsigned long (*GetFontData)(struct _FPDF_SYSFONTINFO* pThis,
void* hFont,
unsigned int table,
unsigned char* buffer,
unsigned long buf_size);
/**
* Method: GetFaceName
* Get face name from a font handle
* Interface Version:
* 1
* Implementation Required:
* No
* Parameters:
* pThis - Pointer to the interface structure itself
* hFont - Font handle returned by MapFont or GetFont method
* buffer - The buffer receiving the face name. Can be NULL if
*not provided
* buf_size - Buffer size, can be zero if not provided
* Return Value:
* Number of bytes needed, if buffer not provided or not large
*enough,
* or number of bytes written into buffer otherwise.
**/
unsigned long (*GetFaceName)(struct _FPDF_SYSFONTINFO* pThis,
void* hFont,
char* buffer,
unsigned long buf_size);
/**
* Method: GetFontCharset
* Get character set information for a font handle
* Interface Version:
* 1
* Implementation Required:
* No
* Parameters:
* pThis - Pointer to the interface structure itself
* hFont - Font handle returned by MapFont or GetFont method
* Return Value:
* Character set identifier. See defined constants above.
**/
int (*GetFontCharset)(struct _FPDF_SYSFONTINFO* pThis, void* hFont);
/**
* Method: DeleteFont
* Delete a font handle
* Interface Version:
* 1
* Implementation Required:
* Yes
* Parameters:
* pThis - Pointer to the interface structure itself
* hFont - Font handle returned by MapFont or GetFont method
* Return Value:
* None
**/
void (*DeleteFont)(struct _FPDF_SYSFONTINFO* pThis, void* hFont);
} FPDF_SYSFONTINFO;
/**
* Struct: FPDF_CharsetFontMap
* Provides the name of a font to use for a given charset value.
**/
typedef struct FPDF_CharsetFontMap_ {
int charset; // Character Set Enum value, see FXFONT_*_CHARSET above.
const char* fontname; // Name of default font to use with that charset.
} FPDF_CharsetFontMap;
/**
* Function: FPDF_GetDefaultTTFMap
* Returns a pointer to the default character set to TT Font name map. The
* map is an array of FPDF_CharsetFontMap structs, with its end indicated
* by a { -1, NULL } entry.
* Parameters:
* None.
* Return Value:
* Pointer to the Charset Font Map.
**/
DLLEXPORT const FPDF_CharsetFontMap* STDCALL FPDF_GetDefaultTTFMap();
/**
* Function: FPDF_AddInstalledFont
* Add a system font to the list in Foxit SDK.
* Comments:
* This function is only called during the system font list building
*process.
* Parameters:
* mapper - Opaque pointer to Foxit font mapper
* face - The font face name
* charset - Font character set. See above defined constants.
* Return Value:
* None.
**/
DLLEXPORT void STDCALL FPDF_AddInstalledFont(void* mapper,
const char* face,
int charset);
/**
* Function: FPDF_SetSystemFontInfo
* Set the system font info interface into Foxit SDK
* Comments:
* Platform support implementation should implement required methods of
*FFDF_SYSFONTINFO interface,
* then call this function during SDK initialization process.
* Parameters:
* pFontInfo - Pointer to a FPDF_SYSFONTINFO structure
* Return Value:
* None
**/
DLLEXPORT void STDCALL FPDF_SetSystemFontInfo(FPDF_SYSFONTINFO* pFontInfo);
/**
* Function: FPDF_GetDefaultSystemFontInfo
* Get default system font info interface for current platform
* Comments:
* For some platforms Foxit SDK implement a default version of system
*font info interface.
* The default implementation can be used in FPDF_SetSystemFontInfo
*function.
* Parameters:
* None
* Return Value:
* Pointer to a FPDF_SYSFONTINFO structure describing the default
*interface.
* Or NULL if the platform doesn't have a default interface.
* Application should call FPDF_FreeDefaultSystemFontInfo to free the
*returned pointer.
**/
DLLEXPORT FPDF_SYSFONTINFO* STDCALL FPDF_GetDefaultSystemFontInfo();
/**
* Function: FPDF_FreeDefaultSystemFontInfo
* Free a default system font info interface
* Comments:
* This function should be called on the output from
*FPDF_SetSystemFontInfo once it is no longer needed by the client.
* Parameters:
* pFontInfo - Pointer to a FPDF_SYSFONTINFO structure
* Return Value:
* None
**/
DLLEXPORT void FPDF_FreeDefaultSystemFontInfo(FPDF_SYSFONTINFO* pFontInfo);
#ifdef __cplusplus
}
#endif
#endif // PUBLIC_FPDF_SYSFONTINFO_H_

View File

@ -0,0 +1,425 @@
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#ifndef PUBLIC_FPDF_TEXT_H_
#define PUBLIC_FPDF_TEXT_H_
// NOLINTNEXTLINE(build/include)
#include "fpdfview.h"
// Exported Functions
#ifdef __cplusplus
extern "C" {
#endif
// Function: FPDFText_LoadPage
// Prepare information about all characters in a page.
// Parameters:
// page - Handle to the page. Returned by FPDF_LoadPage function
// (in FPDFVIEW module).
// Return value:
// A handle to the text page information structure.
// NULL if something goes wrong.
// Comments:
// Application must call FPDFText_ClosePage to release the text page
// information.
//
DLLEXPORT FPDF_TEXTPAGE STDCALL FPDFText_LoadPage(FPDF_PAGE page);
// Function: FPDFText_ClosePage
// Release all resources allocated for a text page information
// structure.
// Parameters:
// text_page - Handle to a text page information structure.
// Returned by FPDFText_LoadPage function.
// Return Value:
// None.
//
DLLEXPORT void STDCALL FPDFText_ClosePage(FPDF_TEXTPAGE text_page);
// Function: FPDFText_CountChars
// Get number of characters in a page.
// Parameters:
// text_page - Handle to a text page information structure.
// Returned by FPDFText_LoadPage function.
// Return value:
// Number of characters in the page. Return -1 for error.
// Generated characters, like additional space characters, new line
// characters, are also counted.
// Comments:
// Characters in a page form a "stream", inside the stream, each
// character has an index.
// We will use the index parameters in many of FPDFTEXT functions. The
// first character in the page
// has an index value of zero.
//
DLLEXPORT int STDCALL FPDFText_CountChars(FPDF_TEXTPAGE text_page);
// Function: FPDFText_GetUnicode
// Get Unicode of a character in a page.
// Parameters:
// text_page - Handle to a text page information structure.
// Returned by FPDFText_LoadPage function.
// index - Zero-based index of the character.
// Return value:
// The Unicode of the particular character.
// If a character is not encoded in Unicode and Foxit engine can't
// convert to Unicode,
// the return value will be zero.
//
DLLEXPORT unsigned int STDCALL FPDFText_GetUnicode(FPDF_TEXTPAGE text_page,
int index);
// Function: FPDFText_GetFontSize
// Get the font size of a particular character.
// Parameters:
// text_page - Handle to a text page information structure.
// Returned by FPDFText_LoadPage function.
// index - Zero-based index of the character.
// Return value:
// The font size of the particular character, measured in points (about
// 1/72 inch).
// This is the typographic size of the font (so called "em size").
//
DLLEXPORT double STDCALL FPDFText_GetFontSize(FPDF_TEXTPAGE text_page,
int index);
// Function: FPDFText_GetCharBox
// Get bounding box of a particular character.
// Parameters:
// text_page - Handle to a text page information structure.
// Returned by FPDFText_LoadPage function.
// index - Zero-based index of the character.
// left - Pointer to a double number receiving left position
// of the character box.
// right - Pointer to a double number receiving right position
// of the character box.
// bottom - Pointer to a double number receiving bottom position
// of the character box.
// top - Pointer to a double number receiving top position of
// the character box.
// Return Value:
// None.
// Comments:
// All positions are measured in PDF "user space".
//
DLLEXPORT void STDCALL FPDFText_GetCharBox(FPDF_TEXTPAGE text_page,
int index,
double* left,
double* right,
double* bottom,
double* top);
// Function: FPDFText_GetCharIndexAtPos
// Get the index of a character at or nearby a certain position on the
// page.
// Parameters:
// text_page - Handle to a text page information structure.
// Returned by FPDFText_LoadPage function.
// x - X position in PDF "user space".
// y - Y position in PDF "user space".
// xTolerance - An x-axis tolerance value for character hit
// detection, in point unit.
// yTolerance - A y-axis tolerance value for character hit
// detection, in point unit.
// Return Value:
// The zero-based index of the character at, or nearby the point (x,y).
// If there is no character at or nearby the point, return value will
// be -1.
// If an error occurs, -3 will be returned.
//
DLLEXPORT int STDCALL FPDFText_GetCharIndexAtPos(FPDF_TEXTPAGE text_page,
double x,
double y,
double xTolerance,
double yTolerance);
// Function: FPDFText_GetText
// Extract unicode text string from the page.
// Parameters:
// text_page - Handle to a text page information structure.
// Returned by FPDFText_LoadPage function.
// start_index - Index for the start characters.
// count - Number of characters to be extracted.
// result - A buffer (allocated by application) receiving the
// extracted unicodes.
// The size of the buffer must be able to hold the
// number of characters plus a terminator.
// Return Value:
// Number of characters written into the result buffer, including the
// trailing terminator.
// Comments:
// This function ignores characters without unicode information.
//
DLLEXPORT int STDCALL FPDFText_GetText(FPDF_TEXTPAGE text_page,
int start_index,
int count,
unsigned short* result);
// Function: FPDFText_CountRects
// Count number of rectangular areas occupied by a segment of texts.
// Parameters:
// text_page - Handle to a text page information structure.
// Returned by FPDFText_LoadPage function.
// start_index - Index for the start characters.
// count - Number of characters.
// Return value:
// Number of rectangles. Zero for error.
// Comments:
// This function, along with FPDFText_GetRect can be used by
// applications to detect the position
// on the page for a text segment, so proper areas can be highlighted
// or something.
// FPDFTEXT will automatically merge small character boxes into bigger
// one if those characters
// are on the same line and use same font settings.
//
DLLEXPORT int STDCALL FPDFText_CountRects(FPDF_TEXTPAGE text_page,
int start_index,
int count);
// Function: FPDFText_GetRect
// Get a rectangular area from the result generated by
// FPDFText_CountRects.
// Parameters:
// text_page - Handle to a text page information structure.
// Returned by FPDFText_LoadPage function.
// rect_index - Zero-based index for the rectangle.
// left - Pointer to a double value receiving the rectangle
// left boundary.
// top - Pointer to a double value receiving the rectangle
// top boundary.
// right - Pointer to a double value receiving the rectangle
// right boundary.
// bottom - Pointer to a double value receiving the rectangle
// bottom boundary.
// Return Value:
// None.
//
DLLEXPORT void STDCALL FPDFText_GetRect(FPDF_TEXTPAGE text_page,
int rect_index,
double* left,
double* top,
double* right,
double* bottom);
// Function: FPDFText_GetBoundedText
// Extract unicode text within a rectangular boundary on the page.
// Parameters:
// text_page - Handle to a text page information structure.
// Returned by FPDFText_LoadPage function.
// left - Left boundary.
// top - Top boundary.
// right - Right boundary.
// bottom - Bottom boundary.
// buffer - A unicode buffer.
// buflen - Number of characters (not bytes) for the buffer,
// excluding an additional terminator.
// Return Value:
// If buffer is NULL or buflen is zero, return number of characters
// (not bytes) of text present within
// the rectangle, excluding a terminating NUL. Generally you should
// pass a buffer at least one larger
// than this if you want a terminating NUL, which will be provided if
// space is available.
// Otherwise, return number of characters copied into the buffer,
// including the terminating NUL
// when space for it is available.
// Comment:
// If the buffer is too small, as much text as will fit is copied into
// it.
//
DLLEXPORT int STDCALL FPDFText_GetBoundedText(FPDF_TEXTPAGE text_page,
double left,
double top,
double right,
double bottom,
unsigned short* buffer,
int buflen);
// Flags used by FPDFText_FindStart function.
#define FPDF_MATCHCASE \
0x00000001 // If not set, it will not match case by default.
#define FPDF_MATCHWHOLEWORD \
0x00000002 // If not set, it will not match the whole word by default.
// Function: FPDFText_FindStart
// Start a search.
// Parameters:
// text_page - Handle to a text page information structure.
// Returned by FPDFText_LoadPage function.
// findwhat - A unicode match pattern.
// flags - Option flags.
// start_index - Start from this character. -1 for end of the page.
// Return Value:
// A handle for the search context. FPDFText_FindClose must be called
// to release this handle.
//
DLLEXPORT FPDF_SCHHANDLE STDCALL FPDFText_FindStart(FPDF_TEXTPAGE text_page,
FPDF_WIDESTRING findwhat,
unsigned long flags,
int start_index);
// Function: FPDFText_FindNext
// Search in the direction from page start to end.
// Parameters:
// handle - A search context handle returned by
// FPDFText_FindStart.
// Return Value:
// Whether a match is found.
//
DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindNext(FPDF_SCHHANDLE handle);
// Function: FPDFText_FindPrev
// Search in the direction from page end to start.
// Parameters:
// handle - A search context handle returned by
// FPDFText_FindStart.
// Return Value:
// Whether a match is found.
//
DLLEXPORT FPDF_BOOL STDCALL FPDFText_FindPrev(FPDF_SCHHANDLE handle);
// Function: FPDFText_GetSchResultIndex
// Get the starting character index of the search result.
// Parameters:
// handle - A search context handle returned by
// FPDFText_FindStart.
// Return Value:
// Index for the starting character.
//
DLLEXPORT int STDCALL FPDFText_GetSchResultIndex(FPDF_SCHHANDLE handle);
// Function: FPDFText_GetSchCount
// Get the number of matched characters in the search result.
// Parameters:
// handle - A search context handle returned by
// FPDFText_FindStart.
// Return Value:
// Number of matched characters.
//
DLLEXPORT int STDCALL FPDFText_GetSchCount(FPDF_SCHHANDLE handle);
// Function: FPDFText_FindClose
// Release a search context.
// Parameters:
// handle - A search context handle returned by
// FPDFText_FindStart.
// Return Value:
// None.
//
DLLEXPORT void STDCALL FPDFText_FindClose(FPDF_SCHHANDLE handle);
// Function: FPDFLink_LoadWebLinks
// Prepare information about weblinks in a page.
// Parameters:
// text_page - Handle to a text page information structure.
// Returned by FPDFText_LoadPage function.
// Return Value:
// A handle to the page's links information structure.
// NULL if something goes wrong.
// Comments:
// Weblinks are those links implicitly embedded in PDF pages. PDF also
// has a type of
// annotation called "link", FPDFTEXT doesn't deal with that kind of
// link.
// FPDFTEXT weblink feature is useful for automatically detecting links
// in the page
// contents. For example, things like "http://www.foxitsoftware.com"
// will be detected,
// so applications can allow user to click on those characters to
// activate the link,
// even the PDF doesn't come with link annotations.
//
// FPDFLink_CloseWebLinks must be called to release resources.
//
DLLEXPORT FPDF_PAGELINK STDCALL FPDFLink_LoadWebLinks(FPDF_TEXTPAGE text_page);
// Function: FPDFLink_CountWebLinks
// Count number of detected web links.
// Parameters:
// link_page - Handle returned by FPDFLink_LoadWebLinks.
// Return Value:
// Number of detected web links.
//
DLLEXPORT int STDCALL FPDFLink_CountWebLinks(FPDF_PAGELINK link_page);
// Function: FPDFLink_GetURL
// Fetch the URL information for a detected web link.
// Parameters:
// link_page - Handle returned by FPDFLink_LoadWebLinks.
// link_index - Zero-based index for the link.
// buffer - A unicode buffer for the result.
// buflen - Number of characters (not bytes) for the buffer,
// including an additional terminator.
// Return Value:
// If |buffer| is NULL or |buflen| is zero, return the number of
// characters (not bytes) needed to buffer the result (an additional
// terminator is included in this count).
// Otherwise, copy the result into |buffer|, truncating at |buflen| if
// the result is too large to fit, and return the number of characters
// actually copied into the buffer (the additional terminator is also
// included in this count).
// If |link_index| does not correspond to a valid link, then the result
// is an empty string.
//
DLLEXPORT int STDCALL FPDFLink_GetURL(FPDF_PAGELINK link_page,
int link_index,
unsigned short* buffer,
int buflen);
// Function: FPDFLink_CountRects
// Count number of rectangular areas for the link.
// Parameters:
// link_page - Handle returned by FPDFLink_LoadWebLinks.
// link_index - Zero-based index for the link.
// Return Value:
// Number of rectangular areas for the link. If |link_index| does
// not correspond to a valid link, then 0 is returned.
//
DLLEXPORT int STDCALL FPDFLink_CountRects(FPDF_PAGELINK link_page,
int link_index);
// Function: FPDFLink_GetRect
// Fetch the boundaries of a rectangle for a link.
// Parameters:
// link_page - Handle returned by FPDFLink_LoadWebLinks.
// link_index - Zero-based index for the link.
// rect_index - Zero-based index for a rectangle.
// left - Pointer to a double value receiving the rectangle
// left boundary.
// top - Pointer to a double value receiving the rectangle
// top boundary.
// right - Pointer to a double value receiving the rectangle
// right boundary.
// bottom - Pointer to a double value receiving the rectangle
// bottom boundary.
// Return Value:
// None. If |link_index| does not correspond to a valid link, then
// |left|, |top|, |right|, and |bottom| remain unmodified.
//
DLLEXPORT void STDCALL FPDFLink_GetRect(FPDF_PAGELINK link_page,
int link_index,
int rect_index,
double* left,
double* top,
double* right,
double* bottom);
// Function: FPDFLink_CloseWebLinks
// Release resources used by weblink feature.
// Parameters:
// link_page - Handle returned by FPDFLink_LoadWebLinks.
// Return Value:
// None.
//
DLLEXPORT void STDCALL FPDFLink_CloseWebLinks(FPDF_PAGELINK link_page);
#ifdef __cplusplus
}
#endif
#endif // PUBLIC_FPDF_TEXT_H_

View File

@ -0,0 +1,161 @@
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#ifndef PUBLIC_FPDF_TRANSFORMPAGE_H_
#define PUBLIC_FPDF_TRANSFORMPAGE_H_
// NOLINTNEXTLINE(build/include)
#include "fpdfview.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef void* FPDF_PAGEARCSAVER;
typedef void* FPDF_PAGEARCLOADER;
/**
* Set "MediaBox" entry to the page dictionary.
* @param[in] page - Handle to a page.
* @param[in] left - The left of the rectangle.
* @param[in] bottom - The bottom of the rectangle.
* @param[in] right - The right of the rectangle.
* @param[in] top - The top of the rectangle.
* @retval None.
*/
DLLEXPORT void STDCALL FPDFPage_SetMediaBox(FPDF_PAGE page,
float left,
float bottom,
float right,
float top);
/**
* Set "CropBox" entry to the page dictionary.
* @param[in] page - Handle to a page.
* @param[in] left - The left of the rectangle.
* @param[in] bottom - The bottom of the rectangle.
* @param[in] right - The right of the rectangle.
* @param[in] top - The top of the rectangle.
* @retval None.
*/
DLLEXPORT void STDCALL FPDFPage_SetCropBox(FPDF_PAGE page,
float left,
float bottom,
float right,
float top);
/** Get "MediaBox" entry from the page dictionary.
* @param[in] page - Handle to a page.
* @param[in] left - Pointer to a double value receiving the left of the
* rectangle.
* @param[in] bottom - Pointer to a double value receiving the bottom of the
* rectangle.
* @param[in] right - Pointer to a double value receiving the right of the
* rectangle.
* @param[in] top - Pointer to a double value receiving the top of the
* rectangle.
* @retval True if success,else fail.
*/
DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetMediaBox(FPDF_PAGE page,
float* left,
float* bottom,
float* right,
float* top);
/** Get "CropBox" entry from the page dictionary.
* @param[in] page - Handle to a page.
* @param[in] left - Pointer to a double value receiving the left of the
* rectangle.
* @param[in] bottom - Pointer to a double value receiving the bottom of the
* rectangle.
* @param[in] right - Pointer to a double value receiving the right of the
* rectangle.
* @param[in] top - Pointer to a double value receiving the top of the
* rectangle.
* @retval True if success,else fail.
*/
DLLEXPORT FPDF_BOOL STDCALL FPDFPage_GetCropBox(FPDF_PAGE page,
float* left,
float* bottom,
float* right,
float* top);
/**
* Transform the whole page with a specified matrix, then clip the page content
* region.
*
* @param[in] page - A page handle.
* @param[in] matrix - The transform matrix.
* @param[in] clipRect - A rectangle page area to be clipped.
* @Note. This function will transform the whole page, and would take effect to
* all the objects in the page.
*/
DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page,
FS_MATRIX* matrix,
FS_RECTF* clipRect);
/**
* Transform (scale, rotate, shear, move) the clip path of page object.
* @param[in] page_object - Handle to a page object. Returned by
* FPDFPageObj_NewImageObj.
* @param[in] a - The coefficient "a" of the matrix.
* @param[in] b - The coefficient "b" of the matrix.
* @param[in] c - The coefficient "c" of the matrix.
* @param[in] d - The coefficient "d" of the matrix.
* @param[in] e - The coefficient "e" of the matrix.
* @param[in] f - The coefficient "f" of the matrix.
* @retval None.
*/
DLLEXPORT void STDCALL
FPDFPageObj_TransformClipPath(FPDF_PAGEOBJECT page_object,
double a,
double b,
double c,
double d,
double e,
double f);
/**
* Create a new clip path, with a rectangle inserted.
*
* @param[in] left - The left of the clip box.
* @param[in] bottom - The bottom of the clip box.
* @param[in] right - The right of the clip box.
* @param[in] top - The top of the clip box.
* @retval a handle to the clip path.
*/
DLLEXPORT FPDF_CLIPPATH STDCALL FPDF_CreateClipPath(float left,
float bottom,
float right,
float top);
/**
* Destroy the clip path.
*
* @param[in] clipPath - A handle to the clip path.
* Destroy the clip path.
* @retval None.
*/
DLLEXPORT void STDCALL FPDF_DestroyClipPath(FPDF_CLIPPATH clipPath);
/**
* Clip the page content, the page content that outside the clipping region
* become invisible.
*
* @param[in] page - A page handle.
* @param[in] clipPath - A handle to the clip path.
* @Note. A clip path will be inserted before the page content stream or content
* array. In this way, the page content will be clipped
* by this clip path.
*/
DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page,
FPDF_CLIPPATH clipPath);
#ifdef __cplusplus
}
#endif
#endif // PUBLIC_FPDF_TRANSFORMPAGE_H_

BIN
dependencies/unarr/macx/libunarr.a vendored Normal file

Binary file not shown.

94
dependencies/unarr/macx/unarr.h vendored Normal file
View File

@ -0,0 +1,94 @@
/* Copyright 2015 the unarr project authors (see AUTHORS file).
License: LGPLv3 */
#ifndef unarr_h
#define unarr_h
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
typedef int64_t off64_t;
typedef int64_t time64_t;
#define UNARR_API_VERSION 100
/***** common/stream *****/
typedef struct ar_stream_s ar_stream;
/* opens a read-only stream for the given file path; returns NULL on error */
ar_stream *ar_open_file(const char *path);
#ifdef _WIN32
ar_stream *ar_open_file_w(const wchar_t *path);
#endif
/* opens a read-only stream for the given chunk of memory; the pointer must be valid until ar_close is called */
ar_stream *ar_open_memory(const void *data, size_t datalen);
#ifdef _WIN32
typedef struct IStream IStream;
/* opens a read-only stream based on the given IStream */
ar_stream *ar_open_istream(IStream *stream);
#endif
/* closes the stream and releases underlying resources */
void ar_close(ar_stream *stream);
/* tries to read 'count' bytes into buffer, advancing the read offset pointer; returns the actual number of bytes read */
size_t ar_read(ar_stream *stream, void *buffer, size_t count);
/* moves the read offset pointer (same as fseek); returns false on failure */
bool ar_seek(ar_stream *stream, off64_t offset, int origin);
/* shortcut for ar_seek(stream, count, SEEK_CUR); returns false on failure */
bool ar_skip(ar_stream *stream, off64_t count);
/* returns the current read offset (or 0 on error) */
off64_t ar_tell(ar_stream *stream);
/***** common/unarr *****/
typedef struct ar_archive_s ar_archive;
/* frees all data stored for the given archive; does not close the underlying stream */
void ar_close_archive(ar_archive *ar);
/* reads the next archive entry; returns false on error or at the end of the file (use ar_at_eof to distinguish the two cases) */
bool ar_parse_entry(ar_archive *ar);
/* reads the archive entry at the given offset as returned by ar_entry_get_offset (offset 0 always restarts at the first entry); should always succeed */
bool ar_parse_entry_at(ar_archive *ar, off64_t offset);
/* reads the (first) archive entry associated with the given name; returns false if the entry couldn't be found */
bool ar_parse_entry_for(ar_archive *ar, const char *entry_name);
/* returns whether the last ar_parse_entry call has reached the file's expected end */
bool ar_at_eof(ar_archive *ar);
/* returns the name of the current entry as UTF-8 string; this pointer is only valid until the next call to ar_parse_entry; returns NULL on failure */
const char *ar_entry_get_name(ar_archive *ar);
/* returns the stream offset of the current entry for use with ar_parse_entry_at */
off64_t ar_entry_get_offset(ar_archive *ar);
/* returns the total size of uncompressed data of the current entry; read exactly that many bytes using ar_entry_uncompress */
size_t ar_entry_get_size(ar_archive *ar);
/* returns the stored modification date of the current entry in 100ns since 1601/01/01 */
time64_t ar_entry_get_filetime(ar_archive *ar);
/* WARNING: don't manually seek in the stream between ar_parse_entry and the last corresponding ar_entry_uncompress call! */
/* uncompresses the next 'count' bytes of the current entry into buffer; returns false on error */
bool ar_entry_uncompress(ar_archive *ar, void *buffer, size_t count);
/* copies at most 'count' bytes of the archive's global comment (if any) into buffer; returns the actual amout of bytes copied (or, if 'buffer' is NULL, the required buffer size) */
size_t ar_get_global_comment(ar_archive *ar, void *buffer, size_t count);
/***** rar/rar *****/
/* checks whether 'stream' could contain RAR data and prepares for archive listing/extraction; returns NULL on failure */
ar_archive *ar_open_rar_archive(ar_stream *stream);
/***** tar/tar *****/
/* checks whether 'stream' could contain TAR data and prepares for archive listing/extraction; returns NULL on failure */
ar_archive *ar_open_tar_archive(ar_stream *stream);
/***** zip/zip *****/
/* checks whether 'stream' could contain ZIP data and prepares for archive listing/extraction; returns NULL on failure */
/* set deflatedonly for extracting XPS, EPUB, etc. documents where non-Deflate compression methods are not supported by specification */
ar_archive *ar_open_zip_archive(ar_stream *stream, bool deflatedonly);
/***** _7z/_7z *****/
/* checks whether 'stream' could contain 7Z data and prepares for archive listing/extraction; returns NULL on failure */
ar_archive *ar_open_7z_archive(ar_stream *stream);
#endif

View File

@ -1,17 +1,42 @@
#!/bin/bash
/Users/luisangel/my_dev/Qt5.5.1/5.5/clang_64/bin/macdeployqt YACReader.app
/Users/luisangel/my_dev/Qt5.5.1/5.5/clang_64/bin/macdeployqt YACReaderLibrary.app -qmldir=./YACReaderLibrary/qml
/Users/luisangel/my_dev/Qt5.5.1/5.5/clang_64/bin/macdeployqt YACReaderLibraryServer.app
hash macdeployqt 2>/dev/null || { echo >&2 "Qmake command not available. Please add the bin subfolder of your Qt installation to the PATH environment variable."; exit 1; }
cp -R ./utils ./YACReader.app/Contents/MacOS/
cp -R ./utils ./YACReaderLibrary.app/Contents/MacOS/
cp -R ./utils ./YACReaderLibraryServer.app/Contents/MacOS/
cp -R ./release/server ./YACReaderLibrary.app/Contents/MacOS/
cp -R ./release/server ./YACReaderLibraryServer.app/Contents/MacOS/
cp -R ./release/languages ./YACReader.app/Contents/MacOS/
cp -R ./release/languages ./YACReaderLibrary.app/Contents/MacOS/
cp -R ./release/languages ./YACReaderLibraryServer.app/Contents/MacOS/
macdeployqt YACReader.app
macdeployqt YACReaderLibrary.app -qmldir=YACReaderLibrary/qml
macdeployqt YACReaderLibraryServer.app
#TODO: This copies unneeded stuff into the respective apps
#cp -R utils YACReader.app/Contents/MacOS/
#cp -R utils YACReaderLibrary.app/Contents/MacOS/
#cp -R utils YACReaderLibraryServer.app/Contents/MacOS/
mkdir -p YACReaderLibrary.app/Contents/MacOS/utils
cp -L /usr/local/bin/qrencode YACReaderLibrary.app/Contents/MacOS/utils/
#TODO: avoid using fixed paths here. Get the info from otool instead!
cp /usr/local/Cellar/qrencode/3.4.4/lib/libqrencode.3.dylib \
YACReaderLibrary.app/Contents/MacOS/utils
cp /usr/local/opt/libpng/lib/libpng16.16.dylib \
YACReaderLibrary.app/Contents/MacOS/utils
chmod +w YACReaderLibrary.app/Contents/MacOS/utils/*
install_name_tool -change /usr/local/Cellar/qrencode/3.4.4/lib/libqrencode.3.dylib \
@executable_path/utils/libqrencode.3.dylib \
YACReaderLibrary.app/Contents/MacOS/utils/qrencode
install_name_tool -change /usr/local/opt/libpng/libpng16.16.dylib \
@executable_path/utils/libpng16.16.dylib \
YACReaderLibrary.app/Contents/MacOS/utils/qrencode
cp -R release/server YACReaderLibrary.app/Contents/MacOS/
cp -R release/server YACReaderLibraryServer.app/Contents/MacOS/
cp -R release/languages YACReader.app/Contents/MacOS/
cp -R release/languages YACReaderLibrary.app/Contents/MacOS/
cp -R release/languages YACReaderLibraryServer.app/Contents/MacOS/
echo "Copied!"
#./signapps.sh