Author Topic: Retrieve Bitmap data  (Read 2117 times)

vincent

  • Full Member
  • ***
  • Posts: 61
Retrieve Bitmap data
« on: December 30, 2009, 02:25:59 pm »
Hello,
First i have to say you do an excellent job on this project, the wiki and the api doc was well documented
secundo i'm french and my english is not very well...

I try to develop a Print function and for that i try to retrieve the bitmap data on a PageSide

Here is the code i use for print the cover and this work well!
Code: [Select]
var _print:PrintJob = new PrintJob();
var printOption:PrintJobOptions = new PrintJobOptions();
printOption.printAsBitmap = true;

var page:IPage = megazine.getPage(megazine.currentLogicalPage) as IPage;

var pageSide:IPageSide = page.even;

// Starts the OS's printing process by opening the printer
// dialogue, adding the read-only properties,
// and prepares the page to be sent to the spooler
_print.start();

// addPage add what is actually going to be printed
// (the Sprite object and any subsequent children)

_print.addPage(pageSide as Sprite, null, printOption);

// send finishes the print job and send the page
// to the print spooler.
_print.send();
_print = null;

my cover is compose with only a swf

but when i try to print the 2 and 3 page with the same code i have only a black page...
so i try to retrieve the bitmap with the renderInto method of PageSide but he has the same effect
my page is compose with a swf and a video and the second page was only a swf (both black :'( )
Here is my code for print both page (2 and 3)

Code: [Select]
var _print:PrintJob = new PrintJob();
var printOption:PrintJobOptions = new PrintJobOptions();
printOption.printAsBitmap = true;

var page:IPage = megazine.getPage(megazine.currentLogicalPage) as IPage;

var pageLeft:IPageSide = page.odd;
var pageRight:IPageSide = page.even;

var leftBitmap:Bitmap = pageLeft.renderInto();
var rightBitmap:Bitmap = pageRight.renderInto();
var pLeft:Sprite = new Sprite();
var pRight:Sprite = new Sprite();
pLeft.addChild(leftBitmap);
pRight.addChild(rightBitmap);


// Starts the OS's printing process by opening the printer
// dialogue, adding the read-only properties,
// and prepares the page to be sent to the spooler
_print.start();
// addPage add what is actually going to be printed
// (the Sprite object and any subsequent children)

_print.addPage(pLeft, null, printOption);
_print.addPage(pRight, null, printOption);

// send finishes the print job and send the page
// to the print spooler.
_print.send();
_print = null;

Any idea or sugestion can help me a lot, i don't know what i can doing more..

Thanks  :)
« Last Edit: December 30, 2009, 02:39:12 pm by vincent »

vincent

  • Full Member
  • ***
  • Posts: 61
Re: Retrieve Bitmap data
« Reply #1 on: December 31, 2009, 09:35:26 am »
I just see that in the api:
Important: The painted resolution can differ, depending on whether the page is currently loaded or not. It the page is not loaded, it is tried to render the cached thumbnail graphic. Leave scaleToFit set to true to have the thumbnail upscaled. If that isn't available either, the returned image will be blank and have the color of the page's background

i turned my page's background black to white and now my bitmap was full white...

But when i call my function the page side state was for both :
page_side_state_loaded


I think it's my problem do you know a way to resolve this ?
« Last Edit: December 31, 2009, 09:50:28 am by vincent »

vincent

  • Full Member
  • ***
  • Posts: 61
Re: Retrieve Bitmap data
« Reply #2 on: December 31, 2009, 09:56:12 am »
Hum, sorry i just see that in the log :
Avertissements: le filtre ne sera pas restitue. Les dimensions filtrees de l'objet DisplayObject (4188, 4188) sont trop importantes pour qu'il puisse etre dessine.
Avertissements: le filtre ne sera pas restitue. Les dimensions filtrees de l'objet DisplayObject (4188, 4188) sont trop importantes pour qu'il puisse etre dessine.
 :o it's in french
that's the google translation :
Caveats: the filter will not return. The dimensions of the filtered DisplayObject (4188, 4188) are too important for it to be emerging.

i'm gone a try to resize the bitmap before send it to the printer!
(if i finish this plugin, i'm enjoy to post it in the contribution section...)
« Last Edit: December 31, 2009, 02:18:03 pm by vincent »

vincent

  • Full Member
  • ***
  • Posts: 61
Re: Retrieve Bitmap data
« Reply #3 on: December 31, 2009, 02:18:50 pm »
OK rollback to the first post was not a problem of size, my bitmap was full white...
Any idea ?

Hans Nücke

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 800
  • MegaZine3 Sales Manager
Re: Retrieve Bitmap data
« Reply #4 on: December 31, 2009, 02:34:12 pm »
I briefly spoke with Florian about it and the first idea is that the pages are not loaded yet (because the show black).
I am not the expert and Florian is out of reach for the next couple of days, but perhaps this gives you an idea where to look for (something like "update or load pages").

Good luck; and if Florian has an additional idea, he will come back with an answer also....

vincent

  • Full Member
  • ***
  • Posts: 61
Re: Retrieve Bitmap data
« Reply #5 on: December 31, 2009, 04:29:52 pm »
ok thanks for your help.
When i call my "print function" the state of the pageSide is "page_side_state_loaded" so i presume is not the problem.

Maybe if this is too complicate i'm going to develop a javascript function for print on a flash call the page correspond on the pdf.

i'm waiting for a few days, i have to develop an "thumbnail index" plugin

Cheers and happy new year!!

Hans Nücke

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 800
  • MegaZine3 Sales Manager
Re: Retrieve Bitmap data
« Reply #6 on: December 31, 2009, 06:51:26 pm »
Just so you know and before you "waste" too much time:
we are planning to provide a print function (also with thumb nail 2D view to pick the pages to be printed) beginning of January....!

vincent

  • Full Member
  • ***
  • Posts: 61
Re: Retrieve Bitmap data
« Reply #7 on: January 06, 2010, 05:11:42 pm »
Good to hear. so i wait for your release.

thanks  :)

Ademus

  • Newbie
  • *
  • Posts: 10
Re: Retrieve Bitmap data
« Reply #8 on: January 26, 2012, 06:32:14 pm »
I get the same problem.
I think it's because images are just too big for Fash to deal with (flash is limited to 28800 x 28800 size clip or bmp)
Any idea ?