2017-05-03 8 views
0

私はjsPDFを使用して作成した自分のイオンアプリからpdfを共有したいと考えています。 SocialSharingプラグインと一緒に使うにはどうすればいいですか?イオンアプリでPDFを共有する

doc.save("resume.pdf") 

これはpdfを直接ダウンロードし、私が何もできない画面に連れて行きます。

//share(message, subject, file, url) 
this.socialSharing.share("Test", null, doc.save("resume.pdf"), null); 

これも機能しません。私はイオンと角度が新しいです。

更新:を読んで、pdfmakeでpdfを作ることについて話しましたが、私はまだ同じ方法を分かりません。

それを共有するための

答えて

0
import { File } from '@ionic-native/file'; 

var blob = doc.output('blob', {type: 'application/pdf'}); 
let pdfUrl = {pdfUrl: URL.createObjectURL(blob)}; 

if (this.file.checkFile(this.file.cacheDirectory, "myresume.pdf")) 
{ 
this.file.writeExistingFile(this.file.cacheDirectory, "myresume.pdf",blob) 
     .then(() => console.log('overwrite done')) 
     .catch(err => console.log(err +' old copies not removed')); 
} else{ 
    this.file.writeFile(this.file.cacheDirectory, "myresume.pdf", blob, true) 
     .then(_ => console.log('write successful')) 
     .catch(err => console.log(err+ " write failed")); 
} 

import { File } from '@ionic-native/file'; 
import { SocialSharing } from '@ionic-native/social-sharing'; 
export class ResumeView { 
     pdfUrl : String; 
     constructor(public navCtrl: NavController, 
        public navParams: NavParams, 
        private socialSharing: SocialSharing, 
        private file: File 
        ) 
     { 
      this.pdfUrl = this.navParams.get('pdfUrl'); 
     } 
     regularShare(){ 
      this.socialSharing.share("test", null, this.file.cacheDirectory + filename, null) 
     } 
関連する問題