SmartGWT pdf导出

SmartGWT pdf导出,pdf,smartgwt,Pdf,Smartgwt,是否有人成功使用SmartGWT 3.x pdf导出 我的客户端代码如下所示: DSRequest requestProperties = new DSRequest(); requestProperties.setExportFilename("File.pdf"); requestProperties.setExportDisplay(ExportDisplay.DOWNLOAD); requestProperties.setContentType("application/pdf");

是否有人成功使用SmartGWT 3.x pdf导出

我的客户端代码如下所示:

DSRequest requestProperties = new DSRequest();
requestProperties.setExportFilename("File.pdf");
requestProperties.setExportDisplay(ExportDisplay.DOWNLOAD);
requestProperties.setContentType("application/pdf");

RPCManager.exportContent(table, requestProperties);
当代码运行时,什么也不会发生。我需要在服务器端做些什么吗


我可以补充一点,我的应用程序正在成功使用列表网格中的SmartGWT excel导出。

您的问题的答案是肯定的:无数开发人员已成功使用SmartGWT的PDF导出。现在请把我的观点告诉我;)


要进行故障排除,请查看服务器日志中的错误。

我也徒劳地试图找到有关此问题的文档。但这并不难。您的代码似乎是正确的,添加了一个要打印的画布和requestProperties.setDownloadResult(true)行

然后,我从smartgwtEE lib文件夹(在eclipse.classpath中)添加了以下JAR



这就是它的全部内容:-)

谢谢,但您是否通过任何更改了解任何指定服务器端需要执行的操作的文档?在web.xml中声明一个特定的servlet,或者自己实际执行pdf生成?无需在服务器端执行任何操作,这都是自动的。然而,这里是自动行为中涉及的服务器端类,它们有一些用于执行相关操作(例如将生成的.pdf保存到磁盘)的代码示例。这是这里的全部文档:请注意,正如文档所说,您应该包括飞碟的core-renderer.jar,大概您的项目已经有了它。
            final Canvas canvas = new Canvas();
            canvas.setWidth(300);
            canvas.setBorder("2px solid Red");
            DynamicForm formPrint = new DynamicForm();
            formPrint.setWidth(200);
            formPrint.setHeight(100);
            formPrint.setTop(20);
            formPrint.setLeft(50);
            formPrint.setBorder("2px solid Black");
            TextItem textItem = new TextItem();
            textItem.setName("NameBo");
            textItem.setTitle("Title");
            textItem.setValue("Value goes here...");
            formPrint.setFields(textItem);
            canvas.addChild(formPrint);
            canvas.draw();  // to view onscreen


            DSRequest requestProperties = new DSRequest();
            requestProperties.setExportFilename("File");
            requestProperties.setExportDisplay(ExportDisplay.DOWNLOAD);
            requestProperties.setContentType("application/pdf");
            requestProperties.setDownloadResult(true);
            RPCManager.exportContent(canvas, requestProperties);
<classpathentry kind="var" path="SGWTEE_HOME/lib/isomorphic_contentexport.jar"/>
<classpathentry kind="var" path="SGWTEE_HOME/lib/iText-2.0.8.jar"/>
<classpathentry kind="var" path="SGWTEE_HOME/lib/jtidy-r938.jar"/>