Monday, February 25, 2008

PrintTileList along the lines of PrintDataGrid.

After seeing this query I thought it should be easy to get it to work. So spent 2 hours (that is little more than expected, isn't it!) and here is the result.

The source is here.

17 comments:

Unknown said...

Wow, you have to write quite many overrides to enable standard TileList with multi-page Print support.

Do you think it will be quite a work to enable printing of multipage ViewStack?

http://www.mail-archive.com/flexcoders@yahoogroups.com/msg84509.html

ps
Let's make the world more usable, let 's use "View Source" feature of Adobe Flex SDK ;)

Sreenivas said...

To me "View source" option seems very bulky.

For ViewStack printing are we looking at a use case where there would be scroll bars in the views?

It should be easy to print non-scrollable views.

Unknown said...

The structure of our DisplayObjectList:

mx: ViewStack >
Page 1 > Content container
Page 2 > Content container
Page 3 > Content container

We are are looking together with Sergey (author of the question at Flexcoders mailing list) into opportunity of printing of collection of Content containers - each Content container is a direct child of page taken from the Viewstack.

This Content container does not have a scrollbar.

ViewStack Page probably will have a scrollBar.

Out use-case it to allow to print the presentation that contains a number of slides that is made in online editor made with Flex 2 SDK

Sreenivas said...

If I understand your use-case correctly there are series of slides of a presentation being shown in the view stack. You want to print each slide on page and complete view stack like this. Right?

Unknown said...

Yes, you are correct.

We are able to print single slide that is currently visible on the screen.

But we currently cannot devise an action how-to print multiple slides stored at Viewstack at once.

Sreenivas said...

How are you generating the children of view stack? I am asking this because you are mentioning that it would be from a on-line editor. If possible can you send me a sample app which needs to be printed?

Unknown said...

I've created basic sample app that tries to print 3 pages at Viewstack at once.

The link is here:
http://jabbypanda.com/temp/multiprint/TestPrinting.html

"View source" is enabled by context menu.

Viewstack creation policy is not different from default - it is "auto".

Sreenivas said...

I would have tried setting the viewStack selectedIndex from 1..n in a loop and adding it to the print job each time. Of-course without missing validateNow() call.

Have you tried this? Or you don't want to take that approach? (It seems to work for a sample I tried)

Unknown said...

Hi Sreenivas,

Setting 'selectedIndex' to the next page in the Viewstack prior to adding to PrintJob is a smart thing, thank you for a fresh thought.

Things will get more complex as we are going to load the external content at the Viewstack's page (videos, images, SWF files) - thus we will have to listen for Event.COMPLETE completion for multiple downloads of external files at the each Viewstack page before adding the page content to the PrintJob.

Anyway, thank you for the involvement, I much appreciate it.

Anonymous said...

Hi,

Do you know if this works with a Tile List of images? I cannot seem to get it to work. i have a employee list of thumbnails with each of their names under the image. So when I print, just the name prints out and whitespace that equals the area(dimensions) of the JPG. I know that mx:Image tag is somewhat working because those image dimensions are being displayed.

Any help would be great.

Thanks,
mparkster

Anonymous said...

I would like to add that I was able to embed a source image and print out the tile list of this embedded image just fine. So it seems that there is some kind of issue sending dynamically retrieved images to the printer.

Sreenivas said...

Dynamic Images are always a problem because there is nothing to confirm there loaded state and printing cannot wait !

The solution is to build what needs to be printed and wait till all images are loaded and then trigger the print. (We cannot start the print and wait because we may hit script-time-out)

I am working on a sample for this but it may take a while (2-3 days) before I can post it.

Gió said...

I wonder that PrintAdvancedDataGrid have bug. I have an AIR app to work with document file. The output is AdvancedDataGrid and I want to print it.
I use code to work with AdvancedDataGrid follow link http://livedocs.adobe.com/flex/3/html/help.html?content=printing_5.html#145939

When I debug my app by run only each code line, it can print my table but not stable, sometimes ok and sometimes print nothing. When I run normal, it always print white page. I check my printer and see the flash object pending to print is very large (> 10MB) so I think seem the app have no enough time to send object to printer.
Are you meet the same problem? What do you think about it?
Hai Anh

You can see full question in http://www.flexdeveloper.eu/forums/actionscript-3-0/printadvanceddatagrid/

Geetha Narayanan said...

Hi Srinivas,

i would like to know, if you have a sample code for printing the dynamically loaded images, that you have told in one of your coments in this post.

If so, let me know, as i am in need of it. I tried searching a lot on this, but ended up with nothing.

Thanks,
Geetha

Jácome said...

Hello.

This is really a great post! Could you please post the solution to print dynamically loaded images?

Thanks,
Jacome

Sreenivas said...

I don't have the solution still. I am still trying. The way player expects the print dialog to be shown and then printed is causing issues.

abhishek said...

how can we show images instead of data and print all images in tilelist
:)