2016-12-09 44 views
0

我有一個應用程序,顯示我一個網站(uiwebview)。在該網站中,我有一些鏈接,可以在webview中打開我的pdf。我想要什麼是...我可以做什麼,如果我按鏈接,pdf下載而不是打開它?謝謝。IOS從WebView,Cordova訪問後保存PDF

+0

退房http://stackoverflow.com/questions/23825871/how-to-force-a-download-file-prompt-instead-of-displaying-it-in-browser-with-htm – donovantc

+0

我不認爲你理解我的問題.. :( –

回答

0

你可能會放一些代碼嗎?它可能瞭解您的要求好一點

+0

所以..如果我想從我的ios應用程序打開一個.pdf文件,它將打開一個pdf,沒有導航控制(沒有關閉/後退按鈕我的應用程序 - 如附圖所示) https://postimg.org/image/8rtst9fv5/ –

0

Cordova-PDFReader-IOS 要在命令行安裝:

cordova plugin add com.lesfrancschatons.cordova.plugins.pdfreader 

支持的URI方案:文件對於其他的方案,請與科爾多瓦插件文件傳輸先下載它。

//Open a pdf 
PDFReader.open('absolutepath.pdf', options, success, error); 

//Available options 
{ 
    password: null, 
    flatUI: true, 
    showShadows: true, 
    enableThumbs: true, 
    disableRetina: false, 
    enablePreview: true, 
    bookmarks: true, 
    landscapeDoublePage: true, 
    landscapeSingleFirstPage: true, 
    toolbarBackgroundColor: null, 
    textColor: null, 
    enableShare: false, 
    page: 2 
} 

//Event when PDF Reader is closed 
document.addEventListener('PDFReaderClosed', function() {console.log('closed');}) 

//Clear PDF Reader cache 
PDFReader.clearCache(filePath, finishedCallback);