Commit 106230fe authored by wanglei's avatar wanglei

初始化

parent 65e6c8bc
Pipeline #1234 canceled with stages
target/
build/
lint.xml
bin/
gen/
.settings
.project
.classpath
out
gen-external-apklibs/
classes/
# Local configuration file (sdk path, etc)
local.properties
# Android Studio
.idea/
*/out
!*/build/apk/
*/production/
*.iws
*.ipr
*.iml
*~
*.swp
# gradle
.gradle
.DS_Store
\ No newline at end of file
## 2.8.1 (2017-11-11)
* Fix bug with rendering `PDFView` in Android Studio Layout Editor
## 2.8.0 (2017-10-31)
* Add handling of invalid pages, inspired by pull request #433. Exception on page opening crashed application until now,
currently `OnPageErrorListener` set with `.onPageError()` is called. Invalid page color can be set using `.invalidPageColor()`
* Implement `canScrollVertically()` and `canScrollHorizontally()` methods to work e.g. with `SwipeRefreshLayout`
* Fix bug when `Configurator#load()` method was called before view has been measured, which resulted in empty canvas
## 2.7.0 (2017-08-30)
* Merge pull request by [owurman](https://github.com/owurman) with added OnTapListener
* Merge bugfix by [lzwandnju](https://github.com/lzwandnju) to prevent `ArithmeticException: divide by zero`
## 2.7.0-beta.1 (2017-07-05)
* Updates PdfiumAndroid to 1.7.0 which reduces memory usage about twice and improves performance by using RGB 565 format (when not using `pdfView.useBestQuality(true)`)
## 2.7.0-beta (2017-06-16)
* Update PdfiumAndroid to 1.6.1, which fixed font rendering (issue #253)
* Add `.spacing(int)` method to add spacing (in dp) between document pages
* Fix drawing with `.onDraw(onDrawListener)`
* Add `.onDrawAll(onDrawListener)` method to draw on all pages
* Add small rendering improvements
* Fix rendering when duplicated pages are passed to `.pages(..)`
## 2.6.1 (2017-06-08)
* Fix disappearing scroll handle
## 2.6.0 (2017-06-04)
* Fix fling on single-page documents
* Greatly improve overall fling experience
## 2.5.1 (2017-04-08)
* Temporarily downgrade PdfiumAndroid until #253 will be fixed
## 2.5.0 (2017-03-23)
* Update PdfiumAndroid to 1.6.0, which is based on newest Pdfium from Android 7.1.1. It should fix many rendering and fonts problems
* Add method `pdfView.fitToWidth()`, which called in `OnRenderListener.onInitiallyRendered()` will fit document to width of the screen (inspired by [1stmetro](https://github.com/1stmetro))
* Add change from pull request by [isanwenyu](https://github.com/isanwenyu) to get rid of rare IllegalArgumentException while rendering
* Add `OnRenderListener`, that will be called once, right before document is drawn on the screen
* Add `Configurator.enableAntialiasing()` to improve rendering on low-res screen a little bit (as suggested by [majkimester](majkimester))
* Modify engine to not block UI when big documents are loaded
* Change `Constants` interface and inner interfaces to static public classes, to allow modifying core config values
## 2.4.0 (2016-12-30)
* Merge pull request by [hansinator85](https://github.com/hansinator85) which allows to enable/disable rendering during scale
* Make rendering during scale disabled by default (looks better)
* Merge pull request by [cesquivias](https://github.com/cesquivias) which replaces RenderingAsyncTask with Handler to simply code and work with testing frameworks
## 2.3.0 (2016-11-19)
* Add mechanism for providing documents from different sources - more info in README
* Update PdfiumAndroid to 1.5.0
* Thanks to document sources and PdfiumAndroid update, in-memory documents are supported
* Fix not working OnClickListener on PDFView
* **com.github.barteksc.exception.FileNotFoundException** is deprecated and all usages was removed.
All exceptions are delivered to old Configurator#onError() listener.
## 2.2.0 (2016-11-15)
* Merge pull request by [skarempudi](https://github.com/skarempudi) which fixes SDK 23 permission problems in sample app
* Merge pull request by skarempudi for showing info on phones without file manager
* Add feature from 1.x - canvas is set to drawable from View#getBackground()
## 2.1.0 (2016-09-16)
* fixed loading document from subfolder in assets directory
* fixed scroll handle NPE after document loading error (improvement of 2.0.3 fix)
* fixed incorrect scroll handle position with additional views in RelativeLayout
* improved cache usage and fixed bug with rendering when zooming
* if you are using custom scroll handle: scroll handle implementation changed a little bit, check DefaultScrollHandle source for details
## 2.0.3 (2016-08-30)
* Fix scroll handle NPE after document loading error
## 2.0.2 (2016-08-27)
* Fix exceptions caused by improperly finishing rendering task
## 2.0.1 (2016-08-16)
* Fix NPE when onDetachFromWindow is called
## 2.0.0 (2016-08-14)
* few API changes
* improved rendering speed and accuracy
* added continuous scroll - now it behaves like Adobe Reader and others
* added `fling` scroll gesture for velocity based scrolling
* added scroll handle as a replacement for scrollbar
### Changes in 2.0 API
* `Configurator#defaultPage(int)` and `PDFView#jumpTo(int)` now require page index (i.e. starting from 0)
* `OnPageChangeListener#onPageChanged(int, int)` is called with page index (i.e. starting from 0)
* removed scrollbar
* added scroll handle as a replacement for scrollbar, use with `Configurator#scrollHandle()`
* added `OnPageScrollListener` listener due to continuous scroll, register with `Configurator#onPageScroll()`
* default scroll direction is vertical, so `Configurator#swipeVertical()` was changed to `Configurator#swipeHorizontal()`
* removed minimap and mask configuration
## 1.4.0 (2016-07-25)
* Fix NPE and IndexOutOfBound bugs when rendering parts
* Merge pull request by [paulo-sato-daitan](https://github.com/paulo-sato-daitan) for disabling page change animation
* Merge pull request by [Miha-x64](https://github.com/Miha-x64) for drawing background if set on `PDFView`
## 1.3.0 (2016-07-13)
* update PdfiumAndroid to 1.4.0 with support for rendering annotations
* merge pull request by [usef](https://github.com/usef) for rendering annotations
## 1.2.0 (2016-07-11)
* update PdfiumAndroid to 1.3.1 with support for bookmarks, Table Of Contents and documents with password:
* added method `PDFView#getDocumentMeta()`, which returns document metadata
* added method `PDFView#getTableOfContents()`, which returns whole tree of bookmarks in PDF document
* added method `Configurator#password(String)`
* added horizontal mode to **ScrollBar** - use `ScrollBar#setHorizontal(true)` or `app:sb_horizontal="true"` in XML
* block interaction with `PDFView` when document is not loaded - prevent some exceptions
* fix `PDFView` exceptions in layout preview (edit mode)
## 1.1.2 (2016-06-27)
* update PdfiumAndroid to 1.1.0, which fixes displaying multiple `PDFView`s at the same time and few errors with loading PDF documents.
## 1.1.1 (2016-06-17)
* fixes bug with strange behavior when indices passed to `.pages()` don't start with `0`.
## 1.1.0 (2016-06-16)
* added method `pdfView.fromUri(Uri)` for opening files from content providers
* updated PdfiumAndroid to 1.0.3, which should fix bug with exception
* updated sample with demonstration of `fromUri()` method
* some minor fixes
## 1.0.0 (2016-06-06)
* Initial release
This diff is collapsed.
/build
\ No newline at end of file
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
}
android {
namespace 'com.shockwave.pdfium'
compileSdk 34
defaultConfig {
minSdk 24
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
ndk {
abiFilters 'arm64-v8a', 'armeabi-v7a', 'x86', 'x86_64'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
// defaultConfig {
// externalNativeBuild {
// ndkBuild {
// arguments "-DANDROID_ABI=${defaultConfig.ndkAbbi}"
// }
// }
// }
externalNativeBuild {
ndkBuild {
path "src/main/jni/Android.mk"
}
}
// sourceSets {
// main {
// jni.srcDirs = []
// jniLibs.srcDirs = ['src/main/jniLibs']
// }
// }
sourceSets {
main {
jni.srcDirs = ['src/main/jni']
jniLibs.srcDirs = ['src/main/jni/lib']
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation("androidx.appcompat:appcompat:1.7.0")
implementation "androidx.core:core-ktx:$kotlin_version"
}
\ No newline at end of file
-keepclassmembers class * {
native <methods>;
}
\ No newline at end of file
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# 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 *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-keepclassmembers class * {
native <methods>;
}
\ No newline at end of file
package com.shockwave.pdfium;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.shockwave.pdfium.test", appContext.getPackageName());
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
\ No newline at end of file
package com.shockwave.pdfium;
import android.os.ParcelFileDescriptor;
import android.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);
}
}
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-v7a
endif
ifeq ($(TARGET_ARCH_ABI), arm64-v8a)
ARCH_PATH = arm64-v8a
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_STL := c++_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
extern "C"
JNIEXPORT jlong JNICALL
Java_com_shockwave_pdfium_PdfiumCore_TestJniFun(JNIEnv *env, jobject thiz) {
long longValue = 179621228;
return longValue;
}
\ No newline at end of file
package com.shockwave.pdfium;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}
\ No newline at end of file
plugins {
id 'com.android.library'
id 'org.jetbrains.kotlin.android'
}
ext {
// bintrayRepo = 'maven'
// bintrayName = 'android-pdf-viewer'
// publishedGroupId = 'com.github.barteksc'
// libraryName = 'AndroidPdfViewer'
// artifact = 'android-pdf-viewer'
// libraryDescription = 'Android view for displaying PDFs rendered with PdfiumAndroid'
// siteUrl = 'https://github.com/barteksc/AndroidPdfViewer'
// gitUrl = 'https://github.com/barteksc/AndroidPdfViewer.git'
// libraryVersion = '2.8.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 {
compileSdk = 34
namespace = "com.github.barteksc.pdfviewer"
defaultConfig {
minSdkVersion 24
targetSdkVersion 34
versionCode 1
versionName "2.8.1"
}
kotlinOptions {
jvmTarget = "1.8"
}
}
dependencies {
// api 'com.github.barteksc:pdfium-android:1.7.1'
api project(':PdfiumAndroid')
implementation("androidx.appcompat:appcompat:1.7.0")
implementation "androidx.core:core-ktx:$kotlin_version"
}
//apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/installv1.gradle'
//apply from: 'https://raw.githubusercontent.com/nuuneoi/JCenter/master/bintrayv1.gradle'
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.github.barteksc.pdfviewer">
</manifest>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/default_scroll_handle_right"
android:fromDegrees="180"
android:toDegrees="180"
android:visible="true" />
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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