当前位置:网站首页>How to open the thought map pdf of postgraduate entrance examination in the small program of postgraduate entrance examination question bank
How to open the thought map pdf of postgraduate entrance examination in the small program of postgraduate entrance examination question bank
2022-07-23 14:04:00 【mon_ star°】
How to open the thought map of postgraduate entrance examination in the small program of postgraduate entrance examination question bank pdf
demand : Meet such a demand , Postgraduate entrance examination question bank applet , To solve the pain point of sharing learning materials , We need to build a database , Therefore, it is necessary to open the thought map of postgraduate entrance examination materials pdf The function of .
problem : Use... In wechat applet web-view open pdf, IOS It can be opened normally ,Android Open as blank .
solve : Use wx.downloadFile and wx.openDocument. adopt downloadFile Get file path ( The local path ), And then use openDocument Open a new page to open a document .
wx.downloadFile(Object object)
Function description
Download file resources to local . The client directly initiates a HTTPS GET request , Return the local temporary path of the file ( The local path ), The maximum number of files allowed for a single download is 200MB. Please read the relevant instructions before use .
Be careful : Please respond on the server header Reasonable specified in Content-Type Field , To ensure that the client handles file types correctly .
Return value
An object that can listen for download progress change events and cancel downloading .
Implementation code
wx.downloadFile({
url: 'https://.../XXX.pdf', // Just for the sample , Not real resources
success (res) {
// As long as the server has response data , It will write the response to the file and enter the success Callback , The business needs to decide whether it has downloaded the desired content
if (res.statusCode === 200) {
}
}
fail (err) {
console.log(err); // Failure
}
})wx.openDocument(Object object)
Function description
Open a new page to open a document . File path ( The local path ) , It can be done by downloadFile get .
Implementation code
wx.openDocument({
fileType: 'pdf', // file type
filePath: Path, // The file path to open
success: function (res) {
console.log(' open PDF success ');
}
})Realization effect

边栏推荐
- Color recognition of regions of interest in pictures and videos based on OpenCV
- Kingbaseesv8r6 difference of xmin under different isolation levels
- Common mouse events and keyboard events
- Unity制作简单拦截近防炮——如何预测打击目标
- OSPF detailed explanation (LSA) (2)
- Connaissance détaillée du GRE, du mgre; Connaissance de la configuration de base de l'OSPF
- [laser principle and application -7]: semiconductor refrigeration sheet and Tec thermostat
- Événements courants de la souris et du clavier
- 静态综合实验(HCIA)
- 子组件向父组件传参的几种方法
猜你喜欢
随机推荐
Matlab: convert PNG pictures into txt files
BERT 文章翻译
Review of HCIA
生活随笔:2022烦人的项目
LeetCode_47_全排列Ⅱ
Life essays: annoying projects in 2022
常用的鼠標事件和鍵盤事件
Interviewer: have you learned about the underlying implementation of reentrantlock? tell us your opinion
Golang remote server debugging
KingbaseES DENSE_RANK 函数用法
kafka消费报错coordinator unavailable.Rediscovery will be attempt redisCovery
Connaissance détaillée du GRE, du mgre; Connaissance de la configuration de base de l'OSPF
How to ensure the reliable transmission of messages? What if the message is lost
【Ardunio】2种方法控制舵机
C #: in, out, ref Keywords
Creo 9.0 中几何对象的选取方法
子组件向父组件传参的几种方法
RIP实验
Rip experiment
rtx3090ti什么水平 rtx3090ti显卡什么级别 rtx3090ti显卡怎么样
![[wechat applet] case - local life](/img/9d/c1525ce3c199d4db83b7a3b6828b63.png)








