packages.flutter icon indicating copy to clipboard operation
packages.flutter copied to clipboard

PDFX not works in Flutter 3.16.3 when use data type Uint8List

Open RicharC293 opened this issue 1 year ago • 9 comments

Describe the bug With the latest flutter version pdfx is not works when requiere render with Future<PdfDocument> openData(FutureOr<Uint8List> data, {String? password})

To Reproduce Steps to reproduce the behavior:

  1. Upgrade flutter to latest version
  2. Create a list of bytes Uint8List
  3. use openData to render PDF

Expected behavior The pdf will be showed same to 3.13.5 flutter version.

Screenshots All information exists but content is empty so, shows this screen: image

[✓] Flutter (Channel stable, 3.16.3, on macOS 14.1.1 23B81 darwin-arm64, locale es-419) • Flutter version 3.16.3 on channel stable at /Users/richarcangui/development/flutter • Upstream repository https://github.com/flutter/flutter.git • Framework revision b0366e0a3f (16 hours ago), 2023-12-05 19:46:39 -0800 • Engine revision 54a7145303 • Dart version 3.2.3 • DevTools version 2.28.4

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0) • Android SDK at /Users/richarcangui/Library/Android/sdk • Platform android-34, build-tools 33.0.0 • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 15A507 • CocoaPods version 1.14.2

[✓] Chrome - develop for the web • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] IntelliJ IDEA Ultimate Edition (version 2023.2.5) • IntelliJ at /Applications/IntelliJ IDEA.app • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.84.2) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.78.0

[✓] Connected device (5 available) • LM X525 (mobile) • LMX525USUKZP5D9PE6 • android-arm • Android 10 (API 29) • iPhone de Richar (mobile) • 00008120-00044C500C00C01E • ios • iOS 17.1.2 21B101 • iPhone 15 Pro (mobile) • 4084559E-4A21-450A-A93B-60D7184A85BF • ios • com.apple.CoreSimulator.SimRuntime.iOS-17-0 (simulator) • macOS (desktop) • macos • darwin-arm64 • macOS 14.1.1 23B81 darwin-arm64 • Chrome (web) • chrome • web-javascript • Google Chrome 119.0.6045.199

[✓] Network resources • All expected network resources are available.

• No issues found!

RicharC293 avatar Dec 06 '23 19:12 RicharC293

I noticed this too, I'm wondering if this patch may fix the issue? https://github.com/ScerIO/packages.flutter/pull/458/files https://github.com/ScerIO/packages.flutter/issues/448#issuecomment-1819884276

rpekarek-tc avatar Dec 06 '23 19:12 rpekarek-tc

More than month went after 3.16.0 released..... Author could you fix it, please.

rimidalv avatar Dec 26 '23 13:12 rimidalv

Same issue here... It is been a long time after 3.16.0 was released, some update about that?

alejantab avatar Dec 26 '23 16:12 alejantab

Same applied to PdfDocument.openFile for our project.

peterlauri avatar Jan 09 '24 16:01 peterlauri

Has anyone found a workaround to this bug?

mikeesouth avatar Jan 14 '24 11:01 mikeesouth

Has anyone found a workaround to this bug?

@mikeesouth We are using this commit, it resolved the problem for us.

  # TODO: pdfx should be updated to official version when fix is released to pub.dev
  pdfx:
    git:
      url: 'https://github.com/ScerIO/packages.flutter'
      ref: 'd637108a2a6e3e97a70304f00f1eda9511fb4f92'
      path: packages/pdfx

peterlauri avatar Jan 14 '24 12:01 peterlauri

@peterlauri by using below pattern to write dependency i resolved the issue of DecoderCallback is deprecated but not able to open pdf it's showing only loader

pdfx: git: url: 'https://github.com/ScerIO/packages.flutter' ref: 'd637108a2a6e3e97a70304f00f1eda9511fb4f92' path: packages/pdfx

HirenRushang avatar Feb 08 '24 10:02 HirenRushang

Please check the new version on PubDev, it has been updated to 2.6.0 and includes the fix for the DecoderCallback issue.

ManuelRauber avatar Feb 11 '24 08:02 ManuelRauber

Please check the new version on PubDev, it has been updated to 2.6.0 and includes the fix for the DecoderCallback issue.

I can confirm that the 2.6.0 resolves the issue for us at least :)

peterlauri avatar Feb 12 '24 08:02 peterlauri