Please file a bug on the print to file issue.
Thanks, -Alex ________________________________ From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of dmiramontesval Sent: Thursday, March 01, 2007 6:31 PM To: [email protected] Subject: [flexcomponents] Re: More questions about Printing, handling printing errors Ok i will try error number 1 but i think i should explain more about error 2 When you select the MS document writer (print to file) then printJob.start() returns true, so all the print logic is executed while the Save As prompt appears, if you cancel here then the error happens. It is very different than canceling the printJob in the print prompt because then printJob.start() returns false, but the issue is after this, when you cancel at the Save as prompt since you are already inside the print logic. My code has something like this: if (printJob.start()) { addChild(printView); //configures the PDG printJob.doPrint(printView); //calls the multipage stuff } As you can see i am only executing this when printJob.start() returns true, so all the print logic (i based on the LiveDocs) is executed but then you cancel the printJob at the Save As prompt, this one only appears when you want to print to a file becasue you need to specify where to save the file, if you print with a printer then the Save as prompt never happens and the printJob does his thing normally. So any ideas of this? Try canceling the printJob in the save as prompt when you try to print to a file --- In [email protected] <mailto:flexcomponents%40yahoogroups.com> , "Alex Harui" <[EMAIL PROTECTED]> wrote: > > If printJob.start() returns false, nobody should be calling addPage() > > > > I think you should be ok if you re-enable the button after > printJob.send() is called. > > > > ________________________________ > > From: [email protected] <mailto:flexcomponents%40yahoogroups.com> > [mailto:[email protected] <mailto:flexcomponents%40yahoogroups.com> ] On Behalf Of dmiramontesval > Sent: Thursday, March 01, 2007 5:05 PM > To: [email protected] <mailto:flexcomponents%40yahoogroups.com> > Subject: [flexcomponents] More questions about Printing, handling > printing errors > > > > It seems that printing is one of the complicated topics with Flex :P > > Well i am now printing my grids correctly and everything works fine, > or so i was expecting because there are some scenarios where an error > is being thrown. > > 1.- After the print prompt appears and you choose the printer to > print, you get control of the flex application again, if you try to > print and the printer hasn't finished, you get an error that only one > print job can be handled at the time. So how would you recommend this > error to be handled? I think that maybe deactivating the print Button > and then activating it when the printer has finished, but i don't seem > to find a way to do this last part (notify flex when the printer has > finished). Any ideas? > > (This next one is not very common for the client to do it, but i felt > the curiosity of asking) > 2.- When the print prompt appears i choose to print it to a file > printer (Microsoft Office Document Image Writer for example). When > doing this everything works fine, the output is printed into a .mdi > file. > > Then here comes the issue, the prompt appears and i select to print it > to a file, then i am asked for the name of the file and the location, > if i decide to cancel the printing job at this point (in the save as > prompt) Flex throws an error saying: > > Error #2057: The page could not be added to the print job. > at Error$/throwError() > at flash.printing::PrintJob/addPage() > at mx.printing::FlexPrintJob/addObject() > > I followed the Adobe LiveDocs example on multipage printing so the > error occurs when you add objects to the printJob, for example: > > printView.showPage(DataGridPrintView.SINGLE); > if (!printView.dataGridToPrint.validNextPage) { > this.addObject(printView); > } > > ***printView is the component (contains the header, the PDG and the > footer) that is being added to the application's display list. > > Any ideas of how can i catch this error?? > > These two seem to be pretty harsh so any ideas would be appreciated >
