When David and I were doing the research for a paper we recently wrote, I came across the Adobe online documentation for Flex printing, which can be found here.
There are several classes discussed there: FlexPrintJob, which prints one or more objects and can split large objects for printing on multiple pages and scales the output to fit the page size. PrintDataGrid is subclass of the DataGrid control with a default appearance that is customized for printing. The class includes properties and a method that provide additional sizing and printing features. PrintAdvancedDataGrid is a subclass of the AdvancedDataGrid control with a default appearance that is customized for printing. The class includes properties and a method that provide additional sizing and printing features. FlexPrintJobScaleType defines constants used in the FlexPrintJob addObject() method.
These classes give the Flash/Flex developer control over how print can be generated from within the application. As one would expect from Adobe products, the output is designed to be directed to PostScript and "non-PostScript" printers.
While there is no native way direct the resulting print stream to the cloud, David and one of Mimeo's developers, a Flash/Flex guru Brad Johnson, came up with a way to accomplish this. An efficient and powerful (as well as simplified) way to print from the Flash/Flex platform would be to enable the developer to use the same mechanism and code path to print to the cloud as they can use to print locally today (e.g., like in the above example and described in Adobe documentation). In Flex 3 (at this writing, the latest iteration of the technology), the developer simply uses an instance of a PrintJob class, to start(), then uses addObject() one or more times, and finally employs send() print output to the OS for local printing.
To address printing in the cloud, a more universal (or web service) version of the PrintJob class would be created, perhaps called UniversalPrintJob that inherits it interface and capabilities from PrintJob but that adds the capabilities necessary for formatting and redirection of the output to the PSP. This class could provide an alternate implementation of PrintJob that would directly create a PDF or some other portable format from any Flex object added to the print job through the addObject method providing a great solution to the problem of creating an appropriate printable format.
Continuing this idea there could be additional properties, methods or parameters that could provide the additional information needed when the Send method is invoked to submit the content to a RESTful webservice. By simply providing a URL, additional job information and order data formatted as XML or JSON the send method could use the internal Flex HTTPService and/or WebService classes to seamlessly send this print job to a web enabled PSP.
Monday, June 15, 2009
Tuesday, June 2, 2009
Silverlight and Printing
Microsoft had an amazing opportunity for Silverlight to provide the most robust printing support of any RIA platform, based on XAML and XPS technologies. Unfortunately there isn’t even a native ability to robustly support local printing in Silverlight 2. They will probably address these issues eventually (and maybe sooner rather than later, but apparently not in Silverlight 3.)
To print from Silverlight to a local printer, you basically have to control HTML/CSS in browser and print via browser to local printer (good enough output, some challenges to implement.) Jonas Follesoe has provided great detail regarding Silverlight printing, here on his blog: jonas.follesoe.no
Our interest here is Printing to the Cloud (i.e., to an Internet-based print service provider like our company Mimeo.com), more than printing to a local printer-- although you have to start somewhere, and the desktop is a good place to begin! Since Silverlight basically uses XAML as its imaging model and XPS is a subset of XAML it would seem to make sense that one could create methods for converting Silverlight content to XPS, then send this data to the Cloud for processing and/or printing. XPS is not (yet) universally accepted, but then again neither is Silverlight. That said, it is just as feasible to generate PDF from Silverlight as it is from Flex.
To print from Silverlight to a local printer, you basically have to control HTML/CSS in browser and print via browser to local printer (good enough output, some challenges to implement.) Jonas Follesoe has provided great detail regarding Silverlight printing, here on his blog: jonas.follesoe.no
Our interest here is Printing to the Cloud (i.e., to an Internet-based print service provider like our company Mimeo.com), more than printing to a local printer-- although you have to start somewhere, and the desktop is a good place to begin! Since Silverlight basically uses XAML as its imaging model and XPS is a subset of XAML it would seem to make sense that one could create methods for converting Silverlight content to XPS, then send this data to the Cloud for processing and/or printing. XPS is not (yet) universally accepted, but then again neither is Silverlight. That said, it is just as feasible to generate PDF from Silverlight as it is from Flex.
Subscribe to:
Posts (Atom)