Some test text!
Android / Guides / Setup viewer
Integrate Apryse core and the tools library as described in our Gradle get started guide .
In your app module's build.gradle
file (usually app/build.gradle
), set the minSdkVersion
to 21+ and enable compatibility for Java 8 features. Then, add the dependency for Apryse's collaboration package:
android {
defaultConfig {
minSdkVersion 21
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation "com.pdftron:collab:11.1.0"
}
Integrate Apryse core and tools packages as described in Android manual integration guide .
Copy pdftron-collab.aar
directly into your app module's libs
directory. You will see other Apryse AARs here such as pdftron.aar
and tools.aar
In your app module's build.gradle
file (usually app/build.gradle
), make sure the minSdkVersion
is 21+ using Java 8 features. And add a dependency to Apryse collaboration package:
android {
defaultConfig {
minSdkVersion 21
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation "com.pdftron:collab@aar"
// room
implementation "android.arch.persistence.room:runtime:2.4.2"
annotationProcessor "android.arch.persistence.room:compiler:2.4.2"
implementation "android.arch.persistence.room:rxjava2:2.4.2"
}
Update your AndroidManifest.xml
as described in Step 1 of this guide.
Create the CollabViewerTabHostFragment2
, and start it like any other Android Fragment.
// Create a viewer fragment using CollabViewerBuilder2 and add it to an activity
public void addViewerFragment(AppCompatActivity activity, Uri fileUri) {
// Create a custom ViewerConfig used to initialize the viewer fragment
ViewerConfig config = new ViewerConfig.Builder()
.multiTabEnabled(false)
.build();
// Create the Fragment using CollabViewerBuilder2
CollabViewerTabHostFragment2 tabHostFragment =
CollabViewerBuilder2.withUri(fileUri)
.usingConfig(config)
.build(activity);
// Add the Fragment to your activity
FragmentTransaction ft = activity.getSupportFragmentManager().beginTransaction();
ft.replace(R.id.fragment_container, tabHostFragment, null);
ft.commit();
}
where R.id.fragment_container
is the resource id of a layout in your activity that will contain your fragment:
For example:
<?xml version="1.0" encoding="utf-8"?>
<!-- This FrameLayout will contain our viewer fragment -->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
Trial setup questions? Ask experts on Discord
Need other help? Contact Support
Pricing or product questions? Contact Sales