flutter - Flutter for web 编写新标签
问题描述
所以我有一个base64编码字节的html。
我想做类似的事情
let pdfWindow = window.open("")
pdfWindow.document.write("<iframe width='100%' height='100%' src='data:application/pdf;base64, " + encodeURI(base64EncodedPDF) + "'></iframe>")
在 web 上颤动。但是,当我跑步时
var openWindow = html.window.open("", "Form");
我没有能力为 pdf 编写 HTML。
我的目标是能够从浏览器打印 pdf,
有人知道从这里去哪里吗?
解决方案
使用 url_launch 包url_launch
void main() {
runApp(Scaffold(
body: Center(
child: RaisedButton(
onPressed: _launchURL,
child: Text('Show Flutter homepage'),
),
),
));
}
_launchURL() async {
const url = 'https://flutter.dev';
if (await canLaunch(url)) {
await launch(url);
} else {
throw 'Could not launch $url';
}
}
推荐阅读
- logging - 您如何处理在代码中更深入地记录 HTTP 请求和输出跟踪和错误消息的不同任务?
- asp.net - 我的子报告在主报告的每个单元格中显示所有结果
- java - Postgresql 和 JDBC 检查元数据中的 TYPE ENUM
- python - 如何在没有任何排序功能的情况下按字母顺序对字符串数组进行排序?Python
- reactjs - Nginx - try_files:如何设置远程文件(url)?
- android - 尝试从我的适配器中的 onClick 事件中打开活动
- bash - 如何确定bash中的换行符?
- mysql - 时间戳的时区如何在数据库和/或 Laravel 中工作
- html - 显示代码而不是 html 元素
- swift - 检查每个 ViewController 的登录状态