Flash player and printing are long time enemies
If you want to generate good looking forms, you should consider pdf generation. A few links:
This is great. I had seen the alivePDF in Tour de Flex, but was unsure how to implement it. The examples on Dev Girl's blog really help. I am going to do some trials with alivePDF and purePDF and see how I get on.
It looks like XPAAJ isn't supported by Adobe any more. I managed to find a copy of the jar file on http://www.flexlive.net. In any case this solution may not work due to license restrictions.
Thanks for your help I really appreciate it. I have my homework now ;-)
I'm looking forward to your findings in comparing purePDF with alivePDF as I'm going to develop some complex print functionality in Flex in the near future...
Story so far...
It has taken quite a bit to get alivePDF up and running. I am coming from a low level of understanding of mxml and as.
I am still having difficulty getting images loaded into the PDF. Sample is here.
Generally alivePDF is good, once you get into the swing. But it is driven line by line:
myPDF.addText("Organisation: " + this.orgName.text, 20, 40);
It can be clunky, if you move something high up on the page, you have to amend the position of all of the objects below it. This leads to duplication of effort: (1) declaring objects in Flex for display; and (2) declaring objects for adding to PDF.
It can be trial and error. In Flex I had a multi-line object, which if I used addText it would look like "line1\rline2\rline3" in the PDF.
myPDF.addText("Trading address: " + this.tradeAddress.text, 20, 50);
Switching addText to addMultiCell needed three lines of as:
myPDF.addText("Trading address: ", 20, 50); myPDF.setXY(55, 46.75); myPDF.addMultiCell(120, 4, this.tradeAddress.text);
It resolved the multi-line input, but it involved trial and error in getting the x, y coordinates to work. I suspect that this is to be expected.
I have not had time to try out purePDF as yet, but I suspect that it is a similar process. One aspect is that (as far as I can tell) alivePDF will work with flash < 10, but purePDF needs flash 10. Could be wrong.
It is surprising that given Adobe's history in print and PDF, that there is this (apparent) gap between Flex/Flash and PDF.
1 person found this helpful
It's indeed a ******
Flash and Flex technology doesn't come from Adobe but from Macromedia. Flash was always intended for the screen.
I never understood why Adobe didn't focus on implementing postscript print functionality in Flash player once they acquired it.
So, indeed, you will have to write a class for every form you wish to generate.
As for coördinates, especially y-axis, I'd use a incremental value so that, if you remove a line, all the rest will re-flow.
Thanks for the feedback
I will try and implement the incremental positioning - it would be easier in the long run.