Wx.downloadfile and wx.opendocument combination of small programs (ii)
Should be in the middle also to take over other projects, so the interval is a little awkward, then the last time, continue to pits.
This demand began to be a special issue, with a large background + sliding switch selection, select the slide to switch the small picture, background background to display a picture of the corresponding special issue. Look directly at the picture:
have been done. And then the product asks if you can directly use the PDF online preview (wry smile ...) ), it was a rip-off, because it didn't work, and the applet document didn't finish. Then honestly continue to brush the document.
Kung Fu is not a conscientious person, found a good thing: wx.opendocument
Code:
Wx.downloadfile ({
URL: ' https://*****.***.work/videos/test2.pdf ',
success:function (res) {
Console.log (res)
var Path = Res.tempfilepath //Returns the file temporary address used to open the local preview using the
wx.opendocument ({
FilePath: Path,
success:function (res) {
console.log (' Open Document Success ')}}
)
},
fail:function (res) {
Console.log (res)
}
})
Started to drop directly on the server is the client side to provide a PDF, file size 31MB, have thought will be very large, user download will be very long, sure enough, the direct fail callback back to me:
exceeded the maximum size of the file, came back and looked up, Local storage File size limit: 10MB; So I changed to a smaller PDF, I returned the address successfully, and a PDF preview was implemented on the phone. But this size limit, I can not solve, only limit the size of the PDF file, if you want to long-term save to the local, you need to use the wx.savefile. Pits Road to be continued