<tfoot id='rH5NG'></tfoot>
  • <legend id='rH5NG'><style id='rH5NG'><dir id='rH5NG'><q id='rH5NG'></q></dir></style></legend>

    <small id='rH5NG'></small><noframes id='rH5NG'>

          <bdo id='rH5NG'></bdo><ul id='rH5NG'></ul>

        <i id='rH5NG'><tr id='rH5NG'><dt id='rH5NG'><q id='rH5NG'><span id='rH5NG'><b id='rH5NG'><form id='rH5NG'><ins id='rH5NG'></ins><ul id='rH5NG'></ul><sub id='rH5NG'></sub></form><legend id='rH5NG'></legend><bdo id='rH5NG'><pre id='rH5NG'><center id='rH5NG'></center></pre></bdo></b><th id='rH5NG'></th></span></q></dt></tr></i><div id='rH5NG'><tfoot id='rH5NG'></tfoot><dl id='rH5NG'><fieldset id='rH5NG'></fieldset></dl></div>

      1. 在 ionic 2 应用程序中打开 PDF 文件

        时间:2023-09-08
        <i id='mjRq0'><tr id='mjRq0'><dt id='mjRq0'><q id='mjRq0'><span id='mjRq0'><b id='mjRq0'><form id='mjRq0'><ins id='mjRq0'></ins><ul id='mjRq0'></ul><sub id='mjRq0'></sub></form><legend id='mjRq0'></legend><bdo id='mjRq0'><pre id='mjRq0'><center id='mjRq0'></center></pre></bdo></b><th id='mjRq0'></th></span></q></dt></tr></i><div id='mjRq0'><tfoot id='mjRq0'></tfoot><dl id='mjRq0'><fieldset id='mjRq0'></fieldset></dl></div>

            <tbody id='mjRq0'></tbody>
          • <bdo id='mjRq0'></bdo><ul id='mjRq0'></ul>

                <legend id='mjRq0'><style id='mjRq0'><dir id='mjRq0'><q id='mjRq0'></q></dir></style></legend>
                <tfoot id='mjRq0'></tfoot>

                  <small id='mjRq0'></small><noframes id='mjRq0'>

                • 本文介绍了在 ionic 2 应用程序中打开 PDF 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试制作一个 ionic 2 应用程序.我有一个使用 jsPDF 生成的 pdf.

                  I am trying to make an ionic 2 app. I have a pdf generated using jsPDF.

                  相同的代码是

                  var doc = new jsPDF();
                  doc.setFontStyle('Bold');
                  doc.setFontSize(14);
                  doc.text('Testing PDFs', 20, 20);
                  

                  现在我想保存在移动应用中打开的 PDF,

                  Now I want to save the open the PDF in the mobile app,

                  doc.output('save', 'tester.pdf'); 似乎在移动应用程序中不起作用.

                  but doc.output('save', 'tester.pdf'); doesn't seem to work in the mobile app.

                  请告诉我可以安装哪个插件来查看和分享新制作的pdf.

                  Please can you tell me which plugin can I install so as to view and share the newly made pdf.

                  推荐答案

                  必须使用 jsPDF创建 PDF.然后,必须使用 blob 属性将其转换为应用程序可以使用的格式,以便在将其放在屏幕上之前允许在应用程序中传递.

                  One has to use jsPDF to create a PDF. Then one has to use blob attribute to convert it to the format that can be used by the application to allow passing in the app before putting it on screen.

                  在 blob 步骤之后,必须安装 ng2-pdf-viewer 在命令行上通过命令npm install ng2-pdf-viewer --save 并使用 在移动应用程序屏幕上查看.

                  After the blob step, One has to install ng2-pdf-viewer on the command line by the command npm install ng2-pdf-viewer --save and use the <pdf-viewer> to view it on the mobile app screen.

                  确保在 import 语句中的 app.module.ts 文件和 @NgModule.

                  Make sure you import the the ng-pdf-viewer in the app.module.ts file in the import statements and in the @NgModule.

                  这是相同的代码,

                  var doc = new jsPDF();
                  doc.setFontStyle('Bold');
                  doc.setFontSize(14);
                  doc.text('Testing PDFs', 20, 20);
                  var blob = doc.output('blob', {type: 'application/pdf'});
                  let pdfUrl = {pdfUrl: URL.createObjectURL(blob)};
                  let modal = this.navCtrl.push(ResumeView, pdfUrl);
                  

                  在简历视图中

                  @Component({
                    selector: 'page-resume-view',
                    templateUrl: '<ion-content padding text-center>
                                     <pdf-viewer [src]="pdfUrl" 
                                                 [page]="page" 
                                                 [original-size]="false"
                                                 style="display: block;">
                  
                                      </pdf-viewer>
                                  </ion-content>',
                  })
                  export class ResumeView {
                    pdfUrl : String;
                    constructor(public navCtrl: NavController, public navParams: NavParams) {
                  
                    }
                  
                    ionViewDidLoad() {
                      console.log('ionViewDidLoad ResumeView');
                      this.pdfUrl = this.navParams.get('pdfUrl');
                     }
                  
                  }
                  

                  这篇关于在 ionic 2 应用程序中打开 PDF 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何更新 ionic 2 侧菜单中的值 下一篇:ionic 2 + angular 2:自动滚动到列表/页面/聊天的底部

                  相关文章

                  最新文章

                • <tfoot id='FJnv0'></tfoot>
                  <legend id='FJnv0'><style id='FJnv0'><dir id='FJnv0'><q id='FJnv0'></q></dir></style></legend>
                    <bdo id='FJnv0'></bdo><ul id='FJnv0'></ul>

                    <i id='FJnv0'><tr id='FJnv0'><dt id='FJnv0'><q id='FJnv0'><span id='FJnv0'><b id='FJnv0'><form id='FJnv0'><ins id='FJnv0'></ins><ul id='FJnv0'></ul><sub id='FJnv0'></sub></form><legend id='FJnv0'></legend><bdo id='FJnv0'><pre id='FJnv0'><center id='FJnv0'></center></pre></bdo></b><th id='FJnv0'></th></span></q></dt></tr></i><div id='FJnv0'><tfoot id='FJnv0'></tfoot><dl id='FJnv0'><fieldset id='FJnv0'></fieldset></dl></div>
                  1. <small id='FJnv0'></small><noframes id='FJnv0'>