For the complete documentation index, see llms.txt. This page is also available as Markdown.

View a PDF document in Flutter

This guide will help you to view a document using the Apryse Flutter SDK for Apryse Mobile SDK.

Widget or Plugin

There are 2 different ways to use Apryse Flutter API:

  • Present a document via a plugin.

  • Show an Apryse document view via a Widget.

You must choose either the widget or plugin, and use it for all APIs. Mixing widget and plugin APIs will not function correctly. Whether you choose the widget or plugin is personal preference.

If you pick the Android widget, you will need to add padding for operating system intrusions like the status bar at the top of the device. One way is to set the enabled system UI, and then wrap the widget in a SafeArea or use an AppBar:

// If using Flutter v2.3.0-17.0.pre or earlier.
SystemChrome.setEnabledSystemUIOverlays(
  SystemUiOverlay.values
);
// If using later Flutter versions.
SystemChrome.setEnabledSystemUIMode(
  SystemUiMode.edgeToEdge,
);

// If using SafeArea:
return SafeArea (
  child: DocumentView(
    onCreated: _onDocumentViewCreated,
  ));

// If using AppBar:
return Scaffold(
  appBar: AppBar( toolbarHeight: 0 ),
  body: DocumentView(
    onCreated: _onDocumentViewCreated,
  ));

Preparation

If you want to use local files, add the following dependency to myapp/pubspec.yaml:

Usage

Replace lib/main.dart with what is shown here:

Run

  1. Launch your iOS emulator

  2. Run the app with the command:

You should see the application start up:

GuidesSamplesAPI docs

To call other Apryse APIs, please check out our API page.

You can view the source code for this project here.

Last updated

Was this helpful?