Author Topic: Print a page  (Read 1394 times)

cypress

  • Newbie
  • *
  • Posts: 2
Print a page
« on: February 26, 2009, 01:02:19 pm »
Hi Florian,

Thanks to your great work! There are a lot of flex pageflip books over the internet, but this is the only stable and nice flash as3 version.

My question is how to print a page? If I create a button in the navigation call "print", how to allow printing the current page?

Is it possible to load 1 swf across 2 pages? (Left page and right page together showing 1 swf which covers the entire area)

Florian Nücke

  • κρύα πόδια
  • Administrator
  • Hero Member
  • *****
  • Posts: 1989
  • MegaZine3 Developer
    • MegaZine3
Re: Print a page
« Reply #1 on: February 27, 2009, 10:39:12 pm »
Hi cypress,

printing is somewhere faaaar down on my todo list, so no idea to be honest. You'll probably need to capture the pages in a Bitmap object (by drawing them into a BitmapData one) and then somehow pass that image on to a print function... if you know how to take care of the actual printing and only need the image let me know, else I can't really help you, I'm afraid.

Spread pages are planned for the next version, but when that'll come I cannot promise, as I'm kind of caught up in another fun project of mine at the moment. ;)
If no crosspage animation is required, though, (i.e. perfect syncing) you could use two swfs and let them communicate as described in this tutorial.
For the Snark was a Boojum, you see.

Before you ask a question
          After you get an answer
  • please document your problem with the answer in the Project Wiki. (e.g. in the FAQs)
  • help others out if you can, by answering their questions on the forum.

cypress

  • Newbie
  • *
  • Posts: 2
Re: Print a page
« Reply #2 on: February 28, 2009, 02:17:27 am »
Thank you Florian.
Please enlighten me how to get a image by using the BitmapData, I will try to see how the print can work from there. I will post it here if it is working :)

Florian Nücke

  • κρύα πόδια
  • Administrator
  • Hero Member
  • *****
  • Posts: 1989
  • MegaZine3 Developer
    • MegaZine3
Re: Print a page
« Reply #3 on: March 04, 2009, 04:07:34 pm »
Alright... let's see.

The easiest way shipping around some possible problems with masking etc. would probably be to use the bitmapobject used in the page buffering feature introduced in 1.32.

So first of all you'd have to make sure it's always created, not only if the page should be buffered while turning. To do that, move the
Code: [Select]
_bufferImageData[i] = new BitmapData(_pageWidth, _pageHeight, false);in line 362 out of the if.

Then, when you need a page snapshot, set the buffer property of the Page object to true for a moment (and return it to the previous state immediately afterwards) to update the bitmapdata.

All that's left is how you get the data, presumably a getter for the _bufferImageData which lets one choose whether to get the even or odd page would work best.

Hope that gives some points to start from :)
For the Snark was a Boojum, you see.

Before you ask a question
          After you get an answer
  • please document your problem with the answer in the Project Wiki. (e.g. in the FAQs)
  • help others out if you can, by answering their questions on the forum.