Looking into it Tom!
 
-sam
Quality Engineer,
Flex

 
On 7/4/06, Tom Chiverton <[EMAIL PROTECTED]> wrote:

Has anyone else had problems using the printJob classes ?
It seems to be failing silently for me.
printJob.start() is returning OK etc. etc.

index.mxml:
<mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
xmlns:print="com.halliwells.flex.archiving.*"
height="100%" width="100%">

<mx:Script >
<![CDATA[
import mx.printing.FlexPrintJob ;
import mx.controls.Alert;

private function alertClickHandler(event:Object):void {
var printJob:FlexPrintJob = new FlexPrintJob();
// Start the print job.
if(printJob.start()) {
// Create a MyPrintView control as a child of the current view.

var formPrintView:CoverSheetPrintView = new
CoverSheetPrintView();
addChild(formPrintView);
formPrintView.file=fileModel;

// Add the SimplePrintview control to the print job.
// For comparison, try setting the second parameter to "none".
printJob.addObject(formPrintView);

// Send the job to the printer.
printJob.send();

// Remove the print-specific control to free memory.
removeChild(formPrintView);
}else{
Alert.show("Argh, can't start");
}
}
]]>
</mx:Script>

<mx:Model id="fileModel">
<xml>
<file_id>0123456</file_id>
<file_ref>My ref</file_ref>
<file_desc> a nice logn description that goes on and on and on and on and
on and on and on and on and on and on and on and on and on and on and on and
on and on and on and on and on and on and on and on and on and on and on and
on and on and on and on and on and on and on and on and on and on and on and
on and on and on and on and on and on and on and on and on and on and on and
on and on and on and on and on and on and </file_desc>
</xml>
</mx:Model>

<print:CoverSheetPrintView file="{fileModel}" />

<mx:Button label="print" click="alertClickHandler(event)" />

</mx:Application>

CoverSheetPrintView.mxml:
<?xml version="1.0"?>
<mx:VBox xmlns:mx=" http://www.adobe.com/2006/mxml" backgroundColor="#FFFFFF">
<mx:Style>
@font-face {
src: url("/fonts/IDAutomationHC39M_Free.ttf");
fontFamily: myFont;
}
mystyleEmbed1 {
fontFamily:myFont;
fontWeight:normal;
fontSize: 84;
}
</mx:Style>
<mx:Script >
<![CDATA[
[Bindable]
public var file:Object;

private function addStars(str:String):String{
return '*'+str+'*';
}
]]>
</mx:Script>

<mx:Label styleName="mystyleEmbed1" text="{addStars( file.file_id)}"/>
<mx:Label text="{addStars(file.file_id)}"/>

<mx:HBox>
<mx:Label text="Name"/>
<mx:Label text="your name here" />
</mx:HBox>

<mx:HBox>
<mx:Label text="File ref:"/>
<mx:Label text="{file.file_ref}" />
</mx:HBox>

<mx:HBox>
<mx:Label text="Description"/>
<mx:Text text="{file.file_desc}" />
</mx:HBox>

</mx:VBox>

(this is on Windows, but test pages to the same network printer come out fine)
--
Tom Chiverton

****************************************************

This email is sent for and on behalf of Halliwells LLP.

Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at St James's Court Brown Street Manchester M2 2JF. A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law Society.

CONFIDENTIALITY

This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 8008.

For more information about Halliwells LLP visit www.halliwells.com.


__._,_.___

--
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
Web site design development Computer software development Software design and development
Macromedia flex Software development best practice


YAHOO! GROUPS LINKS




__,_._,___

Reply via email to