[flexcoders] Re: Interacting from outside local sandbox to java server

2009-02-18 Thread Jeremi Bergman
Here is the modified Java method:

private void startServer(int port) {
System.out.println(">> Starting PDFPrintServer");

String policy_file = "";
policy_file += "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd\";>";
policy_file += "";
policy_file += "";
policy_file += "\";";

try {
System.out.println(">> Starting SimpleServer");
try {
socket = new ServerSocket(port);
while (true) {
System.out.println(">> Waiting for 
socket connection");
incoming = socket.accept();
System.out
.println(">> We're 
connected!  Waiting for input");
readerIn = new BufferedReader(new 
InputStreamReader(

incoming.getInputStream()));
printOut = new 
PrintStream(incoming.getOutputStream());
String request = 
readerIn.readLine().trim();
System.out.println(">> Input " + 
request);

if (request.substring(1, 20).compareTo(
"policy-file-request") 
== 0) {
System.out.println(">> Sending 
Policy Information");
printOut.println(policy_file + 
"\r");
} else {
String[] data = 
request.split("%");
if (data[0].compareTo("print") 
== 0) {
System.out.println(">> 
Printing file " + data[1]);
String pdf_path = 
this.DownloadFile(data[1]);
System.out.println(">> 
Pdf Temp file: " + pdf_path);
this.PrintPDF(pdf_path);
}
}

incoming.close();
}
} catch (Exception e) {
System.out.println(e);
}

} catch (Exception e) {
System.out.println(e);
}

}

Here, I'm sending it directly after the request then closing the
connection.  My impression was that Flex would open another connection
immediately afterward and send the original request.

Thoughts?



[flexcoders] Interacting from outside local sandbox to java server

2009-02-17 Thread Jeremi Bergman
I have a java server that I modified based off of the SimpleServer
 java class.

Everything works perfectly when I run from flex builder.  As soon as I
deploy it, it will not connect.  I know this has to do with the
crossdomain.xml file, but I cannot get the java class to send back
what it needs to get this to work.

Does anyone have any examples of how this may work?  

I've tried sending it as soon as the socket connection is made, I've
tried after reading from the input stream that flex is asking for the
policy-file-request, etc.

Thanks



[flexcoders] Re: Silent Print from Flex on Kiosk

2009-02-06 Thread Jeremi Bergman
If anyone else comes across this need, here's how I solved it for my
particular setup.

My Flex app is the client on the Kiosk that connects via RPC back to a
PHP backend.

So when I need to print, I call a service on my backend which
generates a PDF and returns a URL.

Flex then calls a Java Print Server that I wrote that sits and listens
for incoming URLs to print. When it gets one, it prints to the default
printer.

Javascript was just too inconsistent for this.

Thanks all.

--- In flexcoders@yahoogroups.com, "Gregor Kiddie"  wrote:
>
> I agree, more than anything Adobe could do, being over zealous on the
> security front could inhibit Flash as a platform taking off (yes I'm
> still annoyed about not getting to load remote modules in AIR). It
> wasn't exactly a winner for Vista!
> 
> If they can work out a comfortable security model that...
> 
> 1.Stops drive by swfs owning your machine and,
> 2.allows trusted applications to do more with less security,
> 
> they will be onto a winner. The Flash Player is maturing into number 1
> nicely, but AIR has still a ways to go to meet number 2.
> 
>  
> 
> Gk.
> 
> Gregor Kiddie
> Senior Developer
> INPS
> 
> Tel:   01382 564343
> 
> Registered address: The Bread Factory, 1a Broughton Street, London SW8
> 3QJ
> 
> Registered Number: 1788577
> 
> Registered in the UK
> 
> Visit our Internet Web site at www.inps.co.uk
> http://www.inps.co.uk/> 
> 
> The information in this internet email is confidential and is intended
> solely for the addressee. Access, copying or re-use of information in it
> by anyone else is not authorised. Any views or opinions presented are
> solely those of the author and do not necessarily represent those of
> INPS or any of its affiliates. If you are not the intended recipient
> please contact is.helpd...@...
> 
> 
> 
> From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com] On
> Behalf Of Jeremi Bergman
> Sent: 30 January 2009 20:51
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Re: Silent Print from Flex on Kiosk
> 
>  
> 
> Thanks for the info.
> 
> It would be nice to be able to add an app as a "Trusted" application,
> so that the application would have the option to print silently.
>




[flexcoders] Re: Silent Print from Flex on Kiosk

2009-01-30 Thread Jeremi Bergman
Thanks for the info.

It would be nice to be able to add an app as a "Trusted" application,
so that the application would have the option to print silently.



--- In flexcoders@yahoogroups.com, "Gregor Kiddie"  wrote:
>
> Yeah, The Flash Player doesn’t allow silent printing, as some wag
would write an advertising swf which printed out their entire
promotional literature of 2000 pages on your printer every time you
checked your email…
> 
> Nate is right, if you have JS code that works, call out to that, or
use some other means of interacting with the printer (we have a client
side DotNet component to handle our printing needs).
> 
>  
> 
> Gk.
> 
> Gregor Kiddie
> Senior Developer
> INPS
> 
> Tel:   01382 564343
> 
> Registered address: The Bread Factory, 1a Broughton Street, London
SW8 3QJ
> 
> Registered Number: 1788577
> 
> Registered in the UK
> 
> Visit our Internet Web site at www.inps.co.uk
http://www.inps.co.uk/> 
> 
> The information in this internet email is confidential and is
intended solely for the addressee. Access, copying or re-use of
information in it by anyone else is not authorised. Any views or
opinions presented are solely those of the author and do not
necessarily represent those of INPS or any of its affiliates. If you
are not the intended recipient please contact is.helpd...@...
> 
> 
> 
> From: flexcoders@yahoogroups.com [mailto:flexcod...@yahoogroups.com]
On Behalf Of Nate Beck
> Sent: 29 January 2009 17:18
> To: flexcoders@yahoogroups.com
> Subject: Re: [flexcoders] Silent Print from Flex on Kiosk
> 
>  
> 
> Just a theory... but you might be able to use ExternalInterface to
call the same methods within user.js, and pass the content.  Since
you're already got it working within Javascript.
> 
>  
> 
> I wish I knew more about FlexPrintJob.
> 
> On Thu, Jan 29, 2009 at 8:41 AM, Jeremi Bergman mailto:jere...@...> > wrote:
> 
> I have a flex app that I need to print an image. I have Firefox Setup
> running the app.
> 
> in user.js for FF i have:
> user_pref(†print.always_print_silent†,true);
> user_pref(†print.show_print_progress†,false);
> 
> This works perfectly when using firefox's print functionality on any
> standard site. It prints directly to the default printer without any
> user interaction.
> 
> Within my App I have:
> 
> public static function printCoupon(obj:UIComponent):void {
> // Create an instance of the FlexPrintJob class.
> var printJob:FlexPrintJob = new FlexPrintJob();
> 
> // Start the print job.
> if (printJob.start() != true) return;
> 
> // Add the object to print. Do not scale it.
> printJob.addObject(obj, FlexPrintJobScaleType.NONE);
> 
> // Send the job to the printer.
> printJob.send();
> }
> 
> The UIComponent passed in is an Image.
> 
> It prints the image, but it prompts me with the print diologe box.
> 
> Any thoughts? Thanks.
> 
> 
> 
> 
> -- 
> 
> Cheers,
> Nate
> 
> http://blog.natebeck.net <http://blog.natebeck.net>
>




[flexcoders] Silent Print from Flex on Kiosk

2009-01-29 Thread Jeremi Bergman
I have a flex app that I need to print an image.  I have Firefox Setup
running the app.

in user.js for FF i have:
user_pref(”print.always_print_silent”,true);
user_pref(”print.show_print_progress”,false);

This works perfectly when using firefox's print functionality on any
standard site.  It prints directly to the default printer without any
user interaction.

Within my App I have:

public static function 
printCoupon(obj:UIComponent):void {
// Create an instance of the FlexPrintJob class.
var printJob:FlexPrintJob = new FlexPrintJob();

// Start the print job.
if (printJob.start() != true) return;

// Add the object to print. Do not scale it.
printJob.addObject(obj, FlexPrintJobScaleType.NONE);

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

The UIComponent passed in is an Image.

It prints the image, but it prompts me with the print diologe box.

Any thoughts?  Thanks.