Hi Brian, For Printing Support: -------------------- Are you trying out the Printing support code that is part of the Application Template from ULC Community?
DownloadManager class is environment-aware (development runner vs. servlet container) and will show the resource using the appropriate approach for the given environment. Therefore, in addition to ulc-base-development.jar, you will need the following in the classpath: 1. ulc-servlet-server.jar (available in <ULCInstallDir>\container\servlet\lib 2. servlet.jar (if you took the DownloadManager class from Application Template from ULC Community, then servlet.jar is available in lib/container/server dir) For Print Screen: ----------------- You will need an extension for ULCFrame. Please see the snippet at the end of this mail In the snippet you can add code for letting the user specify the file name and location for the image to be saved. In fact you can make PrintableFrame implement java.awt.print.Printable Interface to directly print it to a printer as described in http://forum.java.sun.com/thread.jspa?forumID=57&threadID=263262 I hope this helps. Thanks and regards, Janak >-------- Original-Nachricht -------- >Betreff: ULC Evaluation >Datum: Thu, 15 Jun 2006 08:30:32 -0400 >Von: McCarty, Brian <[EMAIL PROTECTED]> >An: <[EMAIL PROTECTED]> > > > >Hello, > >So far, our evaluation of the ULC and ULC-VE is going well. We have been >able to build a simple application that accesses data on our IBM AS400 >using the IBM Toolbox for Java. > >One of our major needs will be to offer print capability. I found the >printing utility in your code community area. However I have been >unsuccessful in using the print utility. I am having a problem with >DownloadManager.java. I receive the error _The type >javax.servlet.http.HttpServletRequest cannot be resolved. It is >indirectly referenced from required .class files_. > >It has also been requested that we investigate the possibility of adding >a Print Screen button to many of our data dialog forms. Do you have >any experience with generating an image of the active form and rendering >that image in pdf format? > >We are closer to getting approval to purchase licenses for ULC and the >Visual Editor. I believe that once we demonstrate print capability to >management the request will be granted. > >Thank you for your assistance. > >Brian McCarty import java.awt.AWTException; import java.awt.Rectangle; import java.awt.Robot; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import javax.swing.JFrame; import com.ulcjava.base.application.AbstractApplication; import com.ulcjava.base.application.ULCButton; import com.ulcjava.base.application.ULCFrame; import com.ulcjava.base.application.event.ActionEvent; import com.ulcjava.base.application.event.IActionListener; import com.ulcjava.base.client.UIFrame; import com.ulcjava.base.development.DevelopmentRunner; import com.ulcjava.base.shared.internal.Anything; public class PrintableFrameSnippet extends AbstractApplication { public void start() { final ULCPrintableFrame frame = new ULCPrintableFrame( "PrintableFrameSnippet"); frame.setDefaultCloseOperation(ULCFrame.TERMINATE_ON_CLOSE); ULCButton button = new ULCButton("Print Fame"); button.addActionListener(new IActionListener() { public void actionPerformed(ActionEvent event) { frame.printFrame(); } }); frame.add(button); frame.setSize(300, 200); frame.setVisible(true); } public static void main(String[] args) { DevelopmentRunner.setApplicationClass(PrintableFrameSnippet.clas s); DevelopmentRunner.main(args); } public static class ULCPrintableFrame extends ULCFrame { public ULCPrintableFrame(String title) { super(title); } protected String typeString() { return UIPrintableFrame.class.getName(); } public void printFrame() { sendUI("printFrame"); } } public static class UIPrintableFrame extends UIFrame { protected Object createBasicObject(Anything args) { String title = args.get("title", ""); return new PrintableFrame(title); } public void handleRequest(String request, Anything args) { if (request.equals("printFrame")) { getBasicPrintableFrame().printFrame(); } else { super.handleRequest(request, args); } } private PrintableFrame getBasicPrintableFrame() { return (PrintableFrame) getBasicFrame(); } public static class PrintableFrame extends JFrame { public PrintableFrame(String title) { super(title); } public void printFrame() { Robot r; try { r = new Robot(); Rectangle rect = getBounds(); BufferedImage image = r.createScreenCapture(rect); try { // Save as PNG File file = new File("c:\\PrintFrame.png"); ImageIO.write(image, "png", file); } catch (IOException e1) { } } catch (AWTException e1) { e1.printStackTrace(); } } } } } _______________________________________________ ULC-developer mailing list [email protected] http://lists.canoo.com/mailman/listinfo/ulc-developer
