Nic*_*ens 7 pdf express gruntjs grunt-contrib-connect
我正在运行一个AngularJS应用程序,我正在使用该grunt-contrib-connect插件来托管我的东西.我想在浏览器中访问一些PDF文件(在所有这些文件中进行测试),但页面保持空白.但它确实显示了正确的页面数量.我使用Word和Pages从.doc文件导出PDF,但结果保持不变.
我写了这个小中间件片段以确保标题设置(根据Chrome的网络标签,它们是,但是页面保持空白.有帮助吗?
在我的Grunt文件中;
grunt.initConfig({
settings: {}, // ...
connect: {
livereload: {
middleware: function(connect) {
var middlewares = [];
// Other middlewares
middlewares.push(function (req, res, next) {
if (~req.url.indexOf('.pdf')) {
res.setHeader('Content-type', 'application/pdf');
}
return next();
});
return middlewares;
}
}
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
491 次 |
| 最近记录: |