패키지, 저장소 및 앱 카테고리 검색

패키지 상세v3.0.1

pdf_image_renderer

운영 체제의 네이티브 렌더러를 사용하여 PDF를 빠르고 간단하게 렌더링할 수 있는 패키지입니다.

AndroidiOS
30일 다운로드
5.3천
좋아요
36
Pub 점수
150

패키지 설치

flutter pub add pdf_image_renderer

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

pdf_image_renderer 패키지는 Android 및 iOS의 네이티브 PDF 렌더링 기능을 활용하여 PDF 문서를 빠르고 간단하게 렌더링할 수 있게 해줍니다. 순수한 Dart 구현에 의존하지 않고 PDF 페이지를 이미지로 변환하는 가볍고 효율적인 솔루션을 제공합니다. 이 접근 방식은 높은 성능과 정확한 시각적 출력을 보장하며, 원본 OS 동작과 매우 유사하게 작동합니다. PDF 미리보기 또는 썸네일이 필요한 애플리케이션에 적합하며, 최소한의 설정으로 쉽게 통합할 수 있습니다. 이 패키지는 cloudacy.com에서 유지 관리되며, 두 주요 모바일 플랫폼과 호환됩니다.

사용 사례

  • PDF 썸네일 생성
  • 앱에서 PDF 페이지 렌더링
  • 문서의 이미지 미리보기 만들기
  • 완전한 뷰어 없이 PDF 콘텐츠 표시
  • Flutter에서 네이티브 PDF 렌더링 통합

주요 기능

  • 네이티브 OS PDF 렌더러 사용
  • 고성능 및 정확도
  • 최소한의 설정 필요
  • 크로스 플랫폼 지원 (Android, iOS)
  • 가볍고 효율적

적합한 대상

  • PDF 미리보기 필요 모바일 앱
  • 이미지 기반 문서 처리
  • 성능에 민감한 렌더링 앱
  • 원본 렌더링 정확도를 추구하는 개발자
  • 큰 PDF 라이브러리를 피하는 프로젝트

고려 사항

  • Android 및 iOS에 한정
  • 웹 또는 데스크톱 지원 없음
  • 플랫폼별 PDF 렌더링에 의존합니다
  • 기기 운영 체제 버전에 따라 약간 다를 수 있습니다
  • 인터랙티브 PDF 기능을 지원하지 않습니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

pdf_image_renderer

pub package

Renders PDFs to bitmaps using native renderers.

Usage

See the example folder for a fully working flutter example.

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  Uint8List image;

  void renderPdfImage() async {
    // Get a path from a pdf file (we are using the file_picker package (https://pub.dev/packages/file_picker))
    String path = await FilePicker.getFilePath(type: FileType.custom, allowedExtensions: ['pdf']);

    // Initialize the renderer
    final pdf = PdfImageRenderer(path: path);

    // open the pdf document
    await pdf.open(
      // password: 'password', // optional (iOS and Android 15.0+ support - ignored otherwise)
    )

    // open a page from the pdf document using the page index
    await pdf.openPage(pageIndex: 0);

    // get the render size after the page is loaded
    final size = await pdf.getPageSize(pageIndex: 0);

    // get the actual image of the page
    final img = await pdf.renderPage(
          pageIndex: pageIndex,
          x: 0,
          y: 0,
          width: size.width, // you can pass a custom size here to crop the image
          height: size.height, // you can pass a custom size here to crop the image
          scale: 1, // increase the scale for better quality (e.g. for zooming)
          background: Colors.white,
        );

    // close the page again
    await pdf.closePage(pageIndex: 0);

    // close the PDF after rendering the page
    pdf.close();

    // use setState to update the renderer
    setState(() {
      image = img;
    });
  }

  @override
  void initState() {
    super.initState();
  }


  // you can use this image later in your build function
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        home: Scaffold(
          appBar: AppBar(
            title: const Text('pdf_image_renderer'),
          ),
          body: Center(
            child: image != null ? Image(image: MemoryImage(image)) : Text("Loading..."),
          )
        )
    );
  }
}

카테고리

의존성

의존성 목록 1 개

  • plugin_platform_interface^2.1.8

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.