Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c4066b5
fix for leya version
maribeiroleya Jul 18, 2022
21dcc61
fix erros
maribeiroleya Jul 19, 2022
1ba718a
fix changes
maribeiroleya Jul 20, 2022
265d7a0
fix on zoom change
maribeiroleya Jul 20, 2022
53aefee
fix error
maribeiroleya Jul 20, 2022
17bba7f
add suport for action end
maribeiroleya Jul 21, 2022
feca703
on action end give details
maribeiroleya Jul 22, 2022
57546a0
add suport for hotspots
maribeiroleya Aug 18, 2022
411ac33
update project
maribeiroleya Aug 19, 2022
aa4c6b1
fix error on open pnormal pdf
maribeiroleya Sep 1, 2022
9e80bda
fix windows error
maribeiroleya Sep 14, 2022
0425c5d
update pdf lib
maribeiroleya Sep 30, 2022
d423392
fix windows
maribeiroleya Sep 30, 2022
1045d0b
fix android
maribeiroleya Sep 30, 2022
df5afed
change minimum value for swipe
maribeiroleya Oct 21, 2022
bd123ad
change swipe by device density
maribeiroleya Oct 25, 2022
b41e8d4
change build grdle
maribeiroleya Nov 14, 2022
d9f8859
update dependencie
maribeiroleya Dec 5, 2022
637377a
change tap
maribeiroleya Jan 10, 2023
709e6b1
permite more then 5 parameters
maribeiroleya Jan 11, 2023
b9b5391
update to draw notes
maribeiroleya Jan 25, 2023
8e4cdad
fix manager
maribeiroleya Jan 25, 2023
e54ded6
fix notes
maribeiroleya Jan 26, 2023
389cbef
fix updates
maribeiroleya Mar 8, 2023
93e6709
update project
maribeiroleya Mar 13, 2023
637f593
new code
maribeiroleya Mar 16, 2023
543faab
new code
maribeiroleya Mar 16, 2023
54b90ae
new code
maribeiroleya Mar 31, 2023
52e40d7
change build tag
maribeiroleya May 18, 2023
20860bb
update version of pdf viewer
maribeiroleya Nov 13, 2023
3917069
new version
maribeiroleya Sep 30, 2025
e8856dd
new version update
maribeiroleya Oct 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions DoubleTapView.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@
import React, {Component} from 'react';
import {
View,
PanResponder,
ViewPropTypes,
PanResponder
} from 'react-native';
import PropTypes from 'prop-types';

import {ViewPropTypes} from 'deprecated-react-native-prop-types';
export default class DoubleTapView extends Component {

static propTypes = {
Expand Down
3 changes: 1 addition & 2 deletions PdfPageView.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {
ViewPropTypes,
requireNativeComponent,
} from 'react-native';

import {ViewPropTypes} from 'deprecated-react-native-prop-types';
export default class PdfPageView extends PureComponent {
_getStylePropsProps = () => {
const {width, height} = this.props;
Expand Down
11 changes: 8 additions & 3 deletions PdfView.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

'use strict';
import React, {Component} from 'react';
import {ScrollView, FlatList, View, StyleSheet, ViewPropTypes} from 'react-native';

import {ScrollView, View, StyleSheet} from 'react-native';
import {ViewPropTypes} from 'deprecated-react-native-prop-types';
import PropTypes from 'prop-types';

import PdfManager from './PdfManager';
Expand Down Expand Up @@ -40,6 +40,8 @@ export default class PdfView extends Component {
singlePage: PropTypes.bool,
onPageSingleTap: PropTypes.func,
onScaleChanged: PropTypes.func,
showsHorizontalScrollIndicator: PropTypes.bool,
showsVerticalScrollIndicator: PropTypes.bool,
};

static defaultProps = {
Expand All @@ -50,6 +52,7 @@ export default class PdfView extends Component {
maxScale: MAX_SCALE,
spacing: 10,
style: {},
progressContainerStyle: {},
fitPolicy: 2,
horizontal: false,
centerContent: false,
Expand All @@ -61,6 +64,8 @@ export default class PdfView extends Component {
},
onScaleChanged: (scale) => {
},
showsHorizontalScrollIndicator: true,
showsVerticalScrollIndicator: true,
};

constructor(props) {
Expand Down Expand Up @@ -413,4 +418,4 @@ const styles = StyleSheet.create({
container: {
flex: 1
}
});
});
3 changes: 1 addition & 2 deletions PdfViewFlatList.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
*/

'use strict';
import React, {Component} from 'react';
import {
FlatList,
} from 'react-native';
Expand All @@ -28,4 +27,4 @@ export default class PdfViewFlatList extends FlatList {
this._listRef._scrollRef.scrollTo({x: x, y: y, animated: false});
}

}
}
5 changes: 2 additions & 3 deletions PinchZoomView.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ import PropTypes from 'prop-types';
import {
View,
StyleSheet,
PanResponder,
ViewPropTypes,
PanResponder
} from 'react-native';

import {ViewPropTypes} from 'deprecated-react-native-prop-types';
export default class PinchZoomView extends Component {

static propTypes = {
Expand Down
160 changes: 91 additions & 69 deletions README.md

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions android/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21/"/>
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
<classpathentry kind="output" path="bin/default"/>
</classpath>
34 changes: 34 additions & 0 deletions android/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>react-native-pdf</name>
<comment>Project react-native-pdf created by Buildship.</comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
</natures>
<filteredResources>
<filter>
<id>1759485309693</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
2 changes: 2 additions & 0 deletions android/.settings/org.eclipse.buildship.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
connection.project.dir=../../../android
eclipse.preferences.version=1
111 changes: 88 additions & 23 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,66 +1,131 @@
description = 'react-native-pdf'

buildscript {
ext.safeExtGet = { prop, fallback ->
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}
repositories {
mavenCentral()
google()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'
classpath("com.android.tools.build:gradle:7.4.2")
}
}

repositories {
mavenCentral()
maven {
url 'https://jitpack.io'
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$projectDir/../node_modules/react-native/android"
content {
// Use Jitpack only for AndroidPdfViewer; the rest is hosted at mavenCentral.
includeGroup "com.github.TalbotGooday"
includeGroup "com.github.zacharee"
}
}
maven { url 'https://jitpack.io' }
google()
}

apply plugin: 'com.android.library'

def _ext = rootProject.ext
def resolveReactNativeDirectory() {
def reactNativeLocation = safeExtGet("REACT_NATIVE_NODE_MODULES_DIR", null)
if (reactNativeLocation != null) {
return file(reactNativeLocation)
}

// monorepo workaround
// react-native can be hoisted or in project's own node_modules
def reactNativeFromProjectNodeModules = file("${rootProject.projectDir}/../node_modules/react-native")
if (reactNativeFromProjectNodeModules.exists()) {
return reactNativeFromProjectNodeModules
}

def reactNativeFromNodeModulesWithPDF = file("${projectDir}/../../react-native")
if (reactNativeFromNodeModulesWithPDF.exists()) {
return reactNativeFromNodeModulesWithPDF
}

throw new Exception(
"[react-native-pdf] Unable to resolve react-native location in " +
"node_modules. You should add project extension property (in app/build.gradle) " +
"`REACT_NATIVE_NODE_MODULES_DIR` with path to react-native."
)
}

def _reactNativeVersion = _ext.has('reactNative') ? _ext.reactNative : '+'
def _compileSdkVersion = _ext.has('compileSdkVersion') ? _ext.compileSdkVersion : 28
def _buildToolsVersion = _ext.has('buildToolsVersion') ? _ext.buildToolsVersion : '28.0.3'
def _minSdkVersion = _ext.has('minSdkVersion') ? _ext.minSdkVersion : 16
def _targetSdkVersion = _ext.has('targetSdkVersion') ? _ext.targetSdkVersion : 28
def getReactNativeMinorVersion() {
def REACT_NATIVE_DIR = resolveReactNativeDirectory()

def reactProperties = new Properties()
file("$REACT_NATIVE_DIR/ReactAndroid/gradle.properties").withInputStream { reactProperties.load(it) }

def REACT_NATIVE_VERSION = reactProperties.getProperty("VERSION_NAME")
def REACT_NATIVE_MINOR_VERSION = REACT_NATIVE_VERSION.startsWith("0.0.0-") ? 1000 : REACT_NATIVE_VERSION.split("\\.")[1].toInteger()

return REACT_NATIVE_MINOR_VERSION
}

def isNewArchitectureEnabled() {
// To opt-in for the New Architecture, you can either:
// - Set `newArchEnabled` to true inside the `gradle.properties` file
// - Invoke gradle with `-newArchEnabled=true`
// - Set an environment variable `ORG_GRADLE_PROJECT_newArchEnabled=true`
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
}

if (isNewArchitectureEnabled()) {
apply plugin: "com.facebook.react"
}

android {
compileSdkVersion _compileSdkVersion
buildToolsVersion _buildToolsVersion
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
if (agpVersion.tokenize('.')[0].toInteger() >= 7) {
namespace "org.wonday.pdf"
}
compileSdkVersion safeExtGet('compileSdkVersion', 31)

defaultConfig {
minSdkVersion _minSdkVersion
targetSdkVersion _targetSdkVersion
minSdkVersion safeExtGet('minSdkVersion', 21)
targetSdkVersion safeExtGet('targetSdkVersion', 31)
buildConfigField("boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString())
}

sourceSets.main {
java {
if (!isNewArchitectureEnabled()) {
srcDirs += [
"src/paper/java",
]
}
}
}

lintOptions {
abortOnError true
}

packagingOptions {
pickFirst 'lib/x86/libc++_shared.so'
pickFirst 'lib/x86_64/libjsc.so'
pickFirst 'lib/x86_64/libc++_shared.so'
pickFirst 'lib/arm64-v8a/libjsc.so'
pickFirst 'lib/arm64-v8a/libc++_shared.so'
pickFirst 'lib/armeabi-v7a/libc++_shared.so'
pickFirst 'lib/x86/libc++_shared.so'
pickFirst 'lib/x86_64/libjsc.so'
pickFirst 'lib/x86_64/libc++_shared.so'
pickFirst 'lib/arm64-v8a/libjsc.so'
pickFirst 'lib/arm64-v8a/libc++_shared.so'
pickFirst 'lib/armeabi-v7a/libc++_shared.so'
}
}

dependencies {
implementation "com.facebook.react:react-native:${_reactNativeVersion}"
if (isNewArchitectureEnabled() && getReactNativeMinorVersion() < 71) {
implementation project(":ReactAndroid")
} else {
implementation 'com.facebook.react:react-native:+'
}
// NOTE: The original repo at com.github.barteksc is abandoned by the maintainer; there will be no more updates coming from that repo.
// It was taken over by com.github.TalbotGooday; from now on please use this repo until (if ever) the Barteksc repo is resumed.
implementation 'com.github.TalbotGooday:AndroidPdfViewer:3.1.0-beta.3'
implementation 'com.google.code.gson:gson:2.8.5'
// The repo from zacharee is based on PdfiumAndroidKt, a much newer fork of PdfiumAndroid, with better maintenance and updated native libraries.
implementation 'com.github.maribeiroleya:AndroidPdfViewer:leya_2.1.2'
// Depend on PdfiumAndroidKt directly so this can be updated independently of AndroidPdfViewer as updates are provided.
implementation 'io.legere:pdfiumandroid:1.0.33'
implementation 'com.google.code.gson:gson:2.13.2'
}
2 changes: 2 additions & 0 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
android.useAndroidX=true
android.enableJetifier=true
Binary file added android/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading