具有翻转效果的离子pdf查看器

时间:2019-05-06 12:10:09

标签: pdf ionic-framework ionic3 flip

我需要使用IONIC框架渲染具有翻转效果的pdf文件。

我可以使用以下代码打开pdf。但是我需要在其中添加翻转效果。如果您将示例代码或链接发送给我,以添加翻转效果,那就太好了。

import { File } from '@ionic-native/File/ngx';
import { FileOpener } from '@ionic-native/file-opener/ngx';
import { DocumentViewer, DocumentViewerOptions } from '@ionic-native/document-viewer/ngx';
import { FileTransfer } from '@ionic-native/file-transfer/ngx';
import { Platform } from '@ionic/angular';

openLocalPdf() {
   let filePath = this.file.applicationDirectory + 'www/assets';
   console.log(filePath,'filepath')

   if (this.platform.is('android')) {
     let fakeName = Date.now();
     this.file.copyFile(filePath, 'pdf.pdf', this.file.dataDirectory, `${fakeName}.pdf`).then(result => {
       this.fileOpener.open(result.nativeURL, 'application/pdf')
         .then(() => console.log('File is opened'))
         .catch(e => console.log('Error opening file', e));
     })
   } else {
     // Use Document viewer for iOS for a better UI
     const options: DocumentViewerOptions = {
       title: 'My PDF'
     }
     this.document.viewDocument(`${filePath}/5-tools.pdf`, 'application/pdf', options);
   }
 }

0 个答案:

没有答案