dart_pdf icon indicating copy to clipboard operation
dart_pdf copied to clipboard

Printing.convertHtml can't display pictures on the real mobile phone, and it will report an error

Open Allenxuxu opened this issue 1 year ago • 1 comments

Error log:

[assertion] Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}>
[ProcessSuspension] 0x1060fbf60 - ProcessAssertion: Failed to acquire RBS assertion 'ConnectionTerminationWatchdog' for process with PID=50657, error: Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}

Code snippet to reproduce the behavior:


var html = '<h2>Aug 27   21:53</h2>
<p> xx<img style="max-width: 100%; height: 300;" src="/var/mobile/Containers/Data/Application/xx/Documents/data/image/xx.jpg" alt="" /></p>'

await Printing.convertHtml(html: html);

Flutter Doctor

[✓] Flutter (Channel stable, 2.10.3, on macOS 12.3 21E230 darwin-x64, locale zh-Hans-CN)
[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.

[✓] Xcode - develop for iOS and macOS (Xcode 13.3)
[✓] Chrome - develop for the web
[!] Android Studio (not installed)
[☠] IntelliJ IDEA Ultimate Edition (the doctor check crashed)
    ✗ Due to an error, the doctor check did not complete. If the error message below is not helpful, please let us know about this issue at https://github.com/flutter/flutter/issues.
    ✗ FormatException: Unexpected extension byte (at offset 5)
[✓] IntelliJ IDEA Ultimate Edition (version 2021.3)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

! Doctor found issues in 3 categories.

Desktop (please complete the following information):

  • [*] iOS
  • [ ] Android
  • [ ] Browser
  • [ ] Windows
  • [ ] Linux

It is normal in the simulator, but it will be like this in my iphone.

Allenxuxu avatar Aug 29 '22 15:08 Allenxuxu

Can anyone help with this problem 🙊

Allenxuxu avatar Sep 17 '22 01:09 Allenxuxu

i had an issue with adding pictures to html in flutter before, i ended up converting the picture to base64 format and pass it directly to html. base64Encode(imageFile?.readAsBytesSync() ?? []);

evalsxonted avatar Oct 01 '22 09:10 evalsxonted

base64Encode(imageFile?.readAsBytesSync() ?? [])

Thank you very much!!

Allenxuxu avatar Oct 01 '22 14:10 Allenxuxu