diff --git a/INSTALL.txt b/INSTALL.txt index d222325f..80a95500 100644 --- a/INSTALL.txt +++ b/INSTALL.txt @@ -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 \ No newline at end of file +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 ;) \ No newline at end of file diff --git a/YACReader/YACReader.pro b/YACReader/YACReader.pro index 7c1d16e2..4d5332c0 100644 --- a/YACReader/YACReader.pro +++ b/YACReader/YACReader.pro @@ -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" -} +} \ No newline at end of file diff --git a/YACReaderLibrary/YACReaderLibrary.pro b/YACReaderLibrary/YACReaderLibrary.pro index 669cfd95..c9a5a0d0 100644 --- a/YACReaderLibrary/YACReaderLibrary.pro +++ b/YACReaderLibrary/YACReaderLibrary.pro @@ -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") diff --git a/YACReaderLibraryServer/YACReaderLibraryServer.pro b/YACReaderLibraryServer/YACReaderLibraryServer.pro index ecc4c7b0..a12c3313 100644 --- a/YACReaderLibraryServer/YACReaderLibraryServer.pro +++ b/YACReaderLibraryServer/YACReaderLibraryServer.pro @@ -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 -} +} \ No newline at end of file diff --git a/YACReaderLibraryServer/headless_config.pri b/YACReaderLibraryServer/headless_config.pri index fd5601b8..db4c9463 100644 --- a/YACReaderLibraryServer/headless_config.pri +++ b/YACReaderLibraryServer/headless_config.pri @@ -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") } } -} \ No newline at end of file +} diff --git a/cleanOSX.sh b/cleanOSX.sh index 5923cf7a..a1757f06 100755 --- a/cleanOSX.sh +++ b/cleanOSX.sh @@ -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 .. diff --git a/compileOSX.sh b/compileOSX.sh index b5a34ed8..2c68cde3 100755 --- a/compileOSX.sh +++ b/compileOSX.sh @@ -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!" diff --git a/compressed_archive/unarr/compressed_archive.cpp b/compressed_archive/unarr/compressed_archive.cpp index b7594986..98709cb0 100644 --- a/compressed_archive/unarr/compressed_archive.cpp +++ b/compressed_archive/unarr/compressed_archive.cpp @@ -6,7 +6,7 @@ #include "extract_delegate.h" extern"C" { -#include "unarr.h" +#include } CompressedArchive::CompressedArchive(const QString & filePath, QObject *parent) : diff --git a/compressed_archive/unarr/compressed_archive.h b/compressed_archive/unarr/compressed_archive.h index c0a99938..3aa4d3ab 100644 --- a/compressed_archive/unarr/compressed_archive.h +++ b/compressed_archive/unarr/compressed_archive.h @@ -4,7 +4,7 @@ #include #include "extract_delegate.h" extern"C" { -#include "unarr.h" +#include } class CompressedArchive : public QObject diff --git a/compressed_archive/unarr/unarr-wrapper.pri b/compressed_archive/unarr/unarr-wrapper.pri index 2ba188c6..be06f62a 100644 --- a/compressed_archive/unarr/unarr-wrapper.pri +++ b/compressed_archive/unarr/unarr-wrapper.pri @@ -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) - } \ No newline at end of file + } diff --git a/config.pri b/config.pri index 0d4733bd..57156670 100644 --- a/config.pri +++ b/config.pri @@ -26,15 +26,21 @@ CONFIG(no_opengl) { !CONFIG(unarr):!CONFIG(7zip) { unix { - !macx { - CONFIG+=unarr - } - else { - CONFIG+=7zip - } - + CONFIG += unarr } win32 { - CONFIG+=7zip - } -} \ No newline at end of file + CONFIG += 7zip + } +} + +win32:!CONFIG(poppler):!CONFIG(pdfium) { + CONFIG += poppler +} + +unix:!macx:!CONFIG(poppler):!CONFIG(pdfium) { + CONFIG += poppler +} + +macx:!CONFIG(pdfkit):!CONFIG(pdfium) { + CONFIG += pdfium +} diff --git a/create-dmg b/create-dmg deleted file mode 100755 index b581913f..00000000 --- a/create-dmg +++ /dev/null @@ -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©" - 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 diff --git a/dependencies/pdf_backend.pri b/dependencies/pdf_backend.pri new file mode 100644 index 00000000..b05c022b --- /dev/null +++ b/dependencies/pdf_backend.pri @@ -0,0 +1,49 @@ +CONFIG(no_pdf) { + DEFINES += "NO_PDF" +} + +CONFIG(pdfium) { + DEFINES += "USE_PDFIUM" + SOURCES += ../common/pdf_comic.cpp + win32 { + INCLUDEPATH += ../dependencies/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 { + LIBS += -Lpoppler/lib -lpoppler-qt5 + INCLUDEPATH += poppler/include/qt5 + } + unix:!macx { + INCLUDEPATH += /usr/include/poppler/qt5 + LIBS += -L/usr/lib -lpoppler-qt5 + } + unix:macx { + error (Poppler backend is currently not supported on macOS) + } +} diff --git a/dependencies/pdfium/macx/bin/libpdfium.a b/dependencies/pdfium/macx/bin/libpdfium.a new file mode 100644 index 00000000..f1b38ae4 Binary files /dev/null and b/dependencies/pdfium/macx/bin/libpdfium.a differ diff --git a/dependencies/pdfium/public/DEPS b/dependencies/pdfium/macx/include/DEPS similarity index 100% rename from dependencies/pdfium/public/DEPS rename to dependencies/pdfium/macx/include/DEPS diff --git a/dependencies/pdfium/public/README b/dependencies/pdfium/macx/include/README similarity index 100% rename from dependencies/pdfium/public/README rename to dependencies/pdfium/macx/include/README diff --git a/dependencies/pdfium/macx/include/cpp/fpdf_deleters.h b/dependencies/pdfium/macx/include/cpp/fpdf_deleters.h new file mode 100644 index 00000000..d56daf5c --- /dev/null +++ b/dependencies/pdfium/macx/include/cpp/fpdf_deleters.h @@ -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_ diff --git a/dependencies/pdfium/public/fpdf_dataavail.h b/dependencies/pdfium/macx/include/fpdf_dataavail.h similarity index 100% rename from dependencies/pdfium/public/fpdf_dataavail.h rename to dependencies/pdfium/macx/include/fpdf_dataavail.h diff --git a/dependencies/pdfium/public/fpdf_doc.h b/dependencies/pdfium/macx/include/fpdf_doc.h similarity index 100% rename from dependencies/pdfium/public/fpdf_doc.h rename to dependencies/pdfium/macx/include/fpdf_doc.h diff --git a/dependencies/pdfium/macx/include/fpdf_edit.h b/dependencies/pdfium/macx/include/fpdf_edit.h new file mode 100644 index 00000000..4d06c2a0 --- /dev/null +++ b/dependencies/pdfium/macx/include/fpdf_edit.h @@ -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 + +// 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_ diff --git a/dependencies/pdfium/public/fpdf_ext.h b/dependencies/pdfium/macx/include/fpdf_ext.h similarity index 100% rename from dependencies/pdfium/public/fpdf_ext.h rename to dependencies/pdfium/macx/include/fpdf_ext.h diff --git a/dependencies/pdfium/public/fpdf_flatten.h b/dependencies/pdfium/macx/include/fpdf_flatten.h similarity index 100% rename from dependencies/pdfium/public/fpdf_flatten.h rename to dependencies/pdfium/macx/include/fpdf_flatten.h diff --git a/dependencies/pdfium/public/fpdf_formfill.h b/dependencies/pdfium/macx/include/fpdf_formfill.h similarity index 100% rename from dependencies/pdfium/public/fpdf_formfill.h rename to dependencies/pdfium/macx/include/fpdf_formfill.h diff --git a/dependencies/pdfium/public/fpdf_fwlevent.h b/dependencies/pdfium/macx/include/fpdf_fwlevent.h similarity index 100% rename from dependencies/pdfium/public/fpdf_fwlevent.h rename to dependencies/pdfium/macx/include/fpdf_fwlevent.h diff --git a/dependencies/pdfium/public/fpdf_ppo.h b/dependencies/pdfium/macx/include/fpdf_ppo.h similarity index 100% rename from dependencies/pdfium/public/fpdf_ppo.h rename to dependencies/pdfium/macx/include/fpdf_ppo.h diff --git a/dependencies/pdfium/public/fpdf_progressive.h b/dependencies/pdfium/macx/include/fpdf_progressive.h similarity index 100% rename from dependencies/pdfium/public/fpdf_progressive.h rename to dependencies/pdfium/macx/include/fpdf_progressive.h diff --git a/dependencies/pdfium/public/fpdf_save.h b/dependencies/pdfium/macx/include/fpdf_save.h similarity index 100% rename from dependencies/pdfium/public/fpdf_save.h rename to dependencies/pdfium/macx/include/fpdf_save.h diff --git a/dependencies/pdfium/macx/include/fpdf_searchex.h b/dependencies/pdfium/macx/include/fpdf_searchex.h new file mode 100644 index 00000000..a795a523 --- /dev/null +++ b/dependencies/pdfium/macx/include/fpdf_searchex.h @@ -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_ diff --git a/dependencies/pdfium/macx/include/fpdf_structtree.h b/dependencies/pdfium/macx/include/fpdf_structtree.h new file mode 100644 index 00000000..9cf46cc3 --- /dev/null +++ b/dependencies/pdfium/macx/include/fpdf_structtree.h @@ -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_ diff --git a/dependencies/pdfium/public/fpdf_sysfontinfo.h b/dependencies/pdfium/macx/include/fpdf_sysfontinfo.h similarity index 100% rename from dependencies/pdfium/public/fpdf_sysfontinfo.h rename to dependencies/pdfium/macx/include/fpdf_sysfontinfo.h diff --git a/dependencies/pdfium/public/fpdf_text.h b/dependencies/pdfium/macx/include/fpdf_text.h similarity index 100% rename from dependencies/pdfium/public/fpdf_text.h rename to dependencies/pdfium/macx/include/fpdf_text.h diff --git a/dependencies/pdfium/public/fpdf_transformpage.h b/dependencies/pdfium/macx/include/fpdf_transformpage.h similarity index 100% rename from dependencies/pdfium/public/fpdf_transformpage.h rename to dependencies/pdfium/macx/include/fpdf_transformpage.h diff --git a/dependencies/pdfium/macx/include/fpdfview.h b/dependencies/pdfium/macx/include/fpdfview.h new file mode 100644 index 00000000..0ed9187f --- /dev/null +++ b/dependencies/pdfium/macx/include/fpdfview.h @@ -0,0 +1,1035 @@ +// 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 + +// NOTE: External docs refer to this file as "fpdfview.h", so do not rename +// despite lack of consistency with other public files. + +#ifndef PUBLIC_FPDFVIEW_H_ +#define PUBLIC_FPDFVIEW_H_ + +#if defined(_WIN32) && !defined(__WINDOWS__) +#include +#endif + +#ifdef PDF_ENABLE_XFA +// PDF_USE_XFA is set in confirmation that this version of PDFium can support +// XFA forms as requested by the PDF_ENABLE_XFA setting. +#define PDF_USE_XFA +#endif // PDF_ENABLE_XFA + +// PDF types +typedef void* FPDF_ACTION; +typedef void* FPDF_BITMAP; +typedef void* FPDF_BOOKMARK; +typedef void* FPDF_CLIPPATH; +typedef void* FPDF_DEST; +typedef void* FPDF_DOCUMENT; +typedef void* FPDF_FONT; +typedef void* FPDF_LINK; +typedef void* FPDF_PAGE; +typedef void* FPDF_PAGELINK; +typedef void* FPDF_PAGEOBJECT; // Page object(text, path, etc) +typedef void* FPDF_PAGERANGE; +typedef void* FPDF_RECORDER; +typedef void* FPDF_SCHHANDLE; +typedef void* FPDF_STRUCTELEMENT; +typedef void* FPDF_STRUCTTREE; +typedef void* FPDF_TEXTPAGE; + +#ifdef PDF_ENABLE_XFA +typedef void* FPDF_STRINGHANDLE; +typedef void* FPDF_WIDGET; +#endif // PDF_ENABLE_XFA + +// Basic data types +typedef int FPDF_BOOL; +typedef int FPDF_ERROR; +typedef unsigned long FPDF_DWORD; +typedef float FS_FLOAT; + +#ifdef PDF_ENABLE_XFA +typedef void* FPDF_LPVOID; +typedef void const* FPDF_LPCVOID; +typedef char const* FPDF_LPCSTR; +typedef int FPDF_RESULT; +#endif + +// Duplex types +typedef enum _FPDF_DUPLEXTYPE_ { + DuplexUndefined = 0, + Simplex, + DuplexFlipShortEdge, + DuplexFlipLongEdge +} FPDF_DUPLEXTYPE; + +// String types +typedef unsigned short FPDF_WCHAR; +typedef unsigned char const* FPDF_LPCBYTE; + +// FPDFSDK may use three types of strings: byte string, wide string (UTF-16LE +// encoded), and platform dependent string +typedef const char* FPDF_BYTESTRING; + +// FPDFSDK always uses UTF-16LE encoded wide strings, each character uses 2 +// bytes (except surrogation), with the low byte first. +typedef const unsigned short* FPDF_WIDESTRING; + +#ifdef PDF_ENABLE_XFA +// Structure for a byte string. +// Note, a byte string commonly means a UTF-16LE formated string. +typedef struct _FPDF_BSTR { + // String buffer. + char* str; + // Length of the string, in bytes. + int len; +} FPDF_BSTR; +#endif // PDF_ENABLE_XFA + +// For Windows programmers: In most cases it's OK to treat FPDF_WIDESTRING as a +// Windows unicode string, however, special care needs to be taken if you +// expect to process Unicode larger than 0xffff. +// +// For Linux/Unix programmers: most compiler/library environments use 4 bytes +// for a Unicode character, and you have to convert between FPDF_WIDESTRING and +// system wide string by yourself. +typedef const char* FPDF_STRING; + +// Matrix for transformation. +typedef struct _FS_MATRIX_ { + float a; + float b; + float c; + float d; + float e; + float f; +} FS_MATRIX; + +// Rectangle area(float) in device or page coordinate system. +typedef struct _FS_RECTF_ { + // The x-coordinate of the left-top corner. + float left; + // The y-coordinate of the left-top corner. + float top; + // The x-coordinate of the right-bottom corner. + float right; + // The y-coordinate of the right-bottom corner. + float bottom; +} * FS_LPRECTF, FS_RECTF; + +// Const Pointer to FS_RECTF structure. +typedef const FS_RECTF* FS_LPCRECTF; + +#if defined(_WIN32) && defined(FPDFSDK_EXPORTS) +// On Windows system, functions are exported in a DLL +#define DLLEXPORT __declspec(dllexport) +#define STDCALL __stdcall +#else +#define DLLEXPORT +#define STDCALL +#endif + +// Exported Functions +#ifdef __cplusplus +extern "C" { +#endif + +// Function: FPDF_InitLibrary +// Initialize the FPDFSDK library +// Parameters: +// None +// Return value: +// None. +// Comments: +// Convenience function to call FPDF_InitLibraryWithConfig() for +// backwards comatibility purposes. +DLLEXPORT void STDCALL FPDF_InitLibrary(); + +// Process-wide options for initializing the library. +typedef struct FPDF_LIBRARY_CONFIG_ { + // Version number of the interface. Currently must be 2. + int version; + + // Array of paths to scan in place of the defaults when using built-in + // FXGE font loading code. The array is terminated by a NULL pointer. + // The Array may be NULL itself to use the default paths. May be ignored + // entirely depending upon the platform. + const char** m_pUserFontPaths; + + // Version 2. + + // pointer to the v8::Isolate to use, or NULL to force PDFium to create one. + void* m_pIsolate; + + // The embedder data slot to use in the v8::Isolate to store PDFium's + // per-isolate data. The value needs to be between 0 and + // v8::Internals::kNumIsolateDataLots (exclusive). Note that 0 is fine + // for most embedders. + unsigned int m_v8EmbedderSlot; +} FPDF_LIBRARY_CONFIG; + +// Function: FPDF_InitLibraryWithConfig +// Initialize the FPDFSDK library +// Parameters: +// config - configuration information as above. +// Return value: +// None. +// Comments: +// You have to call this function before you can call any PDF +// processing functions. +DLLEXPORT void STDCALL FPDF_InitLibraryWithConfig( + const FPDF_LIBRARY_CONFIG* config); + +// Function: FPDF_DestroyLibary +// Release all resources allocated by the FPDFSDK library. +// Parameters: +// None. +// Return value: +// None. +// Comments: +// You can call this function to release all memory blocks allocated by +// the library. +// After this function is called, you should not call any PDF +// processing functions. +DLLEXPORT void STDCALL FPDF_DestroyLibrary(); + +// Policy for accessing the local machine time. +#define FPDF_POLICY_MACHINETIME_ACCESS 0 + +// Function: FPDF_SetSandBoxPolicy +// Set the policy for the sandbox environment. +// Parameters: +// policy - The specified policy for setting, for example: +// FPDF_POLICY_MACHINETIME_ACCESS. +// enable - True to enable, false to disable the policy. +// Return value: +// None. +DLLEXPORT void STDCALL FPDF_SetSandBoxPolicy(FPDF_DWORD policy, + FPDF_BOOL enable); + +#if defined(_WIN32) +#if defined(PDFIUM_PRINT_TEXT_WITH_GDI) +// Pointer to a helper function to make |font| with |text| of |text_length| +// accessible when printing text with GDI. This is useful in sandboxed +// environments where PDFium's access to GDI may be restricted. +typedef void (*PDFiumEnsureTypefaceCharactersAccessible)(const LOGFONT* font, + const wchar_t* text, + size_t text_length); + +// Function: FPDF_SetTypefaceAccessibleFunc +// Set the function pointer that makes GDI fonts available in sandboxed +// environments. Experimental API. +// Parameters: +// func - A function pointer. See description above. +// Return value: +// None. +DLLEXPORT void STDCALL +FPDF_SetTypefaceAccessibleFunc(PDFiumEnsureTypefaceCharactersAccessible func); + +// Function: FPDF_SetPrintTextWithGDI +// Set whether to use GDI to draw fonts when printing on Windows. +// Experimental API. +// Parameters: +// use_gdi - Set to true to enable printing text with GDI. +// Return value: +// None. +DLLEXPORT void STDCALL FPDF_SetPrintTextWithGDI(FPDF_BOOL use_gdi); +#endif // PDFIUM_PRINT_TEXT_WITH_GDI + +// Function: FPDF_SetPrintPostscriptLevel +// Set postscript printing level when printing on Windows. +// Experimental API. +// Parameters: +// postscript_level - 0 to disable postscript printing, +// 2 to print with postscript level 2, +// 3 to print with postscript level 3. +// All other values are invalid. +// Return value: +// True if successful, false if unsucessful (typically invalid input). +DLLEXPORT FPDF_BOOL STDCALL +FPDF_SetPrintPostscriptLevel(FPDF_BOOL postscript_level); +#endif // defined(_WIN32) + +// Function: FPDF_LoadDocument +// Open and load a PDF document. +// Parameters: +// file_path - Path to the PDF file (including extension). +// password - A string used as the password for the PDF file. +// If no password is needed, empty or NULL can be used. +// Return value: +// A handle to the loaded document, or NULL on failure. +// Comments: +// Loaded document can be closed by FPDF_CloseDocument(). +// If this function fails, you can use FPDF_GetLastError() to retrieve +// the reason why it failed. +DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path, + FPDF_BYTESTRING password); + +// Function: FPDF_LoadMemDocument +// Open and load a PDF document from memory. +// Parameters: +// data_buf - Pointer to a buffer containing the PDF document. +// size - Number of bytes in the PDF document. +// password - A string used as the password for the PDF file. +// If no password is needed, empty or NULL can be used. +// Return value: +// A handle to the loaded document, or NULL on failure. +// Comments: +// The memory buffer must remain valid when the document is open. +// The loaded document can be closed by FPDF_CloseDocument. +// If this function fails, you can use FPDF_GetLastError() to retrieve +// the reason why it failed. +// Notes: +// If PDFium is built with the XFA module, the application should call +// FPDF_LoadXFA() function after the PDF document loaded to support XFA +// fields defined in the fpdfformfill.h file. +DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadMemDocument(const void* data_buf, + int size, + FPDF_BYTESTRING password); + +// Structure for custom file access. +typedef struct { + // File length, in bytes. + unsigned long m_FileLen; + + // A function pointer for getting a block of data from a specific position. + // Position is specified by byte offset from the beginning of the file. + // The position and size will never go out of range of the file length. + // It may be possible for FPDFSDK to call this function multiple times for + // the same position. + // Return value: should be non-zero if successful, zero for error. + int (*m_GetBlock)(void* param, + unsigned long position, + unsigned char* pBuf, + unsigned long size); + + // A custom pointer for all implementation specific data. This pointer will + // be used as the first parameter to the m_GetBlock callback. + void* m_Param; +} FPDF_FILEACCESS; + +#ifdef PDF_ENABLE_XFA +/** + * @brief Structure for file reading or writing (I/O). + * + * @note This is a handler and should be implemented by callers. + */ +typedef struct _FPDF_FILEHANDLER { + /** + * @brief User-defined data. + * @note Callers can use this field to track controls. + */ + FPDF_LPVOID clientData; + /** + * @brief Callback function to release the current file stream object. + * + * @param[in] clientData Pointer to user-defined data. + * + * @return None. + */ + void (*Release)(FPDF_LPVOID clientData); + /** + * @brief Callback function to retrieve the current file stream size. + * + * @param[in] clientData Pointer to user-defined data. + * + * @return Size of file stream. + */ + FPDF_DWORD (*GetSize)(FPDF_LPVOID clientData); + /** + * @brief Callback function to read data from the current file stream. + * + * @param[in] clientData Pointer to user-defined data. + * @param[in] offset Offset position starts from the beginning of file + * stream. This parameter indicates reading position. + * @param[in] buffer Memory buffer to store data which are read from + * file stream. This parameter should not be NULL. + * @param[in] size Size of data which should be read from file + * stream, in bytes. The buffer indicated by the parameter buffer + * should be enough to store specified data. + * + * @return 0 for success, other value for failure. + */ + FPDF_RESULT (*ReadBlock)(FPDF_LPVOID clientData, + FPDF_DWORD offset, + FPDF_LPVOID buffer, + FPDF_DWORD size); + /** + * @brief Callback function to write data into the current file stream. + * + * @param[in] clientData Pointer to user-defined data. + * @param[in] offset Offset position starts from the beginning of file + * stream. This parameter indicates writing position. + * @param[in] buffer Memory buffer contains data which is written into + * file stream. This parameter should not be NULL. + * @param[in] size Size of data which should be written into file + * stream, in bytes. + * + * @return 0 for success, other value for failure. + */ + FPDF_RESULT (*WriteBlock)(FPDF_LPVOID clientData, + FPDF_DWORD offset, + FPDF_LPCVOID buffer, + FPDF_DWORD size); + /** + * @brief Callback function to flush all internal accessing buffers. + * + * @param[in] clientData Pointer to user-defined data. + * + * @return 0 for success, other value for failure. + */ + FPDF_RESULT (*Flush)(FPDF_LPVOID clientData); + /** + * @brief Callback function to change file size. + * + * @details This function is called under writing mode usually. Implementer + * can determine whether to realize it based on application requests. + * + * @param[in] clientData Pointer to user-defined data. + * @param[in] size New size of file stream, in bytes. + * + * @return 0 for success, other value for failure. + */ + FPDF_RESULT (*Truncate)(FPDF_LPVOID clientData, FPDF_DWORD size); +} FPDF_FILEHANDLER, *FPDF_LPFILEHANDLER; + +#endif +// Function: FPDF_LoadCustomDocument +// Load PDF document from a custom access descriptor. +// Parameters: +// pFileAccess - A structure for accessing the file. +// password - Optional password for decrypting the PDF file. +// Return value: +// A handle to the loaded document, or NULL on failure. +// Comments: +// The application must keep the file resources valid until the PDF +// document is closed. +// +// The loaded document can be closed with FPDF_CloseDocument. +// Notes: +// If PDFium is built with the XFA module, the application should call +// FPDF_LoadXFA() function after the PDF document loaded to support XFA +// fields defined in the fpdfformfill.h file. +DLLEXPORT FPDF_DOCUMENT STDCALL +FPDF_LoadCustomDocument(FPDF_FILEACCESS* pFileAccess, FPDF_BYTESTRING password); + +// Function: FPDF_GetFileVersion +// Get the file version of the given PDF document. +// Parameters: +// doc - Handle to a document. +// fileVersion - The PDF file version. File version: 14 for 1.4, 15 +// for 1.5, ... +// Return value: +// True if succeeds, false otherwise. +// Comments: +// If the document was created by FPDF_CreateNewDocument, +// then this function will always fail. +DLLEXPORT FPDF_BOOL STDCALL FPDF_GetFileVersion(FPDF_DOCUMENT doc, + int* fileVersion); + +#define FPDF_ERR_SUCCESS 0 // No error. +#define FPDF_ERR_UNKNOWN 1 // Unknown error. +#define FPDF_ERR_FILE 2 // File not found or could not be opened. +#define FPDF_ERR_FORMAT 3 // File not in PDF format or corrupted. +#define FPDF_ERR_PASSWORD 4 // Password required or incorrect password. +#define FPDF_ERR_SECURITY 5 // Unsupported security scheme. +#define FPDF_ERR_PAGE 6 // Page not found or content error. +#ifdef PDF_ENABLE_XFA +#define FPDF_ERR_XFALOAD 7 // Load XFA error. +#define FPDF_ERR_XFALAYOUT 8 // Layout XFA error. +#endif // PDF_ENABLE_XFA + +// Function: FPDF_GetLastError +// Get last error code when a function fails. +// Parameters: +// None. +// Return value: +// A 32-bit integer indicating error code as defined above. +// Comments: +// If the previous SDK call succeeded, the return value of this +// function is not defined. +DLLEXPORT unsigned long STDCALL FPDF_GetLastError(); + +// Function: FPDF_GetDocPermission +// Get file permission flags of the document. +// Parameters: +// document - Handle to a document. Returned by FPDF_LoadDocument. +// Return value: +// A 32-bit integer indicating permission flags. Please refer to the +// PDF Reference for detailed descriptions. If the document is not +// protected, 0xffffffff will be returned. +DLLEXPORT unsigned long STDCALL FPDF_GetDocPermissions(FPDF_DOCUMENT document); + +// Function: FPDF_GetSecurityHandlerRevision +// Get the revision for the security handler. +// Parameters: +// document - Handle to a document. Returned by FPDF_LoadDocument. +// Return value: +// The security handler revision number. Please refer to the PDF +// Reference for a detailed description. If the document is not +// protected, -1 will be returned. +DLLEXPORT int STDCALL FPDF_GetSecurityHandlerRevision(FPDF_DOCUMENT document); + +// Function: FPDF_GetPageCount +// Get total number of pages in the document. +// Parameters: +// document - Handle to document. Returned by FPDF_LoadDocument. +// Return value: +// Total number of pages in the document. +DLLEXPORT int STDCALL FPDF_GetPageCount(FPDF_DOCUMENT document); + +// Function: FPDF_LoadPage +// Load a page inside the document. +// Parameters: +// document - Handle to document. Returned by FPDF_LoadDocument +// page_index - Index number of the page. 0 for the first page. +// Return value: +// A handle to the loaded page, or NULL if page load fails. +// Comments: +// The loaded page can be rendered to devices using FPDF_RenderPage. +// The loaded page can be closed using FPDF_ClosePage. +DLLEXPORT FPDF_PAGE STDCALL FPDF_LoadPage(FPDF_DOCUMENT document, + int page_index); + +// Function: FPDF_GetPageWidth +// Get page width. +// Parameters: +// page - Handle to the page. Returned by FPDF_LoadPage. +// Return value: +// Page width (excluding non-displayable area) measured in points. +// One point is 1/72 inch (around 0.3528 mm). +DLLEXPORT double STDCALL FPDF_GetPageWidth(FPDF_PAGE page); + +// Function: FPDF_GetPageHeight +// Get page height. +// Parameters: +// page - Handle to the page. Returned by FPDF_LoadPage. +// Return value: +// Page height (excluding non-displayable area) measured in points. +// One point is 1/72 inch (around 0.3528 mm) +DLLEXPORT double STDCALL FPDF_GetPageHeight(FPDF_PAGE page); + +// Function: FPDF_GetPageSizeByIndex +// Get the size of the page at the given index. +// Parameters: +// document - Handle to document. Returned by FPDF_LoadDocument. +// page_index - Page index, zero for the first page. +// width - Pointer to a double to receive the page width +// (in points). +// height - Pointer to a double to receive the page height +// (in points). +// Return value: +// Non-zero for success. 0 for error (document or page not found). +DLLEXPORT int STDCALL FPDF_GetPageSizeByIndex(FPDF_DOCUMENT document, + int page_index, + double* width, + double* height); + +// Page rendering flags. They can be combined with bit-wise OR. +// +// Set if annotations are to be rendered. +#define FPDF_ANNOT 0x01 +// Set if using text rendering optimized for LCD display. +#define FPDF_LCD_TEXT 0x02 +// Don't use the native text output available on some platforms +#define FPDF_NO_NATIVETEXT 0x04 +// Grayscale output. +#define FPDF_GRAYSCALE 0x08 +// Set if you want to get some debug info. +#define FPDF_DEBUG_INFO 0x80 +// Set if you don't want to catch exceptions. +#define FPDF_NO_CATCH 0x100 +// Limit image cache size. +#define FPDF_RENDER_LIMITEDIMAGECACHE 0x200 +// Always use halftone for image stretching. +#define FPDF_RENDER_FORCEHALFTONE 0x400 +// Render for printing. +#define FPDF_PRINTING 0x800 +// Set to disable anti-aliasing on text. +#define FPDF_RENDER_NO_SMOOTHTEXT 0x1000 +// Set to disable anti-aliasing on images. +#define FPDF_RENDER_NO_SMOOTHIMAGE 0x2000 +// Set to disable anti-aliasing on paths. +#define FPDF_RENDER_NO_SMOOTHPATH 0x4000 +// Set whether to render in a reverse Byte order, this flag is only used when +// rendering to a bitmap. +#define FPDF_REVERSE_BYTE_ORDER 0x10 + +#ifdef _WIN32 +// Function: FPDF_RenderPage +// Render contents of a page to a device (screen, bitmap, or printer). +// This function is only supported on Windows. +// Parameters: +// dc - Handle to the device context. +// page - Handle to the page. Returned by FPDF_LoadPage. +// start_x - Left pixel position of the display area in +// device coordinates. +// start_y - Top pixel position of the display area in device +// coordinates. +// 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 above. +// Return value: +// None. +DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, + FPDF_PAGE page, + int start_x, + int start_y, + int size_x, + int size_y, + int rotate, + int flags); +#endif + +// Function: FPDF_RenderPageBitmap +// Render contents of a page to a device independent bitmap. +// Parameters: +// bitmap - Handle to the device independent bitmap (as the +// output buffer). The bitmap handle can be created +// by FPDFBitmap_Create. +// page - Handle to the page. Returned by FPDF_LoadPage +// start_x - Left pixel position of the display area in +// bitmap coordinates. +// start_y - Top pixel position of the display area in bitmap +// coordinates. +// 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 the Page +// Rendering flags defined above. With the FPDF_ANNOT +// flag, it renders all annotations that do not require +// user-interaction, which are all annotations except +// widget and popup annotations. +// Return value: +// None. +DLLEXPORT void STDCALL FPDF_RenderPageBitmap(FPDF_BITMAP bitmap, + FPDF_PAGE page, + int start_x, + int start_y, + int size_x, + int size_y, + int rotate, + int flags); + +// Function: FPDF_RenderPageBitmapWithMatrix +// Render contents of a page to a device independent bitmap. +// Parameters: +// bitmap - Handle to the device independent bitmap (as the +// output buffer). The bitmap handle can be created +// by FPDFBitmap_Create. +// page - Handle to the page. Returned by FPDF_LoadPage +// matrix - The transform matrix. +// clipping - The rect to clip to. +// flags - 0 for normal display, or combination of the Page +// Rendering flags defined above. With the FPDF_ANNOT +// flag, it renders all annotations that do not require +// user-interaction, which are all annotations except +// widget and popup annotations. +// Return value: +// None. +DLLEXPORT void STDCALL FPDF_RenderPageBitmapWithMatrix(FPDF_BITMAP bitmap, + FPDF_PAGE page, + const FS_MATRIX* matrix, + const FS_RECTF* clipping, + int flags); + +#ifdef _SKIA_SUPPORT_ +DLLEXPORT FPDF_RECORDER STDCALL FPDF_RenderPageSkp(FPDF_PAGE page, + int size_x, + int size_y); +#endif + +// Function: FPDF_ClosePage +// Close a loaded PDF page. +// Parameters: +// page - Handle to the loaded page. +// Return value: +// None. +DLLEXPORT void STDCALL FPDF_ClosePage(FPDF_PAGE page); + +// Function: FPDF_CloseDocument +// Close a loaded PDF document. +// Parameters: +// document - Handle to the loaded document. +// Return value: +// None. +DLLEXPORT void STDCALL FPDF_CloseDocument(FPDF_DOCUMENT document); + +// Function: FPDF_DeviceToPage +// Convert the screen coordinates of a point to page coordinates. +// Parameters: +// page - Handle to the page. Returned by FPDF_LoadPage. +// start_x - Left pixel position of the display area in +// device coordinates. +// start_y - Top pixel position of the display area in device +// coordinates. +// 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) +// device_x - X value in device coordinates to be converted. +// device_y - Y value in device coordinates to be converted. +// page_x - A pointer to a double receiving the converted X +// value in page coordinates. +// page_y - A pointer to a double receiving the converted Y +// value in page coordinates. +// Return value: +// None. +// Comments: +// The page coordinate system has its origin at the left-bottom corner +// of the page, with the X-axis on the bottom going to the right, and +// the Y-axis on the left side going up. +// +// NOTE: this coordinate system can be altered when you zoom, scroll, +// or rotate a page, however, a point on the page should always have +// the same coordinate values in the page coordinate system. +// +// The device coordinate system is device dependent. For screen device, +// its origin is at the left-top corner of the window. However this +// origin can be altered by the Windows coordinate transformation +// utilities. +// +// You must make sure the start_x, start_y, size_x, size_y +// and rotate parameters have exactly same values as you used in +// the FPDF_RenderPage() function call. +DLLEXPORT void STDCALL FPDF_DeviceToPage(FPDF_PAGE page, + int start_x, + int start_y, + int size_x, + int size_y, + int rotate, + int device_x, + int device_y, + double* page_x, + double* page_y); + +// Function: FPDF_PageToDevice +// Convert the page coordinates of a point to screen coordinates. +// Parameters: +// page - Handle to the page. Returned by FPDF_LoadPage. +// start_x - Left pixel position of the display area in +// device coordinates. +// start_y - Top pixel position of the display area in device +// coordinates. +// 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) +// page_x - X value in page coordinates. +// page_y - Y value in page coordinate. +// device_x - A pointer to an integer receiving the result X +// value in device coordinates. +// device_y - A pointer to an integer receiving the result Y +// value in device coordinates. +// Return value: +// None. +// Comments: +// See comments for FPDF_DeviceToPage(). +DLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page, + int start_x, + int start_y, + int size_x, + int size_y, + int rotate, + double page_x, + double page_y, + int* device_x, + int* device_y); + +// Function: FPDFBitmap_Create +// Create a device independent bitmap (FXDIB). +// Parameters: +// width - The number of pixels in width for the bitmap. +// Must be greater than 0. +// height - The number of pixels in height for the bitmap. +// Must be greater than 0. +// alpha - A flag indicating whether the alpha channel is used. +// Non-zero for using alpha, zero for not using. +// Return value: +// The created bitmap handle, or NULL if a parameter error or out of +// memory. +// Comments: +// The bitmap always uses 4 bytes per pixel. The first byte is always +// double word aligned. +// +// The byte order is BGRx (the last byte unused if no alpha channel) or +// BGRA. +// +// The pixels in a horizontal line are stored side by side, with the +// left most pixel stored first (with lower memory address). +// Each line uses width * 4 bytes. +// +// Lines are stored one after another, with the top most line stored +// first. There is no gap between adjacent lines. +// +// This function allocates enough memory for holding all pixels in the +// bitmap, but it doesn't initialize the buffer. Applications can use +// FPDFBitmap_FillRect to fill the bitmap using any color. +DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create(int width, + int height, + int alpha); + +// More DIB formats +// Gray scale bitmap, one byte per pixel. +#define FPDFBitmap_Gray 1 +// 3 bytes per pixel, byte order: blue, green, red. +#define FPDFBitmap_BGR 2 +// 4 bytes per pixel, byte order: blue, green, red, unused. +#define FPDFBitmap_BGRx 3 +// 4 bytes per pixel, byte order: blue, green, red, alpha. +#define FPDFBitmap_BGRA 4 + +// Function: FPDFBitmap_CreateEx +// Create a device independent bitmap (FXDIB) +// Parameters: +// width - The number of pixels in width for the bitmap. +// Must be greater than 0. +// height - The number of pixels in height for the bitmap. +// Must be greater than 0. +// format - A number indicating for bitmap format, as defined +// above. +// first_scan - A pointer to the first byte of the first line if +// using an external buffer. If this parameter is NULL, +// then the a new buffer will be created. +// stride - Number of bytes for each scan line, for external +// buffer only. +// Return value: +// The bitmap handle, or NULL if parameter error or out of memory. +// Comments: +// Similar to FPDFBitmap_Create function, but allows for more formats +// and an external buffer is supported. The bitmap created by this +// function can be used in any place that a FPDF_BITMAP handle is +// required. +// +// If an external buffer is used, then the application should destroy +// the buffer by itself. FPDFBitmap_Destroy function will not destroy +// the buffer. +DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width, + int height, + int format, + void* first_scan, + int stride); + +// Function: FPDFBitmap_FillRect +// Fill a rectangle in a bitmap. +// Parameters: +// bitmap - The handle to the bitmap. Returned by +// FPDFBitmap_Create. +// left - The left position. Starting from 0 at the +// left-most pixel. +// top - The top position. Starting from 0 at the +// top-most line. +// width - Width in pixels to be filled. +// height - Height in pixels to be filled. +// color - A 32-bit value specifing the color, in 8888 ARGB +// format. +// Return value: +// None. +// Comments: +// This function sets the color and (optionally) alpha value in the +// specified region of the bitmap. +// +// NOTE: If the alpha channel is used, this function does NOT +// composite the background with the source color, instead the +// background will be replaced by the source color and the alpha. +// +// If the alpha channel is not used, the alpha parameter is ignored. +DLLEXPORT void STDCALL FPDFBitmap_FillRect(FPDF_BITMAP bitmap, + int left, + int top, + int width, + int height, + FPDF_DWORD color); + +// Function: FPDFBitmap_GetBuffer +// Get data buffer of a bitmap. +// Parameters: +// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. +// Return value: +// The pointer to the first byte of the bitmap buffer. +// Comments: +// The stride may be more than width * number of bytes per pixel +// +// Applications can use this function to get the bitmap buffer pointer, +// then manipulate any color and/or alpha values for any pixels in the +// bitmap. +// +// The data is in BGRA format. Where the A maybe unused if alpha was +// not specified. +DLLEXPORT void* STDCALL FPDFBitmap_GetBuffer(FPDF_BITMAP bitmap); + +// Function: FPDFBitmap_GetWidth +// Get width of a bitmap. +// Parameters: +// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. +// Return value: +// The width of the bitmap in pixels. +DLLEXPORT int STDCALL FPDFBitmap_GetWidth(FPDF_BITMAP bitmap); + +// Function: FPDFBitmap_GetHeight +// Get height of a bitmap. +// Parameters: +// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. +// Return value: +// The height of the bitmap in pixels. +DLLEXPORT int STDCALL FPDFBitmap_GetHeight(FPDF_BITMAP bitmap); + +// Function: FPDFBitmap_GetStride +// Get number of bytes for each line in the bitmap buffer. +// Parameters: +// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. +// Return value: +// The number of bytes for each line in the bitmap buffer. +// Comments: +// The stride may be more than width * number of bytes per pixel. +DLLEXPORT int STDCALL FPDFBitmap_GetStride(FPDF_BITMAP bitmap); + +// Function: FPDFBitmap_Destroy +// Destroy a bitmap and release all related buffers. +// Parameters: +// bitmap - Handle to the bitmap. Returned by FPDFBitmap_Create. +// Return value: +// None. +// Comments: +// This function will not destroy any external buffers provided when +// the bitmap was created. +DLLEXPORT void STDCALL FPDFBitmap_Destroy(FPDF_BITMAP bitmap); + +// Function: FPDF_VIEWERREF_GetPrintScaling +// Whether the PDF document prefers to be scaled or not. +// Parameters: +// document - Handle to the loaded document. +// Return value: +// None. +DLLEXPORT FPDF_BOOL STDCALL +FPDF_VIEWERREF_GetPrintScaling(FPDF_DOCUMENT document); + +// Function: FPDF_VIEWERREF_GetNumCopies +// Returns the number of copies to be printed. +// Parameters: +// document - Handle to the loaded document. +// Return value: +// The number of copies to be printed. +DLLEXPORT int STDCALL FPDF_VIEWERREF_GetNumCopies(FPDF_DOCUMENT document); + +// Function: FPDF_VIEWERREF_GetPrintPageRange +// Page numbers to initialize print dialog box when file is printed. +// Parameters: +// document - Handle to the loaded document. +// Return value: +// The print page range to be used for printing. +DLLEXPORT FPDF_PAGERANGE STDCALL +FPDF_VIEWERREF_GetPrintPageRange(FPDF_DOCUMENT document); + +// Function: FPDF_VIEWERREF_GetDuplex +// Returns the paper handling option to be used when printing from +// the print dialog. +// Parameters: +// document - Handle to the loaded document. +// Return value: +// The paper handling option to be used when printing. +DLLEXPORT FPDF_DUPLEXTYPE STDCALL +FPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT document); + +// Function: FPDF_VIEWERREF_GetName +// Gets the contents for a viewer ref, with a given key. The value must +// be of type "name". +// Parameters: +// document - Handle to the loaded document. +// key - Name of the key in the viewer pref dictionary. +// buffer - A string to write the contents of the key to. +// length - Length of the buffer. +// Return value: +// The number of bytes in the contents, including the NULL terminator. +// Thus if the return value is 0, then that indicates an error, such +// as when |document| is invalid or |buffer| is NULL. If |length| is +// less than the returned length, or |buffer| is NULL, |buffer| will +// not be modified. +DLLEXPORT unsigned long STDCALL FPDF_VIEWERREF_GetName(FPDF_DOCUMENT document, + FPDF_BYTESTRING key, + char* buffer, + unsigned long length); + +// Function: FPDF_CountNamedDests +// Get the count of named destinations in the PDF document. +// Parameters: +// document - Handle to a document +// Return value: +// The count of named destinations. +DLLEXPORT FPDF_DWORD STDCALL FPDF_CountNamedDests(FPDF_DOCUMENT document); + +// Function: FPDF_GetNamedDestByName +// Get a the destination handle for the given name. +// Parameters: +// document - Handle to the loaded document. +// name - The name of a destination. +// Return value: +// The handle to the destination. +DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDestByName(FPDF_DOCUMENT document, + FPDF_BYTESTRING name); + +// Function: FPDF_GetNamedDest +// Get the named destination by index. +// Parameters: +// document - Handle to a document +// index - The index of a named destination. +// buffer - The buffer to store the destination name, +// used as wchar_t*. +// buflen [in/out] - Size of the buffer in bytes on input, +// length of the result in bytes on output +// or -1 if the buffer is too small. +// Return value: +// The destination handle for a given index, or NULL if there is no +// named destination corresponding to |index|. +// Comments: +// Call this function twice to get the name of the named destination: +// 1) First time pass in |buffer| as NULL and get buflen. +// 2) Second time pass in allocated |buffer| and buflen to retrieve +// |buffer|, which should be used as wchar_t*. +// +// If buflen is not sufficiently large, it will be set to -1 upon +// return. +DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDest(FPDF_DOCUMENT document, + int index, + void* buffer, + long* buflen); + +#ifdef PDF_ENABLE_XFA +// Function: FPDF_BStr_Init +// Helper function to initialize a byte string. +DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Init(FPDF_BSTR* str); + +// Function: FPDF_BStr_Set +// Helper function to set string data. +DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Set(FPDF_BSTR* str, + FPDF_LPCSTR bstr, + int length); + +// Function: FPDF_BStr_Clear +// Helper function to clear a byte string. +DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Clear(FPDF_BSTR* str); +#endif // PDF_ENABLE_XFA + +#ifdef __cplusplus +} +#endif + +#endif // PUBLIC_FPDFVIEW_H_ diff --git a/dependencies/pdfium/win/public/public/DEPS b/dependencies/pdfium/win/public/public/DEPS new file mode 100644 index 00000000..d0005cac --- /dev/null +++ b/dependencies/pdfium/win/public/public/DEPS @@ -0,0 +1,8 @@ +include_rules = [ + # public/ needs to be standalone. Explicitly disallow everything. + '-core', + '-fpdfsdk', + '-testing', + '-third_party', + '-v8', +] diff --git a/dependencies/pdfium/win/public/public/README b/dependencies/pdfium/win/public/public/README new file mode 100644 index 00000000..b07d0f30 --- /dev/null +++ b/dependencies/pdfium/win/public/public/README @@ -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. diff --git a/dependencies/pdfium/win/public/public/fpdf_dataavail.h b/dependencies/pdfium/win/public/public/fpdf_dataavail.h new file mode 100644 index 00000000..2413e2be --- /dev/null +++ b/dependencies/pdfium/win/public/public/fpdf_dataavail.h @@ -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 + +// 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_ diff --git a/dependencies/pdfium/win/public/public/fpdf_doc.h b/dependencies/pdfium/win/public/public/fpdf_doc.h new file mode 100644 index 00000000..9d55a2e8 --- /dev/null +++ b/dependencies/pdfium/win/public/public/fpdf_doc.h @@ -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_ diff --git a/dependencies/pdfium/public/fpdf_edit.h b/dependencies/pdfium/win/public/public/fpdf_edit.h similarity index 100% rename from dependencies/pdfium/public/fpdf_edit.h rename to dependencies/pdfium/win/public/public/fpdf_edit.h diff --git a/dependencies/pdfium/win/public/public/fpdf_ext.h b/dependencies/pdfium/win/public/public/fpdf_ext.h new file mode 100644 index 00000000..34658789 --- /dev/null +++ b/dependencies/pdfium/win/public/public/fpdf_ext.h @@ -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_ diff --git a/dependencies/pdfium/win/public/public/fpdf_flatten.h b/dependencies/pdfium/win/public/public/fpdf_flatten.h new file mode 100644 index 00000000..c1e354e9 --- /dev/null +++ b/dependencies/pdfium/win/public/public/fpdf_flatten.h @@ -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_ diff --git a/dependencies/pdfium/win/public/public/fpdf_formfill.h b/dependencies/pdfium/win/public/public/fpdf_formfill.h new file mode 100644 index 00000000..09b80eaf --- /dev/null +++ b/dependencies/pdfium/win/public/public/fpdf_formfill.h @@ -0,0 +1,1764 @@ +// 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_FORMFILL_H_ +#define PUBLIC_FPDF_FORMFILL_H_ + +// NOLINTNEXTLINE(build/include) +#include "fpdfview.h" + +typedef void* FPDF_FORMHANDLE; + +#ifdef PDF_ENABLE_XFA +#define DOCTYPE_PDF 0 // Normal pdf Document +#define DOCTYPE_DYNAMIC_XFA 1 // Dynamic xfa Document Type +#define DOCTYPE_STATIC_XFA 2 // Static xfa Document Type +#endif // PDF_ENABLE_XFA + +// Exported Functions +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _IPDF_JsPlatform { + /** + * Version number of the interface. Currently must be 2. + **/ + int version; + + /* Version 1. */ + + /** + * Method: app_alert + * pop up a dialog to show warning or hint. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself + * Msg - A string containing the message to be displayed. + * Title - The title of the dialog. + * Type - The stype of button group. + * 0-OK(default); + * 1-OK,Cancel; + * 2-Yes,NO; + * 3-Yes, NO, Cancel. + * nIcon - The Icon type. + * 0-Error(default); + * 1-Warning; + * 2-Question; + * 3-Status. + * 4-Asterisk + * Return Value: + * The return value could be the folowing type: + * 1-OK; + * 2-Cancel; + * 3-NO; + * 4-Yes; + */ + int (*app_alert)(struct _IPDF_JsPlatform* pThis, + FPDF_WIDESTRING Msg, + FPDF_WIDESTRING Title, + int Type, + int Icon); + + /** + * Method: app_beep + * Causes the system to play a sound. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself + * nType - The sound type. + * 0 - Error + * 1 - Warning + * 2 - Question + * 3 - Status + * 4 - Default (default value) + * Return Value: + * None + */ + void (*app_beep)(struct _IPDF_JsPlatform* pThis, int nType); + + /** + * Method: app_response + * Displays a dialog box containing a question and an entry field for + * the user to reply to the question. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself + * Question - The question to be posed to the user. + * Title - The title of the dialog box. + * Default - A default value for the answer to the question. If + * not specified, no default value is presented. + * cLabel - A short string to appear in front of and on the + * same line as the edit text field. + * bPassword - If true, indicates that the user's response should + * show as asterisks (*) or bullets (?) to mask the response, which might be + * sensitive information. The default is false. + * response - A string buffer allocated by SDK, to receive the + * user's response. + * length - The length of the buffer, number of bytes. + * Currently, It's always be 2048. + * Return Value: + * Number of bytes the complete user input would actually require, not + * including trailing zeros, regardless of the value of the length + * parameter or the presence of the response buffer. + * Comments: + * No matter on what platform, the response buffer should be always + * written using UTF-16LE encoding. If a response buffer is + * present and the size of the user input exceeds the capacity of the + * buffer as specified by the length parameter, only the + * first "length" bytes of the user input are to be written to the + * buffer. + */ + int (*app_response)(struct _IPDF_JsPlatform* pThis, + FPDF_WIDESTRING Question, + FPDF_WIDESTRING Title, + FPDF_WIDESTRING Default, + FPDF_WIDESTRING cLabel, + FPDF_BOOL bPassword, + void* response, + int length); + + /* + * Method: Doc_getFilePath + * Get the file path of the current document. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself + * filePath - The string buffer to receive the file path. Can be + * NULL. + * length - The length of the buffer, number of bytes. Can be + * 0. + * Return Value: + * Number of bytes the filePath consumes, including trailing zeros. + * Comments: + * The filePath should be always input in local encoding. + * + * The return value always indicated number of bytes required for the + * buffer , even when there is no buffer specified, or the buffer size is + * less than required. In this case, the buffer will not be modified. + */ + int (*Doc_getFilePath)(struct _IPDF_JsPlatform* pThis, + void* filePath, + int length); + + /* + * Method: Doc_mail + * Mails the data buffer as an attachment to all recipients, with or + * without user interaction. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself + * mailData - Pointer to the data buffer to be sent.Can be NULL. + * length - The size,in bytes, of the buffer pointed by + * mailData parameter.Can be 0. + * bUI - If true, the rest of the parameters are used in a + * compose-new-message window that is displayed to the user. If false, the cTo + * parameter is required and all others are optional. + * To - A semicolon-delimited list of recipients for the + * message. + * Subject - The subject of the message. The length limit is 64 + * KB. + * CC - A semicolon-delimited list of CC recipients for + * the message. + * BCC - A semicolon-delimited list of BCC recipients for + * the message. + * Msg - The content of the message. The length limit is 64 + * KB. + * Return Value: + * None. + * Comments: + * If the parameter mailData is NULL or length is 0, the current + * document will be mailed as an attachment to all recipients. + */ + void (*Doc_mail)(struct _IPDF_JsPlatform* pThis, + void* mailData, + int length, + FPDF_BOOL bUI, + FPDF_WIDESTRING To, + FPDF_WIDESTRING Subject, + FPDF_WIDESTRING CC, + FPDF_WIDESTRING BCC, + FPDF_WIDESTRING Msg); + + /* + * Method: Doc_print + * Prints all or a specific number of pages of the document. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * bUI - If true, will cause a UI to be presented to the + * user to obtain printing information and confirm the action. + * nStart - A 0-based index that defines the start of an + * inclusive range of pages. + * nEnd - A 0-based index that defines the end of an + * inclusive page range. + * bSilent - If true, suppresses the cancel dialog box while + * the document is printing. The default is false. + * bShrinkToFit - If true, the page is shrunk (if necessary) to + * fit within the imageable area of the printed page. + * bPrintAsImage - If true, print pages as an image. + * bReverse - If true, print from nEnd to nStart. + * bAnnotations - If true (the default), annotations are + * printed. + */ + void (*Doc_print)(struct _IPDF_JsPlatform* pThis, + FPDF_BOOL bUI, + int nStart, + int nEnd, + FPDF_BOOL bSilent, + FPDF_BOOL bShrinkToFit, + FPDF_BOOL bPrintAsImage, + FPDF_BOOL bReverse, + FPDF_BOOL bAnnotations); + + /* + * Method: Doc_submitForm + * Send the form data to a specified URL. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself + * formData - Pointer to the data buffer to be sent. + * length - The size,in bytes, of the buffer pointed by + * formData parameter. + * URL - The URL to send to. + * Return Value: + * None. + * + */ + void (*Doc_submitForm)(struct _IPDF_JsPlatform* pThis, + void* formData, + int length, + FPDF_WIDESTRING URL); + + /* + * Method: Doc_gotoPage + * Jump to a specified page. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself + * nPageNum - The specified page number, zero for the first + * page. + * Return Value: + * None. + * + */ + void (*Doc_gotoPage)(struct _IPDF_JsPlatform* pThis, int nPageNum); + /* + * Method: Field_browse + * Show a file selection dialog, and return the selected file path. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * filePath - Pointer to the data buffer to receive the file + * path.Can be NULL. + * length - The length of the buffer, number of bytes. Can be + * 0. + * Return Value: + * Number of bytes the filePath consumes, including trailing zeros. + * Comments: + * The filePath shoule be always input in local encoding. + */ + int (*Field_browse)(struct _IPDF_JsPlatform* pThis, + void* filePath, + int length); + + /** + * pointer to FPDF_FORMFILLINFO interface. + **/ + void* m_pFormfillinfo; + + /* Version 2. */ + + void* m_isolate; /* Unused in v3, retain for compatibility. */ + unsigned int m_v8EmbedderSlot; /* Unused in v3, retain for compatibility. */ + + /* Version 3. */ + /* Version 3 moves m_Isolate and m_v8EmbedderSlot to FPDF_LIBRARY_CONFIG. */ +} IPDF_JSPLATFORM; + +// Flags for Cursor type +#define FXCT_ARROW 0 +#define FXCT_NESW 1 +#define FXCT_NWSE 2 +#define FXCT_VBEAM 3 +#define FXCT_HBEAM 4 +#define FXCT_HAND 5 + +/** + * Function signature for the callback function passed to the FFI_SetTimer + * method. + * Parameters: + * idEvent - Identifier of the timer. + * Return value: + * None. + **/ +typedef void (*TimerCallback)(int idEvent); + +/** + * Declares of a struct type to the local system time. +**/ +typedef struct _FPDF_SYSTEMTIME { + unsigned short wYear; /* years since 1900 */ + unsigned short wMonth; /* months since January - [0,11] */ + unsigned short wDayOfWeek; /* days since Sunday - [0,6] */ + unsigned short wDay; /* day of the month - [1,31] */ + unsigned short wHour; /* hours since midnight - [0,23] */ + unsigned short wMinute; /* minutes after the hour - [0,59] */ + unsigned short wSecond; /* seconds after the minute - [0,59] */ + unsigned short wMilliseconds; /* milliseconds after the second - [0,999] */ +} FPDF_SYSTEMTIME; + +#ifdef PDF_ENABLE_XFA +// XFA +/** + * @name Pageview event flags + */ +/*@{*/ +/** @brief After a new pageview is added. */ +#define FXFA_PAGEVIEWEVENT_POSTADDED 1 +/** @brief After a pageview is removed. */ +#define FXFA_PAGEVIEWEVENT_POSTREMOVED 3 +/*@}*/ + +// menu +/** + * @name Macro Definitions for Right Context Menu Features Of XFA Fields + */ +/*@{*/ +#define FXFA_MENU_COPY 1 +#define FXFA_MENU_CUT 2 +#define FXFA_MENU_SELECTALL 4 +#define FXFA_MENU_UNDO 8 +#define FXFA_MENU_REDO 16 +#define FXFA_MENU_PASTE 32 +/*@}*/ + +// file type +/** + * @name Macro Definitions for File Type. + */ +/*@{*/ +#define FXFA_SAVEAS_XML 1 +#define FXFA_SAVEAS_XDP 2 +/*@}*/ +#endif // PDF_ENABLE_XFA + +typedef struct _FPDF_FORMFILLINFO { + /** + * Version number of the interface. Currently must be 1 (when PDFium is built + * without the XFA module) or must be 2 (when built with the XFA module). + **/ + int version; + + /* Version 1. */ + /** + *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_FORMFILLINFO* pThis); + + /** + * Method: FFI_Invalidate + * Invalidate the client area within the specified rectangle. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * page - Handle to the page. Returned by FPDF_LoadPage + *function. + * left - Left position of the client area in PDF page + *coordinate. + * top - Top position of the client area in PDF page + *coordinate. + * right - Right position of the client area in PDF page + *coordinate. + * bottom - Bottom position of the client area in PDF page + *coordinate. + * Return Value: + * None. + * + *comments: + * All positions are measured in PDF "user space". + * Implementation should call FPDF_RenderPageBitmap() function for + *repainting a specified page area. + */ + void (*FFI_Invalidate)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_PAGE page, + double left, + double top, + double right, + double bottom); + + /** + * Method: FFI_OutputSelectedRect + * When user is taking the mouse to select texts on a form field, + * this callback function will keep + * returning the selected areas to the implementation. + * + * Interface Version: + * 1 + * Implementation Required: + * No + * Parameters: + * pThis - Pointer to the interface structure itself. + * page - Handle to the page. Returned by FPDF_LoadPage + * function. + * left - Left position of the client area in PDF page + * coordinate. + * top - Top position of the client area in PDF page + * coordinate. + * right - Right position of the client area in PDF page + * coordinate. + * bottom - Bottom position of the client area in PDF page + * coordinate. + * Return Value: + * None. + * + * comments: + * This CALLBACK function is useful for implementing special text + * selection effect. Implementation should + * first records the returned rectangles, then draw them one by one + * at the painting period, last,remove all + * the recorded rectangles when finish painting. + */ + void (*FFI_OutputSelectedRect)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_PAGE page, + double left, + double top, + double right, + double bottom); + + /** + * Method: FFI_SetCursor + * Set the Cursor shape. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * nCursorType - Cursor type. see Flags for Cursor type for the + * details. + * Return value: + * None. + * */ + void (*FFI_SetCursor)(struct _FPDF_FORMFILLINFO* pThis, int nCursorType); + + /** + * Method: FFI_SetTimer + * This method installs a system timer. An interval value is specified, + * and every time that interval elapses, the system must call into the + * callback function with the timer ID as returned by this function. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * uElapse - Specifies the time-out value, in milliseconds. + * lpTimerFunc - A pointer to the callback function-TimerCallback. + * Return value: + * The timer identifier of the new timer if the function is successful. + * An application passes this value to the FFI_KillTimer method to kill + * the timer. Nonzero if it is successful; otherwise, it is zero. + * */ + int (*FFI_SetTimer)(struct _FPDF_FORMFILLINFO* pThis, + int uElapse, + TimerCallback lpTimerFunc); + + /** + * Method: FFI_KillTimer + * This method uninstalls a system timer identified by nIDEvent, as + * set by an earlier call to FFI_SetTimer. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * nTimerID - The timer ID returned by FFI_SetTimer function. + * Return value: + * None. + * */ + void (*FFI_KillTimer)(struct _FPDF_FORMFILLINFO* pThis, int nTimerID); + + /** + * Method: FFI_GetLocalTime + * This method receives the current local time on the system. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * Return value: + * None. + * */ + FPDF_SYSTEMTIME (*FFI_GetLocalTime)(struct _FPDF_FORMFILLINFO* pThis); + + /** + * Method: FFI_OnChange + * This method will be invoked to notify implementation when the + * value of any FormField on the document had been changed. + * Interface Version: + * 1 + * Implementation Required: + * no + * Parameters: + * pThis - Pointer to the interface structure itself. + * Return value: + * None. + * */ + void (*FFI_OnChange)(struct _FPDF_FORMFILLINFO* pThis); + + /** + * Method: FFI_GetPage + * This method receives the page pointer associated with a specified + * page index. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * document - Handle to document. Returned by FPDF_LoadDocument + * function. + * nPageIndex - Index number of the page. 0 for the first page. + * Return value: + * Handle to the page. Returned by FPDF_LoadPage function. + * Comments: + * In some cases, the document-level JavaScript action may refer to a + * page which hadn't been loaded yet. + * To successfully run the javascript action, implementation need to load + * the page for SDK. + * */ + FPDF_PAGE (*FFI_GetPage)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_DOCUMENT document, + int nPageIndex); + + /** + * Method: FFI_GetCurrentPage + * This method receives the current page pointer. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * document - Handle to document. Returned by FPDF_LoadDocument + * function. + * Return value: + * Handle to the page. Returned by FPDF_LoadPage function. + * */ + FPDF_PAGE (*FFI_GetCurrentPage)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_DOCUMENT document); + + /** + * Method: FFI_GetRotation + * This method receives currently rotation of the page view. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * page - Handle to page. Returned by FPDF_LoadPage function. + * Return value: + * The page rotation. Should be 0(0 degree),1(90 degree),2(180 + * degree),3(270 degree), in a clockwise direction. + * + * Note: Unused. + * */ + int (*FFI_GetRotation)(struct _FPDF_FORMFILLINFO* pThis, FPDF_PAGE page); + + /** + * Method: FFI_ExecuteNamedAction + * This method will execute an named action. + * Interface Version: + * 1 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * namedAction - A byte string which indicates the named action, + * terminated by 0. + * Return value: + * None. + * Comments: + * See the named actions description of <> + * for more details. + * */ + void (*FFI_ExecuteNamedAction)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_BYTESTRING namedAction); + /** + * @brief This method will be called when a text field is getting or losing a + * focus. + * + * @param[in] pThis Pointer to the interface structure itself. + * @param[in] value The string value of the form field, in UTF-16LE + * format. + * @param[in] valueLen The length of the string value, number of characters + * (not bytes). + * @param[in] is_focus True if the form field is getting a focus, False for + * losing a focus. + * + * @return None. + * + * @note Currently,only support text field and combobox field. + * */ + void (*FFI_SetTextFieldFocus)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_WIDESTRING value, + FPDF_DWORD valueLen, + FPDF_BOOL is_focus); + + /** + * Method: FFI_DoURIAction + * This action resolves to a uniform resource identifier. + * Interface Version: + * 1 + * Implementation Required: + * No + * Parameters: + * pThis - Pointer to the interface structure itself. + * bsURI - A byte string which indicates the uniform resource + * identifier, terminated by 0. + * Return value: + * None. + * Comments: + * See the URI actions description of <> for + * more details. + * */ + void (*FFI_DoURIAction)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_BYTESTRING bsURI); + + /** + * Method: FFI_DoGoToAction + * This action changes the view to a specified destination. + * Interface Version: + * 1 + * Implementation Required: + * No + * Parameters: + * pThis - Pointer to the interface structure itself. + * nPageIndex - The index of the PDF page. + * zoomMode - The zoom mode for viewing page. See below. + * fPosArray - The float array which carries the position info. + * sizeofArray - The size of float array. + * + * PDFZoom values: + * - XYZ = 1 + * - FITPAGE = 2 + * - FITHORZ = 3 + * - FITVERT = 4 + * - FITRECT = 5 + * - FITBBOX = 6 + * - FITBHORZ = 7 + * - FITBVERT = 8 + * + * Return value: + * None. + * Comments: + * See the Destinations description of <> in + *8.2.1 for more details. + **/ + void (*FFI_DoGoToAction)(struct _FPDF_FORMFILLINFO* pThis, + int nPageIndex, + int zoomMode, + float* fPosArray, + int sizeofArray); + + /** + * pointer to IPDF_JSPLATFORM interface + **/ + IPDF_JSPLATFORM* m_pJsPlatform; + +#ifdef PDF_ENABLE_XFA + /* Version 2. */ + /** + * Method: FFI_DisplayCaret + * This method will show the caret at specified position. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * page - Handle to page. Returned by FPDF_LoadPage + *function. + * left - Left position of the client area in PDF page + *coordinate. + * top - Top position of the client area in PDF page + *coordinate. + * right - Right position of the client area in PDF page + *coordinate. + * bottom - Bottom position of the client area in PDF page + *coordinate. + * Return value: + * None. + **/ + void (*FFI_DisplayCaret)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_PAGE page, + FPDF_BOOL bVisible, + double left, + double top, + double right, + double bottom); + + /** + * Method: FFI_GetCurrentPageIndex + * This method will get the current page index. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * document - Handle to document. Returned by FPDF_LoadDocument + *function. + * Return value: + * The index of current page. + **/ + int (*FFI_GetCurrentPageIndex)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_DOCUMENT document); + + /** + * Method: FFI_SetCurrentPage + * This method will set the current page. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * document - Handle to document. Returned by FPDF_LoadDocument + *function. + * iCurPage - The index of the PDF page. + * Return value: + * None. + **/ + void (*FFI_SetCurrentPage)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_DOCUMENT document, + int iCurPage); + + /** + * Method: FFI_GotoURL + * This method will link to the specified URL. + * Interface Version: + * 2 + * Implementation Required: + * no + * Parameters: + * pThis - Pointer to the interface structure itself. + * document - Handle to document. Returned by FPDF_LoadDocument + *function. + * wsURL - The string value of the URL, in UTF-16LE format. + * Return value: + * None. + **/ + void (*FFI_GotoURL)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_DOCUMENT document, + FPDF_WIDESTRING wsURL); + + /** + * Method: FFI_GetPageViewRect + * This method will get the current page view rectangle. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * page - Handle to page. Returned by FPDF_LoadPage + *function. + * left - The pointer to receive left position of the page + *view area in PDF page coordinate. + * top - The pointer to receive top position of the page + *view area in PDF page coordinate. + * right - The pointer to receive right position of the + *client area in PDF page coordinate. + * bottom - The pointer to receive bottom position of the + *client area in PDF page coordinate. + * Return value: + * None. + **/ + void (*FFI_GetPageViewRect)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_PAGE page, + double* left, + double* top, + double* right, + double* bottom); + + /** + * Method: FFI_PageEvent + * This method fires when pages have been added to or deleted from the XFA + * document. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * page_count - The number of pages to be added to or deleted from the + * document. + * event_type - See FXFA_PAGEVIEWEVENT_* above. + * Return value: + * None. + * Comments: + * The pages to be added or deleted always start from the last page + * of document. This means that if parameter page_count is 2 and + * event type is FXFA_PAGEVIEWEVENT_POSTADDED, 2 new pages have been + * appended to the tail of document; If page_count is 2 and + * event type is FXFA_PAGEVIEWEVENT_POSTREMOVED, the last 2 pages + * have been deleted. + **/ + void (*FFI_PageEvent)(struct _FPDF_FORMFILLINFO* pThis, + int page_count, + FPDF_DWORD event_type); + + /** + * Method: FFI_PopupMenu + * This method will track the right context menu for XFA fields. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * page - Handle to page. Returned by FPDF_LoadPage + *function. + * hWidget - Handle to XFA fields. + * menuFlag - The menu flags. Please refer to macro definition + *of FXFA_MENU_XXX and this can be one or a combination of these macros. + * x - X position of the client area in PDF page + *coordinate. + * y - Y position of the client area in PDF page + *coordinate. + * Return value: + * TRUE indicates success; otherwise false. + **/ + FPDF_BOOL (*FFI_PopupMenu)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_PAGE page, + FPDF_WIDGET hWidget, + int menuFlag, + float x, + float y); + + /** + * Method: FFI_OpenFile + * This method will open the specified file with the specified mode. + * Interface Version + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * fileFlag - The file flag.Please refer to macro definition of + *FXFA_SAVEAS_XXX and this can be one of these macros. + * wsURL - The string value of the file URL, in UTF-16LE + *format. + * mode - The mode for open file. + * Return value: + * The handle to FPDF_FILEHANDLER. + **/ + FPDF_FILEHANDLER* (*FFI_OpenFile)(struct _FPDF_FORMFILLINFO* pThis, + int fileFlag, + FPDF_WIDESTRING wsURL, + const char* mode); + + /** + * Method: FFI_EmailTo + * This method will email the specified file stream to the specified + *contacter. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * pFileHandler - Handle to the FPDF_FILEHANDLER. + * pTo - A semicolon-delimited list of recipients for the + *message,in UTF-16LE format. + * pSubject - The subject of the message,in UTF-16LE format. + * pCC - A semicolon-delimited list of CC recipients for + *the message,in UTF-16LE format. + * pBcc - A semicolon-delimited list of BCC recipients for + *the message,in UTF-16LE format. + * pMsg - Pointer to the data buffer to be sent.Can be + *NULL,in UTF-16LE format. + * Return value: + * None. + **/ + void (*FFI_EmailTo)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_FILEHANDLER* fileHandler, + FPDF_WIDESTRING pTo, + FPDF_WIDESTRING pSubject, + FPDF_WIDESTRING pCC, + FPDF_WIDESTRING pBcc, + FPDF_WIDESTRING pMsg); + + /** + * Method: FFI_UploadTo + * This method will get upload the specified file stream to the + *specified URL. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * pFileHandler - Handle to the FPDF_FILEHANDLER. + * fileFlag - The file flag.Please refer to macro definition of + *FXFA_SAVEAS_XXX and this can be one of these macros. + * uploadTo - Pointer to the URL path, in UTF-16LE format. + * Return value: + * None. + **/ + void (*FFI_UploadTo)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_FILEHANDLER* fileHandler, + int fileFlag, + FPDF_WIDESTRING uploadTo); + + /** + * Method: FFI_GetPlatform + * This method will get the current platform. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * platform - Pointer to the data buffer to receive the + *platform.Can be NULL,in UTF-16LE format. + * length - The length of the buffer, number of bytes. Can be + *0. + * Return value: + * The length of the buffer, number of bytes. + **/ + int (*FFI_GetPlatform)(struct _FPDF_FORMFILLINFO* pThis, + void* platform, + int length); + + /** + * Method: FFI_GetLanguage + * This method will get the current language. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * language - Pointer to the data buffer to receive the current + *language.Can be NULL. + * length - The length of the buffer, number of bytes. Can be + *0. + * Return value: + * The length of the buffer, number of bytes. + **/ + int (*FFI_GetLanguage)(struct _FPDF_FORMFILLINFO* pThis, + void* language, + int length); + + /** + * Method: FFI_DownloadFromURL + * This method will download the specified file from the URL. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * URL - The string value of the file URL, in UTF-16LE + *format. + * Return value: + * The handle to FPDF_FILEHANDLER. + **/ + FPDF_LPFILEHANDLER (*FFI_DownloadFromURL)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_WIDESTRING URL); + /** + * Method: FFI_PostRequestURL + * This method will post the request to the server URL. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * wsURL - The string value of the server URL, in UTF-16LE + *format. + * wsData - The post data,in UTF-16LE format. + * wsContentType - The content type of the request data,in UTF-16LE + *format. + * wsEncode - The encode type,in UTF-16LE format. + * wsHeader - The request header,in UTF-16LE format. + * response - Pointer to the FPDF_BSTR to receive the response + *data from server,,in UTF-16LE format. + * Return value: + * TRUE indicates success, otherwise FALSE. + **/ + FPDF_BOOL (*FFI_PostRequestURL)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_WIDESTRING wsURL, + FPDF_WIDESTRING wsData, + FPDF_WIDESTRING wsContentType, + FPDF_WIDESTRING wsEncode, + FPDF_WIDESTRING wsHeader, + FPDF_BSTR* respone); + + /** + * Method: FFI_PutRequestURL + * This method will put the request to the server URL. + * Interface Version: + * 2 + * Implementation Required: + * yes + * Parameters: + * pThis - Pointer to the interface structure itself. + * wsURL - The string value of the server URL, in UTF-16LE + *format. + * wsData - The put data, in UTF-16LE format. + * wsEncode - The encode type, in UTR-16LE format. + * Return value: + * TRUE indicates success, otherwise FALSE. + **/ + FPDF_BOOL (*FFI_PutRequestURL)(struct _FPDF_FORMFILLINFO* pThis, + FPDF_WIDESTRING wsURL, + FPDF_WIDESTRING wsData, + FPDF_WIDESTRING wsEncode); +#endif // PDF_ENABLE_XFA +} FPDF_FORMFILLINFO; + +/** + * Function: FPDFDOC_InitFormFillEnvironment + * Init form fill environment. + * Comments: + * This function should be called before any form fill operation. + * Parameters: + * document - Handle to document. Returned by + *FPDF_LoadDocument function. + * pFormFillInfo - Pointer to a FPDF_FORMFILLINFO structure. + * Return Value: + * Return handler to the form fill module. NULL means fails. + **/ +DLLEXPORT FPDF_FORMHANDLE STDCALL +FPDFDOC_InitFormFillEnvironment(FPDF_DOCUMENT document, + FPDF_FORMFILLINFO* formInfo); + +/** + * Function: FPDFDOC_ExitFormFillEnvironment + * Exit form fill environment. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * Return Value: + * NULL. + **/ +DLLEXPORT void STDCALL FPDFDOC_ExitFormFillEnvironment(FPDF_FORMHANDLE hHandle); + +/** + * Function: FORM_OnAfterLoadPage + * This method is required for implementing all the form related + *functions. Should be invoked after user + * successfully loaded a PDF page, and method + *FPDFDOC_InitFormFillEnvironment had been invoked. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * Return Value: + * NONE. + **/ +DLLEXPORT void STDCALL FORM_OnAfterLoadPage(FPDF_PAGE page, + FPDF_FORMHANDLE hHandle); + +/** + * Function: FORM_OnBeforeClosePage + * This method is required for implementing all the form related + *functions. Should be invoked before user + * close the PDF page. + * Parameters: + * page - Handle to the page. Returned by FPDF_LoadPage + *function. + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * Return Value: + * NONE. + **/ +DLLEXPORT void STDCALL FORM_OnBeforeClosePage(FPDF_PAGE page, + FPDF_FORMHANDLE hHandle); + +/** +* Function: FORM_DoDocumentJSAction +* This method is required for performing Document-level JavaScript +*action. It should be invoked after the PDF document +* had been loaded. +* Parameters: +* hHandle - Handle to the form fill module. Returned by +*FPDFDOC_InitFormFillEnvironment. +* Return Value: +* NONE +* Comments: +* If there is Document-level JavaScript action embedded in the +*document, this method will execute the javascript action; +* otherwise, the method will do nothing. +**/ +DLLEXPORT void STDCALL FORM_DoDocumentJSAction(FPDF_FORMHANDLE hHandle); + +/** +* Function: FORM_DoDocumentOpenAction +* This method is required for performing open-action when the document +*is opened. +* Parameters: +* hHandle - Handle to the form fill module. Returned by +*FPDFDOC_InitFormFillEnvironment. +* Return Value: +* NONE +* Comments: +* This method will do nothing if there is no open-actions embedded in +*the document. +**/ +DLLEXPORT void STDCALL FORM_DoDocumentOpenAction(FPDF_FORMHANDLE hHandle); + +// additional actions type of document. +#define FPDFDOC_AACTION_WC \ + 0x10 // WC, before closing document, JavaScript action. +#define FPDFDOC_AACTION_WS \ + 0x11 // WS, before saving document, JavaScript action. +#define FPDFDOC_AACTION_DS 0x12 // DS, after saving document, JavaScript + // action. +#define FPDFDOC_AACTION_WP \ + 0x13 // WP, before printing document, JavaScript action. +#define FPDFDOC_AACTION_DP \ + 0x14 // DP, after printing document, JavaScript action. + +/** +* Function: FORM_DoDocumentAAction +* This method is required for performing the document's +*additional-action. +* Parameters: +* hHandle - Handle to the form fill module. Returned by +*FPDFDOC_InitFormFillEnvironment. +* aaType - The type of the additional-actions which defined +*above. +* Return Value: +* NONE +* Comments: +* This method will do nothing if there is no document +*additional-action corresponding to the specified aaType. +**/ + +DLLEXPORT void STDCALL FORM_DoDocumentAAction(FPDF_FORMHANDLE hHandle, + int aaType); + +// Additional-action types of page object +#define FPDFPAGE_AACTION_OPEN \ + 0 // /O -- An action to be performed when the page is opened +#define FPDFPAGE_AACTION_CLOSE \ + 1 // /C -- An action to be performed when the page is closed + +/** +* Function: FORM_DoPageAAction +* This method is required for performing the page object's +*additional-action when opened or closed. +* Parameters: +* page - Handle to the page. Returned by FPDF_LoadPage +*function. +* hHandle - Handle to the form fill module. Returned by +*FPDFDOC_InitFormFillEnvironment. +* aaType - The type of the page object's additional-actions +*which defined above. +* Return Value: +* NONE +* Comments: +* This method will do nothing if no additional-action corresponding to +*the specified aaType exists. +**/ +DLLEXPORT void STDCALL FORM_DoPageAAction(FPDF_PAGE page, + FPDF_FORMHANDLE hHandle, + int aaType); + +/** + * Function: FORM_OnMouseMove + * You can call this member function when the mouse cursor moves. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * page - Handle to the page. Returned by FPDF_LoadPage + *function. + * modifier - Indicates whether various virtual keys are down. + * page_x - Specifies the x-coordinate of the cursor in PDF user + *space. + * page_y - Specifies the y-coordinate of the cursor in PDF user + *space. + * Return Value: + * TRUE indicates success; otherwise false. + **/ +DLLEXPORT FPDF_BOOL STDCALL FORM_OnMouseMove(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + int modifier, + double page_x, + double page_y); + +/** + * Function: FORM_OnLButtonDown + * You can call this member function when the user presses the left + *mouse button. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * page - Handle to the page. Returned by FPDF_LoadPage + *function. + * modifier - Indicates whether various virtual keys are down. + * page_x - Specifies the x-coordinate of the cursor in PDF user + *space. + * page_y - Specifies the y-coordinate of the cursor in PDF user + *space. + * Return Value: + * TRUE indicates success; otherwise false. + **/ +DLLEXPORT FPDF_BOOL STDCALL FORM_OnLButtonDown(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + int modifier, + double page_x, + double page_y); + +/** + * Function: FORM_OnLButtonUp + * You can call this member function when the user releases the left + *mouse button. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * page - Handle to the page. Returned by FPDF_LoadPage + *function. + * modifier - Indicates whether various virtual keys are down. + * page_x - Specifies the x-coordinate of the cursor in device. + * page_y - Specifies the y-coordinate of the cursor in device. + * Return Value: + * TRUE indicates success; otherwise false. + **/ +DLLEXPORT FPDF_BOOL STDCALL FORM_OnLButtonUp(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + int modifier, + double page_x, + double page_y); + +#ifdef PDF_ENABLE_XFA +DLLEXPORT FPDF_BOOL STDCALL FORM_OnRButtonDown(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + int modifier, + double page_x, + double page_y); +DLLEXPORT FPDF_BOOL STDCALL FORM_OnRButtonUp(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + int modifier, + double page_x, + double page_y); +#endif // PDF_ENABLE_XFA + +/** + * Function: FORM_OnKeyDown + * You can call this member function when a nonsystem key is pressed. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * page - Handle to the page. Returned by FPDF_LoadPage + *function. + * nKeyCode - Indicates whether various virtual keys are down. + * modifier - Contains the scan code, key-transition code, + *previous key state, and context code. + * Return Value: + * TRUE indicates success; otherwise false. + **/ +DLLEXPORT FPDF_BOOL STDCALL FORM_OnKeyDown(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + int nKeyCode, + int modifier); + +/** + * Function: FORM_OnKeyUp + * You can call this member function when a nonsystem key is released. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * page - Handle to the page. Returned by FPDF_LoadPage + *function. + * nKeyCode - The virtual-key code of the given key. + * modifier - Contains the scan code, key-transition code, + *previous key state, and context code. + * Return Value: + * TRUE indicates success; otherwise false. + **/ +DLLEXPORT FPDF_BOOL STDCALL FORM_OnKeyUp(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + int nKeyCode, + int modifier); + +/** + * Function: FORM_OnChar + * You can call this member function when a keystroke translates to a + *nonsystem character. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * page - Handle to the page. Returned by FPDF_LoadPage + *function. + * nChar - The character code value of the key. + * modifier - Contains the scan code, key-transition code, + *previous key state, and context code. + * Return Value: + * TRUE indicates success; otherwise false. + **/ +DLLEXPORT FPDF_BOOL STDCALL FORM_OnChar(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + int nChar, + int modifier); + +/** + * Function: FORM_ForceToKillFocus. + * You can call this member function to force to kill the focus of the + *form field which got focus. + * It would kill the focus on the form field, save the value of form + *field if it's changed by user. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * Return Value: + * TRUE indicates success; otherwise false. + **/ +DLLEXPORT FPDF_BOOL STDCALL FORM_ForceToKillFocus(FPDF_FORMHANDLE hHandle); + +// Field Types +#define FPDF_FORMFIELD_UNKNOWN 0 // Unknown. +#define FPDF_FORMFIELD_PUSHBUTTON 1 // push button type. +#define FPDF_FORMFIELD_CHECKBOX 2 // check box type. +#define FPDF_FORMFIELD_RADIOBUTTON 3 // radio button type. +#define FPDF_FORMFIELD_COMBOBOX 4 // combo box type. +#define FPDF_FORMFIELD_LISTBOX 5 // list box type. +#define FPDF_FORMFIELD_TEXTFIELD 6 // text field type. +#ifdef PDF_ENABLE_XFA +#define FPDF_FORMFIELD_XFA 7 // text field type. +#endif // PDF_ENABLE_XFA + +/** + * Function: FPDFPage_HasFormFieldAtPoint + * Get the form field type by point. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + * FPDFDOC_InitFormFillEnvironment(). + * page - Handle to the page. Returned by FPDF_LoadPage(). + * page_x - X position in PDF "user space". + * page_y - Y position in PDF "user space". + * Return Value: + * Return the type of the form field; -1 indicates no field. + * See field types above. + **/ +DLLEXPORT int STDCALL FPDFPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + double page_x, + double page_y); + +/** + * Function: FPDPage_HasFormFieldAtPoint + * DEPRECATED. Please use FPDFPage_HasFormFieldAtPoint. + **/ +DLLEXPORT int STDCALL FPDPage_HasFormFieldAtPoint(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + double page_x, + double page_y); + +/** + * Function: FPDFPage_FormFieldZOrderAtPoint + * Get the form field z-order by point. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + * FPDFDOC_InitFormFillEnvironment(). + * page - Handle to the page. Returned by FPDF_LoadPage(). + * page_x - X position in PDF "user space". + * page_y - Y position in PDF "user space". + * Return Value: + * Return the z-order of the form field; -1 indicates no field. + * Higher numbers are closer to the front. + **/ +DLLEXPORT int STDCALL FPDFPage_FormFieldZOrderAtPoint(FPDF_FORMHANDLE hHandle, + FPDF_PAGE page, + double page_x, + double page_y); + +/** + * Function: FPDF_SetFormFieldHighlightColor + * Set the highlight color of specified or all the form fields in the + *document. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * doc - Handle to the document. Returned by + *FPDF_LoadDocument function. + * fieldType - A 32-bit integer indicating the type of a form + *field(defined above). + * color - The highlight color of the form field.Constructed by + *0xxxrrggbb. + * Return Value: + * NONE. + * Comments: + * When the parameter fieldType is set to zero, the highlight color + *will be applied to all the form fields in the + * document. + * Please refresh the client window to show the highlight immediately + *if necessary. + **/ +DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightColor(FPDF_FORMHANDLE hHandle, + int fieldType, + unsigned long color); + +/** + * Function: FPDF_SetFormFieldHighlightAlpha + * Set the transparency of the form field highlight color in the + *document. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * doc - Handle to the document. Returned by + *FPDF_LoadDocument function. + * alpha - The transparency of the form field highlight color. + *between 0-255. + * Return Value: + * NONE. + **/ +DLLEXPORT void STDCALL FPDF_SetFormFieldHighlightAlpha(FPDF_FORMHANDLE hHandle, + unsigned char alpha); + +/** + * Function: FPDF_RemoveFormFieldHighlight + * Remove the form field highlight color in the document. + * Parameters: + * hHandle - Handle to the form fill module. Returned by + *FPDFDOC_InitFormFillEnvironment. + * Return Value: + * NONE. + * Comments: + * Please refresh the client window to remove the highlight immediately + *if necessary. + **/ +DLLEXPORT void STDCALL FPDF_RemoveFormFieldHighlight(FPDF_FORMHANDLE hHandle); + +/** +* Function: FPDF_FFLDraw +* Render FormFields and popup window on a page to a device independent +*bitmap. +* Parameters: +* hHandle - Handle to the form fill module. Returned by +*FPDFDOC_InitFormFillEnvironment. +* 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 +*device coordinate. +* start_y - Top pixel position of the display area in the device +*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 above. +* Return Value: +* None. +* Comments: +* This function is designed to render annotations that are +*user-interactive, which are widget annotation (for FormFields) and popup +*annotation. +* With FPDF_ANNOT flag, this function will render popup annotation +*when users mouse-hover on non-widget annotation. Regardless of FPDF_ANNOT flag, +*this function will always render widget annotations for FormFields. +* In order to implement the FormFill functions, implementation should +*call this function after rendering functions, such as FPDF_RenderPageBitmap or +*FPDF_RenderPageBitmap_Start, finish rendering the page contents. +**/ +DLLEXPORT void STDCALL FPDF_FFLDraw(FPDF_FORMHANDLE hHandle, + FPDF_BITMAP bitmap, + FPDF_PAGE page, + int start_x, + int start_y, + int size_x, + int size_y, + int rotate, + int flags); + +#ifdef _SKIA_SUPPORT_ +DLLEXPORT void STDCALL FPDF_FFLRecord(FPDF_FORMHANDLE hHandle, + FPDF_RECORDER recorder, + FPDF_PAGE page, + int start_x, + int start_y, + int size_x, + int size_y, + int rotate, + int flags); +#endif + +#ifdef PDF_ENABLE_XFA +/** + * Function: FPDF_HasXFAField + * This method is designed to check whether a pdf document + *has XFA fields. + * Parameters: + * document - Handle to document. + *Returned by FPDF_LoadDocument function. + * docType - Document type defined as + *DOCTYPE_xxx. + * Return Value: + * TRUE indicates that the input document has XFA fields, + *otherwise FALSE. + **/ +DLLEXPORT FPDF_BOOL STDCALL FPDF_HasXFAField(FPDF_DOCUMENT document, + int* docType); + +/** + * Function: FPDF_LoadXFA + * If the document consists of XFA fields, there should call this + *method to load XFA fields. + * Parameters: + * document - Handle to document. Returned by + *FPDF_LoadDocument function. + * Return Value: + * TRUE indicates success,otherwise FALSE. + **/ +DLLEXPORT FPDF_BOOL STDCALL FPDF_LoadXFA(FPDF_DOCUMENT document); + +/** + * Function: FPDF_Widget_Undo + * This method will implement the undo feature for the specified xfa + *field. + * Parameters: + * document - Handle to document. Returned by + *FPDF_LoadDocument function. + * hWidget - Handle to the xfa field. + * Return Value: + * None. + **/ +DLLEXPORT void STDCALL FPDF_Widget_Undo(FPDF_DOCUMENT document, + FPDF_WIDGET hWidget); +/** + * Function: FPDF_Widget_Redo + * This method will implement the redo feature for the specified xfa + *field. + * Parameters: + * document - Handle to document. Returned by + *FPDF_LoadDocument function. + * hWidget - Handle to the xfa field. + * Return Value: + * None. + **/ +DLLEXPORT void STDCALL FPDF_Widget_Redo(FPDF_DOCUMENT document, + FPDF_WIDGET hWidget); +/** + * Function: FPDF_Widget_SelectAll + * This method will implement the select all feature for the specified + *xfa field. + * Parameters: + * document - Handle to document. Returned by + *FPDF_LoadDocument function. + * hWidget - Handle to the xfa field. + * Return Value: + * None. + **/ +DLLEXPORT void STDCALL FPDF_Widget_SelectAll(FPDF_DOCUMENT document, + FPDF_WIDGET hWidget); +/** + * Function: FPDF_Widget_Copy + * This method will implement the copy feature for the specified xfa + *field. + * Parameters: + * document - Handle to document. Returned by + *FPDF_LoadDocument function. + * hWidget - Handle to the xfa field. + * wsText - Pointer to data buffer to receive the copied + *data, in UTF-16LE format. + * size - The data buffer size. + * Return Value: + * None. + **/ +DLLEXPORT void STDCALL FPDF_Widget_Copy(FPDF_DOCUMENT document, + FPDF_WIDGET hWidget, + FPDF_WIDESTRING wsText, + FPDF_DWORD* size); +/** + * Function: FPDF_Widget_Cut + * This method will implement the cut feature for the specified xfa + *field. + * Parameters: + * document - Handle to document. Returned by + *FPDF_LoadDocument function. + * hWidget - Handle to the xfa field. + * wsText - Pointer to data buffer to receive the cut + *data,in UTF-16LE format. + * size - The data buffer size,not the byte number. + * Return Value: + * None. + **/ +DLLEXPORT void STDCALL FPDF_Widget_Cut(FPDF_DOCUMENT document, + FPDF_WIDGET hWidget, + FPDF_WIDESTRING wsText, + FPDF_DWORD* size); +/** + * Function: FPDF_Widget_Paste + * This method will implement the paste feature for the specified xfa + *field. + * Parameters: + * document - Handle to document. Returned by + *FPDF_LoadDocument function. + * hWidget - Handle to the xfa field. + * wsText - The paste text buffer, in UTF-16LE format. + * size - The data buffer size,not the byte number. + * Return Value: + * None. + **/ +DLLEXPORT void STDCALL FPDF_Widget_Paste(FPDF_DOCUMENT document, + FPDF_WIDGET hWidget, + FPDF_WIDESTRING wsText, + FPDF_DWORD size); +/** + * Function: FPDF_Widget_ReplaceSpellCheckWord + * This method will implement the spell check feature for the specified + *xfa field. + * Parameters: + * document - Handle to document. Returned by + *FPDF_LoadDocument function. + * hWidget - Handle to the xfa field. + * x - The x value of the specified point. + * y - The y value of the specified point. + * bsText - The text buffer needed to be speck check, in + *UTF-16LE format. + * Return Value: + * None. + **/ +DLLEXPORT void STDCALL +FPDF_Widget_ReplaceSpellCheckWord(FPDF_DOCUMENT document, + FPDF_WIDGET hWidget, + float x, + float y, + FPDF_BYTESTRING bsText); +/** + * Function: FPDF_Widget_GetSpellCheckWords + * This method will implement the spell check feature for the specified + *xfa field. + * Parameters: + * document - Handle to document. Returned by + *FPDF_LoadDocument function. + * hWidget - Handle to the xfa field. + * x - The x value of the specified point. + * y - The y value of the specified point. + * stringHandle - Pointer to FPDF_STRINGHANDLE to receive the + *speck check text buffer, in UTF-16LE format. + * Return Value: + * None. + **/ +DLLEXPORT void STDCALL +FPDF_Widget_GetSpellCheckWords(FPDF_DOCUMENT document, + FPDF_WIDGET hWidget, + float x, + float y, + FPDF_STRINGHANDLE* stringHandle); +/** + * Function: FPDF_StringHandleCounts + * This method will get the count of the text buffer. + * Parameters: + * stringHandle - Pointer to FPDF_STRINGHANDLE. + * Return Value: + * None. + **/ +DLLEXPORT int STDCALL FPDF_StringHandleCounts(FPDF_STRINGHANDLE stringHandle); +/** + * Function: FPDF_StringHandleGetStringByIndex + * This method will get the specified index of the text buffer. + * Parameters: + * stringHandle - Pointer to FPDF_STRINGHANDLE. + * index - The specified index of text buffer. + * bsText - Pointer to data buffer to receive the text + *buffer, in UTF-16LE format. + * size - The byte size of data buffer. + * Return Value: + * TRUE indicates success, otherwise FALSE. + **/ +DLLEXPORT FPDF_BOOL STDCALL +FPDF_StringHandleGetStringByIndex(FPDF_STRINGHANDLE stringHandle, + int index, + FPDF_BYTESTRING bsText, + FPDF_DWORD* size); +/** + * Function: FPDF_StringHandleRelease + * This method will release the FPDF_STRINGHANDLE. + * Parameters: + * stringHandle - Pointer to FPDF_STRINGHANDLE. + * Return Value: + * None. + **/ +DLLEXPORT void STDCALL FPDF_StringHandleRelease(FPDF_STRINGHANDLE stringHandle); +/** + * Function: FPDF_StringHandleAddString + * This method will add the specified text buffer. + * Parameters: + * stringHandle - Pointer to FPDF_STRINGHANDLE. + * bsText - Pointer to data buffer of the text buffer, in + *UTF-16LE format. + * size - The byte size of data buffer. + * Return Value: + * TRUE indicates success, otherwise FALSE. + **/ +DLLEXPORT FPDF_BOOL STDCALL +FPDF_StringHandleAddString(FPDF_STRINGHANDLE stringHandle, + FPDF_BYTESTRING bsText, + FPDF_DWORD size); +#endif // PDF_ENABLE_XFA + +#ifdef __cplusplus +} +#endif + +#endif // PUBLIC_FPDF_FORMFILL_H_ diff --git a/dependencies/pdfium/win/public/public/fpdf_fwlevent.h b/dependencies/pdfium/win/public/public/fpdf_fwlevent.h new file mode 100644 index 00000000..591484a5 --- /dev/null +++ b/dependencies/pdfium/win/public/public/fpdf_fwlevent.h @@ -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_ diff --git a/dependencies/pdfium/win/public/public/fpdf_ppo.h b/dependencies/pdfium/win/public/public/fpdf_ppo.h new file mode 100644 index 00000000..d9c83002 --- /dev/null +++ b/dependencies/pdfium/win/public/public/fpdf_ppo.h @@ -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_ diff --git a/dependencies/pdfium/win/public/public/fpdf_progressive.h b/dependencies/pdfium/win/public/public/fpdf_progressive.h new file mode 100644 index 00000000..0c3d5013 --- /dev/null +++ b/dependencies/pdfium/win/public/public/fpdf_progressive.h @@ -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_ diff --git a/dependencies/pdfium/win/public/public/fpdf_save.h b/dependencies/pdfium/win/public/public/fpdf_save.h new file mode 100644 index 00000000..c34e2bc6 --- /dev/null +++ b/dependencies/pdfium/win/public/public/fpdf_save.h @@ -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_ diff --git a/dependencies/pdfium/public/fpdf_searchex.h b/dependencies/pdfium/win/public/public/fpdf_searchex.h similarity index 100% rename from dependencies/pdfium/public/fpdf_searchex.h rename to dependencies/pdfium/win/public/public/fpdf_searchex.h diff --git a/dependencies/pdfium/public/fpdf_structtree.h b/dependencies/pdfium/win/public/public/fpdf_structtree.h similarity index 100% rename from dependencies/pdfium/public/fpdf_structtree.h rename to dependencies/pdfium/win/public/public/fpdf_structtree.h diff --git a/dependencies/pdfium/win/public/public/fpdf_sysfontinfo.h b/dependencies/pdfium/win/public/public/fpdf_sysfontinfo.h new file mode 100644 index 00000000..a0edffff --- /dev/null +++ b/dependencies/pdfium/win/public/public/fpdf_sysfontinfo.h @@ -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_ diff --git a/dependencies/pdfium/win/public/public/fpdf_text.h b/dependencies/pdfium/win/public/public/fpdf_text.h new file mode 100644 index 00000000..5c241527 --- /dev/null +++ b/dependencies/pdfium/win/public/public/fpdf_text.h @@ -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_ diff --git a/dependencies/pdfium/win/public/public/fpdf_transformpage.h b/dependencies/pdfium/win/public/public/fpdf_transformpage.h new file mode 100644 index 00000000..66271fcd --- /dev/null +++ b/dependencies/pdfium/win/public/public/fpdf_transformpage.h @@ -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_ diff --git a/dependencies/pdfium/public/fpdfview.h b/dependencies/pdfium/win/public/public/fpdfview.h similarity index 100% rename from dependencies/pdfium/public/fpdfview.h rename to dependencies/pdfium/win/public/public/fpdfview.h diff --git a/dependencies/pdfium/x64/pdfium.dll b/dependencies/pdfium/win/x64/x64/pdfium.dll similarity index 100% rename from dependencies/pdfium/x64/pdfium.dll rename to dependencies/pdfium/win/x64/x64/pdfium.dll diff --git a/dependencies/pdfium/x64/pdfium.lib b/dependencies/pdfium/win/x64/x64/pdfium.lib similarity index 100% rename from dependencies/pdfium/x64/pdfium.lib rename to dependencies/pdfium/win/x64/x64/pdfium.lib diff --git a/dependencies/pdfium/x86/pdfium.dll b/dependencies/pdfium/win/x86/x86/pdfium.dll similarity index 100% rename from dependencies/pdfium/x86/pdfium.dll rename to dependencies/pdfium/win/x86/x86/pdfium.dll diff --git a/dependencies/pdfium/x86/pdfium.lib b/dependencies/pdfium/win/x86/x86/pdfium.lib similarity index 100% rename from dependencies/pdfium/x86/pdfium.lib rename to dependencies/pdfium/win/x86/x86/pdfium.lib diff --git a/dependencies/unarr/macx/libunarr.a b/dependencies/unarr/macx/libunarr.a new file mode 100644 index 00000000..5a6992b7 Binary files /dev/null and b/dependencies/unarr/macx/libunarr.a differ diff --git a/dependencies/unarr/macx/unarr.h b/dependencies/unarr/macx/unarr.h new file mode 100644 index 00000000..0400747c --- /dev/null +++ b/dependencies/unarr/macx/unarr.h @@ -0,0 +1,94 @@ +/* Copyright 2015 the unarr project authors (see AUTHORS file). + License: LGPLv3 */ + +#ifndef unarr_h +#define unarr_h + +#include +#include +#include +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 diff --git a/releaseOSX.sh b/releaseOSX.sh index 6eafa3e9..30fd7a03 100755 --- a/releaseOSX.sh +++ b/releaseOSX.sh @@ -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 -