使用 Flex 中的模板进行打印

发布于 2024-08-06 04:43:16 字数 416 浏览 1 评论 0原文

我已经设置了一个应用程序来打印我正在使用的控件的当前状态(在本例中为 ArcGIS 服务器地图),但我想设置一个打印函数,使用它自己的模板进行打印,而不是获取应用程序的状态。

我尝试通过设置一个 Flex 组件来布置我想要打印的项目并在调用 FlexPrintJob 时实例化它来实现此目的。不幸的是,简单地实例化它会导致得到一个空白的绿色方块。

我想在此提出两个主要问题。首先,需要做什么来打印新实例化的模板,而不是仅仅从屏幕上抓取现有的控件?其次,对于需要从多个源加载复杂数据的更多控件(例如 ArcGIS 地图),是否可以在这种环境中实例化它们,或者是否有办法在应用程序中拍摄控件的图像并打印该图像?

I've set up an application to print the current state of the control I'm using (in this case an ArcGIS server map), but I'd like to set up a print function that uses it's own template to print rather than grabbing the state of the application.

I've attempted to do this by setting up a flex component that lays out the items I want to print and instantiating it when I call the FlexPrintJob. Unfortunately, simply instantiating it results in getting a blank green square.

There are two main questions about this that I'd like to put out there. First, what needs to be done to print a newly instantiated template rather than just grabbing already existing controls from the screen? Second, for more controls that need to load complicated data from multiple sources, like an ArcGIS map, is it possible to instantiate them in that kind of environment, or is there a way to take an image of the control in the application and print that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

帅气尐潴 2024-08-13 04:43:16

我发现最好的方法是使用 ImageSnapshot.captureBitmapData() 方法获取地图图像作为位图数据,然后,如有必要,使用 copyPixels() 方法将其剪辑到另一个 BitMapData 对象中。

完成此操作后,将模板添加到打印作业就很简单:

Application.application.addChild(printTemplate);
printJob.addObject(printTemplate,FlexPrintJobScaleType.SHOW_ALL);
//printJob.printAsBitmap();
Application.application.removeChild(printTemplate);

I found that the best way to do it was to use the ImageSnapshot.captureBitmapData() method to get an image of the map as bitmap data, and then, if necessary, clip it into another BitMapData object using the copyPixels() method.

Once I'd done that, adding the template to the print job was simple:

Application.application.addChild(printTemplate);
printJob.addObject(printTemplate,FlexPrintJobScaleType.SHOW_ALL);
//printJob.printAsBitmap();
Application.application.removeChild(printTemplate);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文