Commit 5e8c789f authored by wanglei's avatar wanglei Committed by wanglei

Initial commit

parent a014244a
Pipeline #1232 failed with stages
src/main/libs
src/main/obj
*.iml
.gradle
/local.properties
.idea/
.DS_Store
/build
/captures
\ No newline at end of file
## 1.7.1 (2017-10-28)
* Merge pull request by [Phaestion](https://github.com/Phaestion) which prevents `UnsatisfiedLinkError`
## 1.7.0 (2017-06-21)
* Add rendering bitmap in RGB 565 format, which reduces memory usage (about twice)
## 1.6.1 (2017-06-09)
* Fix bug from 1.6.0 - not embedded fonts was not rendered
## 1.6.0 (2017-03-22)
* Pdfium updated to newest version, from Android 7.1.1.
It should fix many rendering issues and (thanks to freetype support) fix problems with fonts.
## 1.5.0 (2016-11-18)
* Add method `PdfiumCore#newDocument(byte[])` for reading PDF documents from memory
* Cleanup AndroidManifest.xml to solve problems with manifest merger
## 1.4.0 (2016-07-12)
* merge pull request by [usef](https://github.com/usef) with added support for rendering annotations. Due to limitations of _Pdfium_, messages from comments cannot be read and are rendered only as speech balloons.
## 1.3.1 (2016-07-11)
* `PdfiumCore#newDocument()` may throw `PdfPasswordException` to help with recognition of password requirement or incorrect password.
## 1.3.0 (2016-07-10)
* added support for opening documents with password
* fixed bug with SIGSEV when closing document
## 1.2.0 (2016-07-06)
* `libmodpdfium` compiled with methods for retrieving bookmarks and metadata
* added `PdfiumCore#getDocumentMeta()` for retrieving document metadata
* added `PdfiumCore#getTableOfContents()` for reading whole tree of bookmarks
* comment out native rendering debug
## 1.1.0 (2016-06-27)
* fixed rendering multiple PDFs at the same time thanks to synchronization between instances
* compile Pdfium with SONAME `libmodpdfium` to prevent loading `libpdfium` from Lollipop and higher
* `newDocument()` requires `ParcelFileDescriptor` instead of `FileDescriptor` to keep file descriptor open
* changed method of loading PDFs, which should be more stable
## 1.0.3 (2016-06-17)
* probably fixed bug when pdf should open as normal but was throwing exception
* added much more descriptive exception messages
## 1.0.2 (2016-06-04)
* `newDocument()` throws IOException
## 1.0.1 (2016-06-04)
* fix loading `libpdfium` on devices with < Lollipop
## Initial changes
* Added method for rendering PDF page on bitmap
``` java
void renderPageBitmap(PdfDocument doc, Bitmap bitmap, int pageIndex,
int startX, int startY, int drawSizeX, int drawSizeY);
```
* Added methods to get width and height of page in points (1/72") (like in `PdfRenderer.Page` class):
* `int getPageWidthPoint(PdfDocument doc, int index);`
* `int getPageHeightPoint(PdfDocument doc, int index);`
Original work Copyright 2015 Bekket McClane
Modified work Copyright 2016 Bartosz Schiller
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
// Copyright 2014 PDFium Authors. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
# PdfiumAndroid-pdfium-android-1.7.1
[原项目地址](https://github.com/barteksc/PdfiumAndroid)
作用是
[AndroidPdfViewer](https://github.com/DImuthuUpe/AndroidPdfViewer) 项目依赖于该jni项目,但该项目又用来类似android.support.v4.util.ArrayMap;的lib和
AndroidX冲突的,拷贝一份备份和修改
\ No newline at end of file
buildscript {
repositories {
mavenCentral()
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.3.0'
// classpath 'com.android.tools.build:gradle:2.3.2'
// classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
// classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
}
}
apply plugin: 'com.android.library'
//ext {
// bintrayRepo = 'maven'
// bintrayName = 'pdfium-android'
//
// publishedGroupId = 'com.github.barteksc'
// libraryName = 'PdfiumAndroid'
// artifact = 'pdfium-android'
//
// libraryDescription = 'Fork of library for rendering PDFs on Android\'s Surface or Bitmap'
//
// siteUrl = 'https://github.com/barteksc/PdfiumAndroid'
// gitUrl = 'https://github.com/barteksc/PdfiumAndroid.git'
//
// libraryVersion = '1.7.1'
//
// developerId = 'barteksc'
// developerName = 'Bartosz Schiller'
// developerEmail = 'barteksch@boo.pl'
//
// licenseName = 'The Apache Software License, Version 2.0'
// licenseUrl = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
// allLicenses = ["Apache-2.0"]
//}
android {
compileSdkVersion 25
buildToolsVersion "25.0.3"
namespace 'com.shockwave.pdfium'
defaultConfig {
minSdkVersion 9
targetSdkVersion 25
versionCode 1
versionName "1.7.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main {
jni.srcDirs = []
jniLibs.srcDir 'src/main/libs'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:support-v4:25.3.1'
}
allprojects {
repositories {
mavenCentral()
google()
jcenter()
}
}
//apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
//apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'
#Thu Sep 12 10:52:55 CST 2024
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /Users/mac/android-sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
package com.shockwave.pdfium;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
}
\ No newline at end of file
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
package com.shockwave.pdfium;
import android.os.ParcelFileDescriptor;
import android.support.v4.util.ArrayMap;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class PdfDocument {
public static class Meta {
String title;
String author;
String subject;
String keywords;
String creator;
String producer;
String creationDate;
String modDate;
public String getTitle() {
return title;
}
public String getAuthor() {
return author;
}
public String getSubject() {
return subject;
}
public String getKeywords() {
return keywords;
}
public String getCreator() {
return creator;
}
public String getProducer() {
return producer;
}
public String getCreationDate() {
return creationDate;
}
public String getModDate() {
return modDate;
}
}
public static class Bookmark {
private List<Bookmark> children = new ArrayList<>();
String title;
long pageIdx;
long mNativePtr;
public List<Bookmark> getChildren() {
return children;
}
public boolean hasChildren() {
return !children.isEmpty();
}
public String getTitle() {
return title;
}
public long getPageIdx() {
return pageIdx;
}
}
/*package*/ PdfDocument() {
}
/*package*/ long mNativeDocPtr;
/*package*/ ParcelFileDescriptor parcelFileDescriptor;
/*package*/ final Map<Integer, Long> mNativePagesPtr = new ArrayMap<>();
public boolean hasPage(int index) {
return mNativePagesPtr.containsKey(index);
}
}
package com.shockwave.pdfium;
import java.io.IOException;
public class PdfPasswordException extends IOException {
public PdfPasswordException() {
super();
}
public PdfPasswordException(String detailMessage) {
super(detailMessage);
}
}
This diff is collapsed.
LOCAL_PATH := $(call my-dir)
#Prebuilt libraries
include $(CLEAR_VARS)
LOCAL_MODULE := aospPdfium
ARCH_PATH = $(TARGET_ARCH_ABI)
ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
ARCH_PATH = armeabi
endif
ifeq ($(TARGET_ARCH_ABI), arm64-v8a)
ARCH_PATH = arm64
endif
LOCAL_SRC_FILES := $(LOCAL_PATH)/lib/$(ARCH_PATH)/libmodpdfium.so
include $(PREBUILT_SHARED_LIBRARY)
#libmodft2
include $(CLEAR_VARS)
LOCAL_MODULE := libmodft2
LOCAL_SRC_FILES := $(LOCAL_PATH)/lib/$(ARCH_PATH)/libmodft2.so
include $(PREBUILT_SHARED_LIBRARY)
#libmodpng
include $(CLEAR_VARS)
LOCAL_MODULE := libmodpng
LOCAL_SRC_FILES := $(LOCAL_PATH)/lib/$(ARCH_PATH)/libmodpng.so
include $(PREBUILT_SHARED_LIBRARY)
#Main JNI library
include $(CLEAR_VARS)
LOCAL_MODULE := jniPdfium
LOCAL_CFLAGS += -DHAVE_PTHREADS
LOCAL_C_INCLUDES += $(LOCAL_PATH)/include
LOCAL_SHARED_LIBRARIES += aospPdfium
LOCAL_LDLIBS += -llog -landroid -ljnigraphics
LOCAL_SRC_FILES := $(LOCAL_PATH)/src/mainJNILib.cpp
include $(BUILD_SHARED_LIBRARY)
APP_STL := gnustl_static
APP_CPPFLAGS += -fexceptions
#For ANativeWindow support
APP_PLATFORM = android-9
APP_ABI := armeabi \
armeabi-v7a \
arm64-v8a \
mips \
x86 \
x86_64
\ No newline at end of file
// Copyright 2014 PDFium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#ifndef PUBLIC_FPDF_DATAAVAIL_H_
#define PUBLIC_FPDF_DATAAVAIL_H_
#include <stddef.h> // For size_t.
#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
/**
* Interface: FX_FILEAVAIL
* Interface for checking whether the section of the file is available.
*/
typedef struct _FX_FILEAVAIL {
/**
* Version number of the interface. Currently must be 1.
*/
int version;
/**
* Method: IsDataAvail
* Report whether the specified data section is available. A section is
* available only if all bytes in the section is available.
* Interface Version:
* 1
* Implementation Required:
* Yes
* Parameters:
* pThis - Pointer to the interface structure itself.
* offset - The offset of the data section in the file.
* size - The size of the data section
* Return Value:
* true means the specified data section is available.
* Comments:
* Called by Foxit SDK to check whether the data section is ready.
*/
FPDF_BOOL (*IsDataAvail)(struct _FX_FILEAVAIL* pThis, size_t offset, size_t size);
} FX_FILEAVAIL;
typedef void* FPDF_AVAIL;
/**
* Function: FPDFAvail_Create
* Create a document availability provider.
*
* Parameters:
* file_avail - Pointer to file availability interface to check
* availability of file data.
* file - Pointer to a file access interface for reading data
* from file.
* Return value:
* A handle to the document availability provider. NULL for error.
* Comments:
* Application must call FPDFAvail_Destroy when done with the
* availability provider.
*/
DLLEXPORT FPDF_AVAIL STDCALL FPDFAvail_Create(FX_FILEAVAIL* file_avail,
FPDF_FILEACCESS* file);
/**
* Function: FPDFAvail_Destroy
* Destroy a document availibity provider.
*
* Parameters:
* avail - Handle to document availability provider returned by
* FPDFAvail_Create
* Return Value:
* None.
*/
DLLEXPORT void STDCALL FPDFAvail_Destroy(FPDF_AVAIL avail);
/**
* Interface: FX_DOWNLOADHINTS
* Download hints interface. Used to receive hints for further
* downloading.
*/
typedef struct _FX_DOWNLOADHINTS {
/**
* Version number of the interface. Currently must be 1.
*/
int version;
/**
* Method: AddSegment
* Add a section to be downloaded.
* Interface Version:
* 1
* Implementation Required:
* Yes
* Parameters:
* pThis - Pointer to the interface structure itself.
* offset - The offset of the hint reported to be downloaded.
* size - The size of the hint reported to be downloaded.
* Return Value:
* None.
* Comments:
* Called by Foxit SDK to report some downloading hints for download
* manager.
* The position and size of section may be not accurate, part of the
* section might be already available.
* The download manager must deal with that to maximize download
* efficiency.
*/
void (*AddSegment)(struct _FX_DOWNLOADHINTS* pThis,
size_t offset,
size_t size);
} FX_DOWNLOADHINTS;
/**
* Function: FPDFAvail_IsDocAvail
* Check whether the document is ready for loading, if not, get
* download hints.
*
* Parameters:
* avail - Handle to document availability provider returned by
* FPDFAvail_Create
* hints - Pointer to a download hints interface, receiving
* generated hints
* Return value:
* PDF_DATA_ERROR: A common error is returned. It can't tell
* whehter data are availabe or not.
* PDF_DATA_NOTAVAIL: Data are not yet available.
* PDF_DATA_AVAIL: Data are available.
* Comments:
* Applications should call this function whenever new data arrived,
* and process all the generated download hints if any, until the
* function returns PDF_DATA_ERROR or PDF_DATA_AVAIL. Then
* applications can call FPDFAvail_GetDocument() to get a document
* handle.
*/
DLLEXPORT int STDCALL
FPDFAvail_IsDocAvail(FPDF_AVAIL avail, FX_DOWNLOADHINTS* hints);
/**
* Function: FPDFAvail_GetDocument
* Get document from the availability provider.
*
* Parameters:
* avail - Handle to document availability provider returned by
* FPDFAvail_Create
* password - Optional password for decrypting the PDF file.
* Return value:
* Handle to the document.
* Comments:
* After FPDFAvail_IsDocAvail() returns TRUE, the application should
* call this function to
* get the document handle. To close the document, use
* FPDF_CloseDocument function.
*/
DLLEXPORT FPDF_DOCUMENT STDCALL FPDFAvail_GetDocument(FPDF_AVAIL avail,
FPDF_BYTESTRING password);
/**
* Function: FPDFAvail_GetFirstPageNum
* Get page number for the first available page in a linearized PDF
*
* Parameters:
* doc - A document handle returned by FPDFAvail_GetDocument
* Return Value:
* Zero-based index for the first available page.
* Comments:
* For most linearized PDFs, the first available page would be just the
* first page, however,
* some PDFs might make other page to be the first available page.
* For non-linearized PDF, this function will always return zero.
*/
DLLEXPORT int STDCALL FPDFAvail_GetFirstPageNum(FPDF_DOCUMENT doc);
/**
* Function: FPDFAvail_IsPageAvail
* Check whether a page is ready for loading, if not, get download
* hints.
*
* Parameters:
* avail - Handle to document availability provider returned by
* FPDFAvail_Create
* page_index - Index number of the page. 0 for the first page.
* hints - Pointer to a download hints interface, receiving
* generated hints
* Return value:
* PDF_DATA_ERROR: A common error is returned. It can't tell
* whehter data are availabe or not.
* PDF_DATA_NOTAVAIL: Data are not yet available.
* PDF_DATA_AVAIL: Data are available.
* Comments:
* This function can be called only after FPDFAvail_GetDocument is
* called. Applications should call this function whenever new data
* arrived and process all the generated download hints if any, until
* this function returns PDF_DATA_ERROR or PDF_DATA_AVAIL. Then
* applications can perform page loading.
*/
DLLEXPORT int STDCALL FPDFAvail_IsPageAvail(FPDF_AVAIL avail,
int page_index,
FX_DOWNLOADHINTS* hints);
/**
* Function: FPDFAvail_ISFormAvail
* Check whether Form data is ready for init, if not, get download
* hints.
*
* Parameters:
* avail - Handle to document availability provider returned by
* FPDFAvail_Create
* hints - Pointer to a download hints interface, receiving
* generated hints
* Return value:
* PDF_FORM_ERROR - A common eror, in general incorrect parameters,
* like 'hints' is nullptr.
* PDF_FORM_NOTAVAIL - data not available
* PDF_FORM_AVAIL - data available
* PDF_FORM_NOTEXIST - no form data
* Comments:
* This function can be called only after FPDFAvail_GetDocument is
* called.
* The application should call this function whenever new data arrived,
* and process all the
* generated download hints if any, until the function returns non-zero
* value. Then the
* application can perform page loading. Recommend to call
* FPDFDOC_InitFormFillEnvironment
* after the function returns non-zero value.
*/
DLLEXPORT int STDCALL FPDFAvail_IsFormAvail(FPDF_AVAIL avail,
FX_DOWNLOADHINTS* hints);
/**
* Function: FPDFAvail_IsLinearized
* To check whether a document is Linearized PDF file.
*
* Parameters:
* avail - Handle to document availability provider returned by
* FPDFAvail_Create
* Return value:
* PDF_LINEARIZED is a linearize file.
* PDF_NOT_LINEARIZED is not a linearize file.
* PDF_LINEARIZATION_UNKNOWN doesn't know whether the file is a
*linearize file.
*
* Comments:
* It return PDF_LINEARIZED or PDF_NOT_LINEARIZED as soon as
* we have first 1K data. If the file's size less than 1K, it returns
* PDF_LINEARIZATION_UNKNOWN because there is not enough information to
* tell whether a PDF file is a linearized file or not.
*
*/
DLLEXPORT int STDCALL FPDFAvail_IsLinearized(FPDF_AVAIL avail);
#ifdef __cplusplus
}
#endif
#endif // PUBLIC_FPDF_DATAAVAIL_H_
This diff is collapsed.
This diff is collapsed.
// 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_
#include "fpdfview.h"
#ifdef __cplusplus
extern "C" {
#endif
// flags for type of unsupport object.
#define FPDF_UNSP_DOC_XFAFORM 1
#define FPDF_UNSP_DOC_PORTABLECOLLECTION 2
#define FPDF_UNSP_DOC_ATTACHMENT 3
#define FPDF_UNSP_DOC_SECURITY 4
#define FPDF_UNSP_DOC_SHAREDREVIEW 5
#define FPDF_UNSP_DOC_SHAREDFORM_ACROBAT 6
#define FPDF_UNSP_DOC_SHAREDFORM_FILESYSTEM 7
#define FPDF_UNSP_DOC_SHAREDFORM_EMAIL 8
#define FPDF_UNSP_ANNOT_3DANNOT 11
#define FPDF_UNSP_ANNOT_MOVIE 12
#define FPDF_UNSP_ANNOT_SOUND 13
#define FPDF_UNSP_ANNOT_SCREEN_MEDIA 14
#define FPDF_UNSP_ANNOT_SCREEN_RICHMEDIA 15
#define FPDF_UNSP_ANNOT_ATTACHMENT 16
#define FPDF_UNSP_ANNOT_SIG 17
typedef struct _UNSUPPORT_INFO {
/**
* Version number of the interface. Currently must be 1.
**/
int version;
/**
* Method: FSDK_UnSupport_Handler
* UnSupport Object process handling function.
* Interface Version:
* 1
* Implementation Required:
* Yes
* Parameters:
* pThis - Pointer to the interface structure itself.
* nType - The type of unsupportObject
* Return value:
* None.
* */
void (*FSDK_UnSupport_Handler)(struct _UNSUPPORT_INFO* pThis, int nType);
} UNSUPPORT_INFO;
/**
* Function: FSDK_SetUnSpObjProcessHandler
* Setup A UnSupport Object process handler for foxit sdk.
* Parameters:
* unsp_info - Pointer to a UNSUPPORT_INFO structure.
* Return Value:
* TRUE means successful. FALSE means fails.
**/
DLLEXPORT FPDF_BOOL STDCALL
FSDK_SetUnSpObjProcessHandler(UNSUPPORT_INFO* unsp_info);
// flags for page mode.
// Unknown value
#define PAGEMODE_UNKNOWN -1
// Neither document outline nor thumbnail images visible
#define PAGEMODE_USENONE 0
// Document outline visible
#define PAGEMODE_USEOUTLINES 1
// Thumbnial images visible
#define PAGEMODE_USETHUMBS 2
// Full-screen mode, with no menu bar, window controls, or any other window
// visible
#define PAGEMODE_FULLSCREEN 3
// Optional content group panel visible
#define PAGEMODE_USEOC 4
// Attachments panel visible
#define PAGEMODE_USEATTACHMENTS 5
/**
* Function: FPDFDoc_GetPageMode
* Get the document's PageMode(How the document should be displayed
*when opened)
* Parameters:
* doc - Handle to document. Returned by FPDF_LoadDocument
*function.
* Return Value:
* The flags for page mode.
**/
DLLEXPORT int FPDFDoc_GetPageMode(FPDF_DOCUMENT document);
#ifdef __cplusplus
}
#endif
#endif // PUBLIC_FPDF_EXT_H_
// 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_
#include "fpdfview.h"
// Result codes.
#define FLATTEN_FAIL 0 // Flatten operation failed.
#define FLATTEN_SUCCESS 1 // Flatten operation succeed.
#define FLATTEN_NOTHINGTODO 2 // There is nothing to be flattened.
// Flags.
#define FLAT_NORMALDISPLAY 0
#define FLAT_PRINT 1
#ifdef __cplusplus
extern "C" {
#endif
// Function: FPDFPage_Flatten
// Make annotations and form fields become part of the page contents
// itself.
// Parameters:
// page - Handle to the page, as returned by FPDF_LoadPage().
// nFlag - Intended use of the flattened result: 0 for normal display,
// 1 for printing.
// Return value:
// Either FLATTEN_FAIL, FLATTEN_SUCCESS, or FLATTEN_NOTHINGTODO (see
// above).
// Comments:
// Currently, all failures return FLATTEN_FAIL, with no indication for
// the reason
// for the failure.
DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag);
#ifdef __cplusplus
}
#endif
#endif // PUBLIC_FPDF_FLATTEN_H_
This diff is collapsed.
// 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_
#include "fpdfview.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef int FPDF_INT32;
typedef unsigned int FPDF_UINT32;
typedef float FPDF_FLOAT;
// event type
typedef enum {
FWL_EVENTTYPE_Mouse = 0,
FWL_EVENTTYPE_MouseWheel,
FWL_EVENTTYPE_Key,
} FWL_EVENTTYPE;
// key flag
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 message command
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 event
struct FWL_EVENT_MOUSE {
FPDF_UINT32 command;
FPDF_DWORD flag;
FPDF_FLOAT x;
FPDF_FLOAT y;
};
// mouse wheel
struct FWL_EVENT_MOUSEWHEEL {
FPDF_DWORD flag;
FPDF_FLOAT x;
FPDF_FLOAT y;
FPDF_FLOAT deltaX;
FPDF_FLOAT deltaY;
};
// virtual keycode
typedef enum {
FWL_VKEY_Back = 0x08,
FWL_VKEY_Tab = 0x09,
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 command
typedef enum {
FWL_EVENTKEYCMD_KeyDown = 1,
FWL_EVENTKEYCMD_KeyUp,
FWL_EVENTKEYCMD_Char,
} FWL_EVENTKEYCMD;
// key event
struct FWL_EVENT_KEY {
FPDF_UINT32 command;
FPDF_DWORD flag;
union {
// Virtual key code.
FPDF_UINT32 vkcode;
// Character code.
FPDF_DWORD charcode;
} code;
};
// event type
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
}
#endif
#endif // PUBLIC_FPDF_FWLEVENT_H_
// 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_
#include "fpdfview.h"
#ifdef __cplusplus
extern "C" {
#endif
// Function: FPDF_ImportPages
// Import some pages to a PDF document.
// Parameters:
// dest_doc - The destination document which add the pages.
// src_doc - A document to be imported.
// pagerange - A page range string, Such as "1,3,5-7".
// If this parameter is NULL, it would import all pages
// in src_doc.
// index - The page index wanted to insert from.
// Return value:
// TRUE for succeed, FALSE for Failed.
DLLEXPORT FPDF_BOOL STDCALL FPDF_ImportPages(FPDF_DOCUMENT dest_doc,
FPDF_DOCUMENT src_doc,
FPDF_BYTESTRING pagerange,
int index);
// Function: FPDF_CopyViewerPreferences
// Copy the viewer preferences from one PDF document to another.#endif
// Parameters:
// dest_doc - Handle to document to write the viewer preferences
// to.
// src_doc - Handle to document with the viewer preferences.
// Return value:
// TRUE for success, FALSE for failure.
DLLEXPORT FPDF_BOOL STDCALL FPDF_CopyViewerPreferences(FPDF_DOCUMENT dest_doc,
FPDF_DOCUMENT src_doc);
#ifdef __cplusplus
}
#endif
#endif // PUBLIC_FPDF_PPO_H_
// 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_
#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 above.
// 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_
// 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_
#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_
// 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_
#include "fpdfview.h"
#ifdef __cplusplus
extern "C" {
#endif
// Function: FPDFText_GetCharIndexFromTextIndex
// Get the actually char index in text_page's internal char list.
// Parameters:
// text_page - Handle to a text page information structure.
// Returned by FPDFText_LoadPage function.
// nTextIndex - The index of the text in the string get from
// FPDFText_GetText.
// Return value:
// The index of the character in internal charlist. -1 for error.
DLLEXPORT int STDCALL
FPDFText_GetCharIndexFromTextIndex(FPDF_TEXTPAGE text_page, int nTextIndex);
#ifdef __cplusplus
}
#endif
#endif // PUBLIC_FPDF_SEARCHEX_H_
This diff is collapsed.
This diff is collapsed.
// 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_
#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_
This diff is collapsed.
/*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ANDROID_ERRORS_H
#define ANDROID_ERRORS_H
#include <sys/types.h>
#include <errno.h>
namespace android {
// use this type to return error codes
#ifdef HAVE_MS_C_RUNTIME
typedef int status_t;
#else
typedef int32_t status_t;
#endif
/* the MS C runtime lacks a few error codes */
/*
* Error codes.
* All error codes are negative values.
*/
// Win32 #defines NO_ERROR as well. It has the same value, so there's no
// real conflict, though it's a bit awkward.
#ifdef _WIN32
# undef NO_ERROR
#endif
enum {
OK = 0, // Everything's swell.
NO_ERROR = 0, // No errors.
UNKNOWN_ERROR = (-2147483647-1), // INT32_MIN value
NO_MEMORY = -ENOMEM,
INVALID_OPERATION = -ENOSYS,
BAD_VALUE = -EINVAL,
BAD_TYPE = (UNKNOWN_ERROR + 1),
NAME_NOT_FOUND = -ENOENT,
PERMISSION_DENIED = -EPERM,
NO_INIT = -ENODEV,
ALREADY_EXISTS = -EEXIST,
DEAD_OBJECT = -EPIPE,
FAILED_TRANSACTION = (UNKNOWN_ERROR + 2),
JPARKS_BROKE_IT = -EPIPE,
#if !defined(HAVE_MS_C_RUNTIME)
BAD_INDEX = -EOVERFLOW,
NOT_ENOUGH_DATA = -ENODATA,
WOULD_BLOCK = -EWOULDBLOCK,
TIMED_OUT = -ETIMEDOUT,
UNKNOWN_TRANSACTION = -EBADMSG,
#else
BAD_INDEX = -E2BIG,
NOT_ENOUGH_DATA = (UNKNOWN_ERROR + 3),
WOULD_BLOCK = (UNKNOWN_ERROR + 4),
TIMED_OUT = (UNKNOWN_ERROR + 5),
UNKNOWN_TRANSACTION = (UNKNOWN_ERROR + 6),
#endif
FDS_NOT_ALLOWED = (UNKNOWN_ERROR + 7),
};
// Restore define; enumeration is in "android" namespace, so the value defined
// there won't work for Win32 code in a different namespace.
#ifdef _WIN32
# define NO_ERROR 0L
#endif
}; // namespace android
// ---------------------------------------------------------------------------
#endif // ANDROID_ERRORS_H
This diff is collapsed.
This diff is collapsed.
#ifndef _UTIL_HPP_
#define _UTIL_HPP_
#include <jni.h>
extern "C" {
#include <stdlib.h>
}
#include <android/log.h>
#define JNI_FUNC(retType, bindClass, name) JNIEXPORT retType JNICALL Java_com_shockwave_pdfium_##bindClass##_##name
#define JNI_ARGS JNIEnv *env, jobject thiz
#define LOG_TAG "jniPdfium"
#define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
#endif
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment