小编Kau*_*nes的帖子

RuntimeError(无法执行:错误:"\ xFE"从ASCII-8BIT到UTF-8):

试图使用Wicked PDF.

我在控制器中有这个代码

  def pdf
  pdf = WickedPdf.new.pdf_from_string(
  render_to_string(
  pdf: 'filename.pdf',
  template: '/pages/poa.html.slim',
  layout: '/layouts/pdf'),
  header: {
      content: render_to_string({
          template: '/pdfs/poa_header.html.slim',
          layout: '/layouts/pdf'
      })
  })

   save_path = [Rails.root, '/public/pdf/', 'filename.pdf'].join
   File.open(save_path, 'wb') do |file | file << pdf
   end
   end
Run Code Online (Sandbox Code Playgroud)

我在尝试执行上面的操作时收到此错误消息

RuntimeError (Failed to execute:

Error: "\xFE" from ASCII-8BIT to UTF-8):
Run Code Online (Sandbox Code Playgroud)

我已经尝试清空我正在渲染的模板和布局的内容但仍然出错.

wicked-pdf ruby-on-rails-3.2

8
推荐指数
3
解决办法
3775
查看次数

如何在android中使用jquery和phonegap打开pdf文件?

最近我正在为android构建一个应用程序.我正在使用phonegap来做同样的事情.一切都运行良好,除了一个问题,即我无法在Android中使用jquery打开pdf文件.我已经尝试了很多相同但我无法做到这一点.

我想要的是,点击图像后,它将从网址打开一个pdf.

编辑:

我试过这个:

<img src="img/b_img1.png" onclick="openPdf('http://www.w3.org/2011/web-apps-ws/papers/Nitobi.pdf')"/>
Run Code Online (Sandbox Code Playgroud)

openPdf函数是这样的:

 function openFile(pdfUrl) {
     window.plugins.fileOpener.open(pdfUrl);
 }
Run Code Online (Sandbox Code Playgroud)

fileOpener插件是这样的:

cordova.define("cordova/plugin/fileopener",
    function(require, exports, module) {
        var exec = require("cordova/exec");
        var FileOpener = function() {};

        FileOpener.prototype.open = function(url) {
            exec(null, null, "FileOpener", "openFile", [url]);
        };

        var fileOpener = new FileOpener();
        module.exports = fileOpener;

    });
/**
 * Load Plugin
 */
if (!window.plugins) {
    window.plugins = {};
}
if (!window.plugins.fileOpener) {
    window.plugins.fileOpener = cordova.require("cordova/plugin/fileopener");
}
Run Code Online (Sandbox Code Playgroud)

我在config.xml页面中添加了插件,如下所示:

 <plugin name="FileOpener" value="com.phonegap.plugins.file.FileOpener"/>
Run Code Online (Sandbox Code Playgroud)

我已经在com.phonegap.plugins.file包中添加了FileOpener.java,如下所示:

    package com.phonegap.plugins.file;

     import java.io.File;
     import java.io.FileOutputStream;
     import java.io.IOException;
     import …
Run Code Online (Sandbox Code Playgroud)

pdf jquery android cordova

7
推荐指数
1
解决办法
9189
查看次数

Bitbucket 权限被拒绝(公钥)。但可以与 ssh 一起使用

您好,如果我尝试使用 ssh 连接 bitbucket.org

ssh -vT git@bitbucket.org
Run Code Online (Sandbox Code Playgroud)

一切正常

debug1: Authentication succeeded (publickey).
Run Code Online (Sandbox Code Playgroud)

但如果我尝试使用该git clone命令,我会收到以下消息:

Permission denied (publickey).
fatal: The remote end hung up unexpectedly
Run Code Online (Sandbox Code Playgroud)

一些额外信息:

  • 我已经将公钥包含在我的 Bitbucket 帐户中
  • 我的钥匙位于~/.ssh/
  • 我没有使用 sudo 运行
  • 该命令ssh-add -l返回正确的密钥。(RSA)

git ssh key public bitbucket

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

android ×1

bitbucket ×1

cordova ×1

git ×1

jquery ×1

key ×1

pdf ×1

public ×1

ruby-on-rails-3.2 ×1

ssh ×1

wicked-pdf ×1