标签: jsreport

如何在AngularJS中连接jsReport?

我现在有一个关于JSReport的问题..它假设我已经有了一个API ...我现在想要的是如何将它与我使用AngularJS的客户端链接.

如果我使用Postman,它将返回一个我想要的pdf文件.但我的问题是当我使用angularjs发布它时如何显示它是我的页面..

我有这样的代码:

调节器

$scope.Print = function () {
        authService.print().then(function(result){
            var _result = result;
        });
    };
Run Code Online (Sandbox Code Playgroud)

服务

var _print = function () {
        var data = { "template": { "shortid": "byQtwHLPQ" } };
        return $http.post("http://192.168.8.87/api/report", data).then(function (result) {
            return result;
        });
    };

authServiceFactory.print = _print;
Run Code Online (Sandbox Code Playgroud)

现在我有了这个代码并且它不起作用......我认为它没有返回所以我删除了返回并且只是发布但是它仍然没有用,甚至下载pdf也没有用.

有人可以帮忙吗...

javascript report angularjs jsreport

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

如何使用nodeJs将jsreport渲染保存到文件?

我是node.js和jsreport的新手,但我尝试做的是使用node.js在内存中创建一个pdf,然后将其保存到磁盘.我需要这个,因为它将作为AWS Lambda函数运行.

var fs = require('fs');
require("jsreport").render("<h1>Hi there!</h1>").then(function(out) {
    //pipe pdf with "Hi there!"
    fs.writeFile('C:\\helloworld.pdf', out, function (err) {
        if (err) return console.log(err);
        console.log('Hello World > helloworld.txt');
    });
fs.close();
    console.log("The End");
});
Run Code Online (Sandbox Code Playgroud)

虽然运行输出pdf将无法在Adobe Reader中打开,因此我假设文件输出不是有效的PDF.

这需要npm install jsreport

javascript node.js jsreport

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

什么是 TypeScript 等价于 `var x = require("somemod")();`

在我使用的 node.js 中jsreport-core,它们像var jsreport = require('jsreport-core')();尾随(). 我很好奇在 TypeScript 中复制这种导入技术的最佳方法是什么?

require node.js typescript jsreport

6
推荐指数
1
解决办法
2406
查看次数

how to include helpers in jsreport

I am using Dotnet Core 2.2 to generate report with JSReport (https://jsreport.net/) I use local JsReport so I sent my template and data to the local server and get back the pdf. Now I need to format date in javascript, so I require to include moment.js into my templates. I have no idea how to do that.

In html I need to format StartDate to formated Date using moment.js I have no idea how to include moment.js into …

javascript handlebars.js .net-core jsreport

4
推荐指数
1
解决办法
826
查看次数

使用 Ajax 调用在新窗口中打开 pdf

我正在使用 nodejs 和 jquery 开发 Web 应用程序。其中有一个报告部分。当用户使用 ajax 调用向服务器发送一些数据时(这里我使用 'get' 方法来缓解问题),它应该将 pdf 发送到客户端并应该显示在弹出窗口中。

我在服务器端使用jsreport来生成报告。

这是 Node js 服务器代码。

.get('/testPdf', async function (req, res, next) {

    var htmlNew = '<html> ' +
        '<head> ' +
        '</head> ' +
        '<body> ' +
        '<h2>Hello World</h2>' +
        '</body> ' +
        '</html> ';

    return jsreport.render({
        template: {
            content: htmlNew,
            engine: 'handlebars',
            recipe: 'chrome-pdf'
        },
    }).then((resp) => {
        var data = resp.content;
        res.contentType("application/pdf");
        res.send(data);
    });
})
Run Code Online (Sandbox Code Playgroud)

这是客户端jquery的代码。

function myPdfRun() {
    console.log('Call')
    $.ajax({
        type: 'get', …
Run Code Online (Sandbox Code Playgroud)

pdf ajax jquery node.js jsreport

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

如何配置jsreport-assets

我正在尝试将jsreport-assetsjsreport-core 一起使用。但是当我尝试利用模板中的资产时出现错误,如下所示:

<img class="logo" src="{#asset myimage.png @encoding=dataURI}" />
Run Code Online (Sandbox Code Playgroud)

错误:找不到资产 myimage.png

我对在哪里存储我的资产文件以及如何配置jsreport-core和/或jsreport-assets利用这些资产感到困惑。

jsreport

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