Tracy,
I thought I have answered this a while back, but maybe I didn't.
I have made the printJob() work properly for the following problems that
have been reported to this list:

1. The sample from "Flex 1.0: Sample code for printing from a DataGrid"
doesn't work correctly. Use the attached PrintDatagrid.mxml instead. 
It works correctly.

2. Can't print out header/footer area.
Let's say you have a DataGrid you want to print, but you also want to
print out a label or a button as a header of the DataGrid. To do so, you
need to do two things:
 1). Put the label/button and the DataGrid into a container, like VBox,
in
Printjob.addPage(), you need to reference the id of the VBox, not the
DataGrid.
 2). you need to set the print area properly, for example:
p.addPage("dance_mc",{xMin:-100,xMax:400,yMin:-150,yMax:560});
you need to adjust the xMin and yMin properly to include the header
area.
See printextra.mxml. This sample prints a button that is outside of the
panel.

3. When the print area is larger than the screen, some of the content
doesn't print out.
This is because application is clipping its children. To avoid this
problem,
You can set "clipContent='false' " on both the application and the box
your want to print. Note, in order for this to work properly, you need
to set the application's width/height to be large enough for the area
you want to print.
Let's say you want to print a DataGrid that is 500X600, and you set 
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";
width="100%" height="100%">
When the browser screen is larger than 500X600, then the print will work
correctly. However, if the user resizes the screen to 400X500, and then
do the print, then some portion will be clipped. To make sure the print
always work correctly, you need to set the application's width/height to
be always 
Larger than 500X600.

-lin

-----Original Message-----
From: Tracy Spratt [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 07, 2005 2:42 PM
To: [email protected]
Subject: RE: [flexcoders] Re: PrintJob()


To be clearer, despite several attempted examples (specifically the
TechNote: "Flex 1.0: Sample code for printing from a DataGrid"), there
is no way to get an entire scrollable area to print on a single page.
Your example does not test this since the content fits within the
control being printed.  I mentioned this since in a Help system, it is
reasonable to expect that there may be topics longer than will fit
within a single display control's visible area.

Also in hopes someone has solved this!

Tracy

-----Original Message-----
From: Abdul Qabiz [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 07, 2005 4:00 AM
To: [email protected]
Subject: RE: [flexcoders] Re: PrintJob()


Is it in  my mails response?

-abdul 

-----Original Message-----
From: Tracy Spratt [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 06, 2005 11:25 PM
To: [email protected]
Subject: RE: [flexcoders] Re: PrintJob()


Of course it will only print what is visible in the VBox...
Tracy

-----Original Message-----
From: Abdul Qabiz [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, April 06, 2005 5:15 AM
To: [email protected]
Subject: RE: [flexcoders] Re: PrintJob()

Hi Rich,

Try this....



##PrinJobExample.mxml###

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";
xmlns="*">

        <mx:Script>
                <![CDATA[
  
            import Help;
           
            var helpRef;
            
            public function testPrintJob():Void 
            {                   
                helpRef= createChild(Help, "help");

                        //wait untill help is created & rendered
completely...
                helpRef.addEventListener("creationComplete",
mx.utils.Delegate.create(this, printHelp));
             }
            
            function printHelp()
            {
                 var printJob:PrintJob= new PrintJob();
                 printJob.start();
                 printJob.addPage(helpRef);
                 
                 printJob.send();
                 delete printJob;
                 destroyChild(helpRef);
            }   
    ]]>
        </mx:Script>
        
        <mx:Button label="print" click="testPrintJob();"/>

</mx:Application>


##Help.mxml###

<mx:VBox xmlns:mx="http://www.macromedia.com/2003/mxml";>
    <mx:Label id="_lbl" text="Hello I am Help...."/>
    <mx:Button label="Button in Help..."/>
</mx:VBox>



Hope that helps...


-abdul

-----Original Message-----
From: Rich Tretola [mailto:[EMAIL PROTECTED] 
Sent: Friday, April 01, 2005 5:43 PM
To: [email protected]
Subject: [flexcoders] Re: PrintJob()


Does anyone have any ideas about this ?



On Mar 31, 2005 3:06 PM, Rich Tretola <[EMAIL PROTECTED]> wrote:
> I am trying to print an mlmx file at the same level as the one calling
> the printjob.  Here is my code:
> public function testPrintJob():Void {
>         var printJob:PrintJob = new PrintJob();
>         var help:Help = new Help();
>         mx.core.Application.alert("testProperty :" +
help.testProperty);
>         printJob.start();
>         printJob.addPage(0);
>         printJob.addPage("help");
>         printJob.send();
>         delete printJob;
> }
> 
> Help.mxml is the object being created in the 2nd lineof the method and
> it is being created correctly as I can read the properties of the file
> through an alert on the next line, bit I am only getting the 1st page
> which is using 0 as the object path (_root).  I have tried using help
> with and without the quotes and can never get it added as a page.
> Anyone have any ideas ?
> 
> Rich
>


 
Yahoo! Groups Links



 






 
Yahoo! Groups Links



 




 
Yahoo! Groups Links



 





 
Yahoo! Groups Links



 







 
Yahoo! Groups Links



 





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Attachment: PrintDatagrid.mxml
Description: PrintDatagrid.mxml

Attachment: printextra.mxml
Description: printextra.mxml

Reply via email to