Skip to content
pubscout

pdf_image_renderer

3.0.1, released 3 weeks ago by cloudacy.com

Renders PDF pages to bitmap images using native iOS and Android renderers.

$ flutter pub add pdf_image_renderer
Source repository

What it does

The package opens a PDF file, lets you query page sizes, and renders any page to a Uint8List bitmap. It works via platform channels and supports scaling and background color options.

AI-written summary of version 3.0.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to display PDF content as images in a Flutter app
  • You require fast native rendering on Android and iOS
  • You want to avoid heavy PDF parsing libraries

Skip it when

  • You need interactive PDF features like text selection or annotations
  • You target platforms other than Android/iOS (e.g., web, desktop)

Strengths

  • Uses native renderers for performance
  • Simple API for opening, rendering, and closing pages
  • Supports scaling and custom background

Weaknesses

  • Only works on Android and iOS
  • Requires higher minSdk (24) and recent Flutter/Dart versions
  • No web or desktop support

Setup

Kind
Plugin (native code)
Effort
Medium
Code generation
No
Direct dependencies
1

Add the plugin to pubspec, ensure Android minSdk >=24 and AGP >=9, iOS deployment target >=13, and configure platform-specific permissions if needed

class MyApp extends StatefulWidget{@override _MyAppState createState()=>_MyAppState();}
class _MyAppState extends State<MyApp>{Uint8List? image;void renderPdf() async{String path=await FilePicker.getFilePath(type:FileType.custom,allowedExtensions:['pdf']);final pdf=PdfImageRenderer(path:path);await pdf.open();await pdf.openPage(pageIndex:0);final size=await pdf.getPageSize(pageIndex:0);final img=await pdf.renderPage(pageIndex:0,x:0,y:0,width:size.width,height:size.height,scale:1,background:Colors.white);await pdf.closePage(pageIndex:0);pdf.close();setState(()=>image=img);}
@override Widget build(BuildContext context){return MaterialApp(home:Scaffold(appBar:AppBar(title:Text('pdf_image_renderer')),body:Center(child:image!=null?Image(image:MemoryImage(image!)):Text('Loading...'))));}}

Alternatives

Packages that do the same job and could replace pdf_image_renderer.

  • flutter_svg

    Renders Scalable Vector Graphics (SVG 1.1) and precompiled vector graphics in Flutter.

Works with

Packages commonly used together with pdf_image_renderer: ones it builds on, ones built on it, and its own family.