我有exf url的pdf文件的URL是"test.example.com/incoice/1/download?auth_token="some_token",当我访问此URL时,url将在浏览器中显示PDF.
现在我想用打印功能打开这个pdf,我的意思是用户不必按CTRL+P我想从我这边做这个.
我试过iframe,但它给了我错误的交叉起源.这是我使用的演示代码
//first try
let _printIframe;
var iframe = _printIframe;
if (!_printIframe) {
iframe = _printIframe = document.createElement('iframe');
document.body.appendChild(iframe);
iframe.style.display = 'none';
iframe.id = "printf";
iframe.name = "printf";
iframe.onload = function() {
setTimeout(function() {
iframe.focus();
iframe.contentWindow.print();
}, 1);
};
}
// second try
// SRC of pdf
iframe.src = "Some API URl " + "/download?access_token=" +
this.authenticationService.currentTokenDetails.access_token;
let url = iframe.src + "&output=embed";
window.frames["printf"].focus();
window.frames["printf"].print();
var newWin = window.frames["printf"];
newWin.document.write('<body onload="window.print()">dddd</body>');
newWin.document.close();
Run Code Online (Sandbox Code Playgroud)
我在plunker中为print pdf创建了一个demo.http://embed.plnkr.co/WvaB9HZicxK6tC3OAUEw/在这个plunker我打开pdf在新窗口,但我想直接打印该pdf.我怎样才能做到这一点 …
当我rake db:create在我的ruby on rails项目中运行时,它给了我错误LoadError: incompatible library version - /home/tps/.rvm/gems/ruby-2.3.1/gems/puma-3.6.0/lib/puma/puma_http11.so
这是完整的错误
tps@tps-H81M-S1:~/sites/my_app$ rake db:create
rake aborted!
LoadError: incompatible library version - /home/tps/.rvm/gems/ruby- 2.3.1/gems/puma-3.6.0/lib/puma/puma_http11.so
/home/tps/.rvm/gems/ruby-2.3.1/gems/puma-3.6.0/lib/puma/server.rb:15:in `require'
/home/tps/.rvm/gems/ruby-2.3.1/gems/puma- 3.6.0/lib/puma/server.rb:15:in `<top (required)>'
/home/tps/.rvm/gems/ruby-2.3.1/gems/puma-3.6.0/lib/puma.rb:14:in `require'
/home/tps/.rvm/gems/ruby-2.3.1/gems/puma-3.6.0/lib/puma.rb:14:in `<top (required)>'
/home/tps/sites/my_app/config/application.rb:7:in `<top (required)>'
/home/tps/sites/my_app/Rakefile:4:in `<top (required)>'
/home/tps/.rvm/gems/ruby-2.3.1/gems/rake-11.3.0/exe/rake:27:in `<top (required)>'
(See full trace by running task with --trace)
Run Code Online (Sandbox Code Playgroud)
谁能帮帮我吗?
提前致谢
我'thinking-sphinx', '~> 3.1.1'在我的Rails应用程序中使用gem .我按照Git hub的所有步骤进行安装thinking-sphinx,但是当我搜索记录时,它会给我错误
通过MySQL协议连接到Sphinx时出错.通过MySQL协议连接到Sphinx时出错.
无法连接到'127.0.0.1'上的MySQL服务器(111) - SELECT*FROM
listing_core,listing_deltaWHERE MATCH(' product 1 ')ANDcommunity_ids= 1 ANDsphinx_deleted= 0 ORDER BYsort_dateDESC LIMIT 0,24 OPTION field_weights =(title = 10, category = 8,description = 3); SHOW META