Hi Sam...

Sure, I can definitely do that.  Here is a snippet from my XML file.  I've taken just the top few lines and added the necessary end tags.

<?xml version="1.0" encoding="ISO-8859-1"?>
<Bom matnr="353559" bismt="DBT353559" name="CUTTING HEAD DRIVE ASSEMBLY" hasBom="X">
  <item id="0001" qty="2.000" uom="EA" matnr="353560" bismt="DBT353560" name="MOTOR DRIVE SHAFT" hasBom="" path="pdf/353560.pdf" image="pdf/thumbnails/353560.jpg"/>
  <item id="0002" qty="2.000" uom="EA" matnr="172186" bismt="J-491929" name="TORQUE CLUTCH" hasBom="" path="pdf/172186.pdf" image="pdf/thumbnails/172186.jpg"/>
  <item id="0003" qty="2.000" uom="EA" matnr="353570" bismt="DBT353570" name="CAP, SEAL" hasBom="X" path="pdf/353570.pdf" image="pdf/thumbnails/353570.jpg">
    <item id="0001" qty="0.100" uom="FT" matnr="269580" bismt="0000 008 302 48 19" name="ROUND BAR(HR 4340HT)4.00&quot;" hasBom=""/>
  </item>
  <item id="0004" qty="2.000" uom="EA" matnr="169220" bismt="J-486851" name="COVER" hasBom="X" path="pdf/169220.pdf" image="pdf/thumbnails/169220.jpg">
    <item id="0010" qty="1.000" uom="EA" matnr="177413" bismt="J-547F198MK002" name="COVER WELDMENT" hasBom="X" path="pdf/177413.pdf" image="pdf/thumbnails/177413.jpg">
      <item id="0010" qty="1.000" uom="EA" matnr="169941" bismt="J-547F198MK003" name="PLATE" hasBom="X" path="pdf/169941.pdf" image="pdf/thumbnails/169941.jpg">
        <item id="0010" qty="0.200" uom="FT2" matnr="131877" bismt="0000 008 302 72 61" name="PLATE(A572-50)1.00&quot;" hasBom=""/>
      </item>
      <item id="0020" qty="1.000" uom="EA" matnr="169942" bismt="J-547F198MK004" name="PLATE" hasBom="X" path="pdf/169942.pdf" image="pdf/thumbnails/169942.jpg">
        <item id="0010" qty="0.220" uom="FT2" matnr="131874" bismt="0000 008 302 72 58" name="PLATE(A572-50).75&quot;" hasBom=""/>
      </item>
    </item>
  </item>

</bom>

 

As for code, here is the mxml view I'm trying to create:

<?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" height="100%"  creationComplete="doPrint()"  backgroundColor="#ffffff" >
 <mx:VBox height="396" width="535" id="atts" x="72" y="10" backgroundColor="#ffffff">
                 <mx:Label text="{product.name}" fontSize="11" fontWeight="bold"/>
                  <mx:Label text="MATNR: {product.matnr}" color="#EE8D0C"/>                    
                  <mx:Label text="BISMT: {product.bismt}" color="#EE8D0C"/>
                  <mx:Label text="UOM: {product.uom}" color="#EE8D0C"/>
                 <mx:Label text="QTY: {product.qty}" color="#EE8D0C"/>
                 <mx:Image  id="img"  source="{product.image}" width="143" height="97"/>
 </mx:VBox>

</mx:Canvas>

The intent with the canvas is to use a CSS to create a template to publish the XML data to and then print it.  I was originally trying to batch print PDFs, but since that can't really be done effectively in flex and I have all the data that is in the PDF, I'm trying to go the route of duplicating what the PDF looks like in a flex canvas.

As for AS code, i'm not really sure what to send.  Nothing I have works and I've got code commented all over the place with the different routes I've tried.   So let me do this...I'll highlight the overall workflow here in this post.  Sam, if you check your gmail account, I'll attach two files and some code snippets that I've been playing around with.

Intended Workflow:

Flex app initializes with XML data loaded into ArrayCollection of objects.

User elects to "Print Catalog"--gets prompted with a SINGLE print dialog window.

Flex app loops through ArrayCollection and sends each object to the above mxml Canvas component for printing.

 

Since the main problem is being created by the fact that the object is added to the print job before the image has loaded, I really think the solution lies in pre-loading the image before the canvas ever gets created.

 

Wayne


--- In [email protected], "Samuel Reuben" <[EMAIL PROTECTED]> wrote:
>
> Hi Wayne,
>
> Could you please post some code, possibally with the xml file to? It will
> help us reproduce the problem that you are facing and find a solution to it.
>
> Thanks,
> -sam
>
>
> On 8/16/06, wayneposner [EMAIL PROTECTED] wrote:
> >
> > Unfortunately, when a user requests a print job it will mean print
> > all the images.
> >
> > cacheAsBitmap....been having problems with bitmaps as they don't
> > seem to load into an IUIComponent. Any insite into possibly why?
> >
> >
> > Wayne
> >
> > --- In [email protected] <flexcoders%40yahoogroups.com>, "Tim
> > Hoff" TimHoff@ wrote:
> > >
> > > Yeah, I'm not saying load all of the images at one time, just the
> > > ones that you want to print. Possible use of cacheAsBitmap here
> > too.
> > >
> > > -TH
> > >
> > > --- In [email protected] <flexcoders%40yahoogroups.com>,
> > "wayneposner" <wayne.posner@>
> > > wrote:
> > > >
> > > > I thought about doing that, but am concerned about the
> > possiblity
> > > of
> > > > loading anywhere from 500 to 1000 2k-10k images into memory and
> > > how
> > > > it will affect the system while waiting for all those images to
> > > > load. Additionally, I need to add some metadata text which is
> > > also
> > > > coming from the XML file. Which brings me back to one at a time
> > > or
> > > > somehow preloading each image before the canvas is rendered.
> > > >
> > > > Wayne
> > > >
> > > > --- In [email protected] <flexcoders%40yahoogroups.com>, "Tim
> > Hoff" <TimHoff@> wrote:
> > > > >
> > > > > Hi Wayne,
> > > > >
> > > > > This a little out of my area, but maybe it will spark an
> > idea.
> > > > > Instead of loading the images that you want to print, one-at-a-
> > > > time,
> > > > > into a canvas. You could load all of the images, at the same
> > > > time,
> > > > > into a Repeater (or a list-based control). On
> > creationComplete
> > > of
> > > > > the Repeater, add the child (Repeater) to the PrintJob.
> > > > >
> > > > > If you are also embedding the images, this approach may
> > consume
> > > a
> > > > > lot of CPU resources. But, I'm sure that you can find a
> > balance
> > > > > here.
> > > > >
> > > > > Hope this helps,
> > > > > Tim
> > > > >
> > > > > --- In [email protected] <flexcoders%40yahoogroups.com>,
> > "wayneposner"
> > <wayne.posner@>
> > > > > wrote:
> > > > > >
> > > > > > I've been trying to figure this one out for about a week now
> > > > with
> > > > > no
> > > > > > success.
> > > > > >
> > > > > > I'm trying to load a bunch of images dynamically from an XML
> > > > file,
> > > > > > pass each image, one at a time, to a Canvas and then print
> > > that
> > > > > > Canvas, but only being prompted with the print dialog for
> > the
> > > > > first
> > > > > > image. If I just pass the image to the canvas, the print
> > > > command
> > > > > > has executed before the image loads.
> > > > > >
> > > > > > If I use an event listener for the complete action on my
> > > canvas
> > > > I
> > > > > > get the print dialog for every canvas that tries to print,
> > > > > provided
> > > > > > I instatiate a new FlexPrintJob in my event handler--as
> > > opposed
> > > > to
> > > > > a
> > > > > > global FlexPrintJob which simply results in an empty print
> > job.
> > > > > >
> > > > > > I've tried writing a preloader using the Loader class and a
> > > > > sprite
> > > > > > to hold the image and then add the sprite to my canvas, but
> > > my
> > > > > code
> > > > > > fails at the addChild() statement at run time because flex
> > > > cannot
> > > > > > coerce the Loader into an IUIComponent.
> > > > > >
> > > > > > I've also tried a preinitialze event on my canvas which
> > calls
> > > > the
> > > > > > image.Load command for an mx:image tag, but that doesn't
> > work
> > > > > either.
> > > > > >
> > > > > >
> > > > > > It seems like I'm running out of options here. I didn't
> > think
> > > > it
> > > > > > would be so difficult to print multiple pages of images in
> > > > Flex.
> > > > > > Can someone please help!!!!
> > > > > >
> > > > > > Thanks
> > > > > > Wayne
> > > > > >
> > > > >
> > > >
> > >
> >
> >
> >
>

__._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to