使用 Flex 中的模板进行打印
我已经设置了一个应用程序来打印我正在使用的控件的当前状态(在本例中为 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现最好的方法是使用 ImageSnapshot.captureBitmapData() 方法获取地图图像作为位图数据,然后,如有必要,使用 copyPixels() 方法将其剪辑到另一个 BitMapData 对象中。
完成此操作后,将模板添加到打印作业就很简单:
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: