我有 base64 格式的 pdf 内容,我需要在 flutter 应用程序的容器中显示它。
我正在尝试使用 dart 中的图像、pdf 和转换包来完成此操作,但我收到图像类错误,并且我不知道如何显示图像。
List<int> pdfDataBytes = base64.decode(fileContent);
Image img = decodeImage(pdfDataBytes);
PdfImage image = PdfImage(
pdf,
image: img.data.buffer.asUint8List(),
width: img.width,
height: img.height);
这是图像类中的错误消息:尝试使用“作为前缀”作为导入指令之一,或对除其中一个导入之外的所有导入指令隐藏名称
我没有测试它,但你有 flutter 包显示 pdf :flutter 完整 pdf 查看器 https://pub.dev/packages/flutter_full_pdf_viewer#-readme-tab-你可以找到here https://pspdfkit.com/blog/2019/opening-a-pdf-in-flutter/将此包与 pdf 资源一起使用的示例。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)