PDF生成在ASP。净MVC的TCPDF

时间:2021-01-27 03:27:17

Basically I'm after advice on producing dynamic PDFs with charts, images and some styling into a view or partial view for the user to print or optionally download.

基本上,我希望得到关于在视图或部分视图中使用图表、图像和样式生成动态pdf的建议,以便用户打印或可选地下载。

I've used TCPDF in the past, and so was wondering if there was any way to utilize my TCPDF php files to pass a generated PDF into a view?

我以前使用过TCPDF,所以我想知道是否有办法利用TCPDF php文件将生成的PDF传递到视图中?

I've also looked at ITextSharp, but I was worried about the lack of customization including dynamic charts that TCPDF has provided me in the past.

我也看了ITextSharp,但我担心缺乏定制,包括TCPDF提供给我的动态图表。

Could anyone point me in the right direction? Currently I'm attempting to install VS.PHP module for Visual Studio 2010, in the hope I can load the generated TCPDF file into a memorystream and pass it to a view (inline).

谁能给我指出正确的方向吗?目前我正在尝试在Visual Studio 2010中安装VS.PHP模块,希望我可以将生成的TCPDF文件加载到memorystream中并将其传递给视图(内联)。

Is my logic totally wrong? Please advise.

我的逻辑完全错误吗?请建议。

Thanks.

谢谢。

[EDIT]

(编辑)

I've added Phalanger (http://phalanger.codeplex.com/) to my project along with some tcpdf examples in my Content/reports folder.

我已经在我的项目中添加了Phalanger (http://phalanger.codeplex.com/)以及我的Content/reports文件夹中的一些tcpdf示例。

my controller code was pretty simple (I got most of it from another post on the Phalanger forums):

我的控制器代码非常简单(大部分代码来自于另一篇在蝴蝶兰论坛上的文章):

        public ActionResult SummaryReport()
    {
        var context = PHP.Core.ScriptContext.CurrentContext;

        using (var request_context = PHP.Core.RequestContext.Initialize(PHP.Core.ApplicationContext.Default, System.Web.HttpContext.Current))
        {
            var output = request_context.ScriptContext.Include(Server.MapPath(Url.Content("~/Content/reports/testoutput.php")), false);

            return Content("");
        }
     }

However I'm now receiving TCPDF Errors when the controller tries to execute the TCPDF example:

但是,当控制器试图执行TCPDF示例时,我现在正在接收TCPDF错误:

Warning: preg_match(): Invalid argument 'pattern':     u0192\u2039\u008D\u203A\u017E\u0178\u00A1-\u00BA] # AL | Ù[\u20AC-\u0160\u00AD-\u00AF\u00B1-\u00BF] # AL | Ú[\u20AC-\u00BF] # AL | Û[\u20AC-\u2022\u009D\u00A5\u00A6\u00AE\u00AF\u00BA-\u00BF] # AL | Ü[\u20AC-\u008D\u0090\u2019-\u00AF] # AL | Ý[\u008D-\u00AD] # AL | Þ[\u20AC-\u00A5\u00B1] # AL | ï­[\u0090-\u00BF] # AL | ï®[\u20AC-\u00B1] # AL | ï¯[\u201C-\u00BF] # AL | ï[\u00B0-\u00B3][\u20AC-\u00BF] # AL | ï´[\u20AC-\u00BD] # AL | ïµ[\u0090-\u00BF] # AL | ï¶[\u20AC-\u008F\u2019-\u00BF] # AL | ï·[\u20AC-\u2021\u00B0-\u00BC] # AL | ï¹[\u00B0-\u00B4\u00B6-\u00BF] # AL | ïº[\u20AC-\u00BF] # AL | ï»[\u20AC-\u00BC] ..." - [x-y] range in reverse order. in (MYPATH)\Content\reports\tcpdf\tcpdf.php on line 15859, column 7.

Warning: preg_match(): Invalid argument 'pattern': [x-y] range in reverse order. in (MYPATH)\Content\reports\tcpdf\tcpdf.php on line 15865, column 7.

Has anyone any idea how to overcome this? I've taken the latest TCPDF at will most likely post on the TCPDF forum. I fear if I can't get these working I will result to using a .NET PDF library as I'm under strict time constraints.

有人知道怎么克服这个吗?我已经在TCPDF论坛上随意发布了最新的TCPDF。我担心如果我不能使这些工作,我将导致使用。net PDF库,因为我在严格的时间限制。

Thanks for your time.

谢谢你的时间。

1 个解决方案

#1


1  

Have you looked at ABCpdf yet? It seems to be the suitable solution for you :)

你看过ABCpdf了吗?这似乎是一个适合你的解决方案:

ps: link is included in my comment

我的评论里有链接

#1


1  

Have you looked at ABCpdf yet? It seems to be the suitable solution for you :)

你看过ABCpdf了吗?这似乎是一个适合你的解决方案:

ps: link is included in my comment

我的评论里有链接