Printing with jdk1.1.8

Hi...I am developing an application for mac(classic) where i need to provide the print functionility.Now Mac supports only upto jdk1.1.8.Has someove ever developed printing with this...code will definetly help.........

You should start with java.awt.Toolkit.getPrintJob(java.awt.Frame, java.lang.String, java.util.Properties)
to obtain a PrintJob.
From the PrintJob object you can get a Graphic by using the Method getGraphics().
On you first try, produce the Output for the page in some visible AWT component, so you can see it.
E.g. put your stuff in a panel and add this panel to a Window.
Then print the Top-Level Component ( thats the panel) that contains your Output by
calling printAll(Graphics g) on it, with the Graphics object from above.
Notes:
You have to take care for Printer borders - your output will be clipped there.
Code was tested on JDK 1.3, but is designed for JDK 1.1
Example: Test.java
import java.awt.*;
import java.awt.event.*;
public class Test {
static Frame f;
static Panel panelToPrint;
static class Handler implements ActionListener {
public void actionPerformed(ActionEvent e) {
//get a PrintJob (opens the native window)
PrintJob pj = Toolkit.getDefaultToolkit().getPrintJob(f, "Print-Test", null);
//get a graphics object to draw on
Graphics g = pj.getGraphics();
panelToPrint.printAll( g );
//end the print job, now it is sent to the printer
pj.end();
f.dispose();
public static void main(String args[]) {
f = new Frame("Test");
Button b = new Button("Print...");
b.addActionListener(new Handler());
f.add(b,"South");
panelToPrint = new Panel();
panelToPrint.add(new Label("Hello World"));
panelToPrint.add(new Label("Hello World"));
panelToPrint.add(new Label("Hello World"));
panelToPrint.add(new Label("Hello World"));
panelToPrint.add(new Label("Hello World"));
panelToPrint.add(new Label("Hello World"));
panelToPrint.add(new Label("Hello World"));
panelToPrint.add(new Label("Hello World"));
panelToPrint.add(new Label("Hello World"));
panelToPrint.add(new Label("Hello World"));
f.add(panelToPrint, "Center");
f.setSize(new Dimension(300,400));
f.setVisible(true);

Similar Messages

  • Printing with jdk1.4

    Hi,
    If anybody has tried printing in Java with jdk1.4 please let me know. I want to print contents of a file.
    U can reach me at [email protected]
    Thanx

    Hey Java Gurus,
    help me with this printing issue with jdk1.4 and with this sample code.
    Almost of this is borrowed from from tutorial.
    try{
    java.io.FileInputStream textstream = null;
    textstream = new FileInputStream("txt.TXT"); //Text File
    PrintRequestAttributeSet pras = new HashPrintRequestAttributeSet();
    pras.add(new Copies(1));
    /*The statement below is confusing, I am not sure what DOcFlavor has to be used for printing String Data*/
    DocFlavor flavor = DocFlavor.INPUT_STREAM.PNG;
    PrintService printService[] =
    PrintServiceLookup.lookupPrintServices(flavor, pras);
    PrintService defaultService =
    PrintServiceLookup.lookupDefaultPrintService();
    PrintService service = ServiceUI.printDialog(null, 200, 200,printService, defaultService, flavor, pras);
    if (service != null)
    DocPrintJob job = service.createPrintJob();
    DocAttributeSet das = new HashDocAttributeSet();
    Doc doc = new SimpleDoc(textstream, flavor, das);
    job.print(doc, pras);
    }catch(Exception e)
    e.printStackTrace();
    Why is this not workings? and More over What would be the DocFlavor if we have print the contents of JTextArea/JEditorPane. I set these components with simple String.
    -Java Null

  • Printing with jdk1.4 ... resizing printable region

    I am printing a Graphics2D object. I am able to print my Graphics2D object but the problem is that the printable area is a lot smaller then the page size. There is a huge border around the page to which i cannot print. I need to make this area smaller. I am using the methods
    pf.getImageableX() and pf.getImageabley() where pf is the PageFormat object. I have reset these values
    and the printer wont print outside the original values. any help on this would be gratefully appreciated.

    try to call
    pf.getImageableWidth() and
    pf.getImageableHeight()
    and u can set the page setup by calling the dialog for that:
    new PrinterJob.pageDialog(pf);
    Kasem

  • Printing with JDK 1.1.8

    Hi All -
    I have the need to be able to perform a 'print-screen' operation in my application. I have the functionality implemented with JDK1.3 using the Printable interface, etc, and all is well.
    I am now being asked to down-grade the application to utilize JDK1.1.8 (b/c of a limitation in HP's 10.2 operating system using only 1.1.8). One of the problems I'm seeing is that of printing.
    Does anyone out there have any advice / ideas / sample code to perform printing with 1.1.8? Is it even possible?
    Thanks!

    Make a copy of your main frame and use it to get a print job. If the Graphics retultant is bigger than the page resolution, loop and move the root coords of Graphics with translate.

  • How do I use a regular printer with my iPhone?

    How do I use a regular printer with my iPhone?

    you can't unless it's an AirPrint enabled printer or you purchase a 3rd party app like printopia.

  • How can I print with the black and white cartridge only?

    I am trying to print using the black and white cartridge only because magenta is out of ink but I'm getting the following error message in HP Photosmart C7200 series print dialog:
    The printer is out of ink.
    The following ink cartridges are empty: Magenta. Replace these ink cartridges to resume printing.
    How can I print with the black and white cartridge only?
    Mac OSX 10.7.3
    HP Photosmart C7280 (7200 series)
    This question was solved.
    View Solution.

    I am absolutely disgusted by this; clearly a scam from HP to make more money by selling extra ink cartridges!!  I will make sure to never buy any products from the shoddy rip off merchants at HP ever again!!
    You should be ashamed!!

  • Unable to print with my Canon PIXMA IP 4700 and JetDirect network appliance

    After many tries I decided to post my question.
    I have a Canon PIXMA IP 4700 connected to the network with a Jetdirect 175X box. So I tried to add a new printer with a "HP Jetdirect Socket" port. I have previously installed the driver from the official website. The test page is staying on the spooler.
    I also tried with LPD port (supported by the Jetdirect box) and IPP but nothing is working.
    When the printer is directly connected with USB, it's working fine. Printing from my others Windows computers is working fine too since many months.
    Thank your for your help.

    Hello and welcome to Apple Discussions.
    Your problem is being caused by the Canon driver. It cannot be used when the printer is connected to the USB port of a 3rd party print server, or if shared by Windows.
    The solution is to use a driver like Gutenprint or PrintFab. Gutenprint is preferred because it is free (it ships with OS X) however the iP4700 is not listed as a supported model. The iP4600 is listed so you could try selecting this model in the Print Using menu (shown as Canon PIXMA iP4600 - Gutenprint v5.2.3). If the iP4600 Gutenprint driver does not work that well then you could look at using [PrintFab|http://www.printfab.net] which does support the iP4700. It costs €49 but there is a 30 day trial so at least you can try it before committing to buying.
    Another option would be to use a Airport device, like the Express, instead of the Jetdirect print server. With the printer connected to its USB port you can then use the Canon iP4700 driver on the Mac.

  • How to print with HP Deskjet 2510 with Imac G5 on Tiger ?

    Hi Folks
    I desperately need some helping hand....
    Today my old trusty printer died (HP 1510 print/scan/ copy) and I ran to buy another one because I need to finish some tax paperwork.
    In a mad hurry, I didn't pay any attention to tech specs and I went home with brand new HP DeskJet 2510 All In One device. But !!! : ((
    In my home office I still use Imac G5 with 10.4.11 which is still pretty good comp for office work but I found out that the HP 2510 don't officially support my Imac with Tiger. Only from 10.6 and later.... I know that Imac G5 can't run nothing above 10.5.
    So, is there any way to "force" HP 2510 to somehow recognize my Imac G5? In "about my mac" on USB port, the HP 2510 is visible ....
    Many thanks in advance.
    Cheers,
    Sven

    So, is there any way to "force" HP 2510 to somehow recognize my Imac G5?
    You may be able to get it to print with something like this:
    http://gimp-print.sourceforge.net/MacOSX.php
    although i do not see taht modle on the "Supported Printers" page. You might look again.
    BUT that workabout does not support scanning, only printing.
    I think you need to return the printer and look to either Canon or Brother. Brother especially has been better about suporting older Mac OS versions but you'll still need to get a model number and search the maker's site BEFORE buying to see if they show older drivers for download.

  • Remote printing with iPad

    I have installed the HP Print app on the iPad and have no issues printing when I am on the local net work. When I try and print when I am not on the network I receive an error that states: "oops we cannot complete the print job please try again" and there is a retry or cancel selection. My printer is set up with an email address. I can print from my Samsung note 2 using the HP Print app with no issues either on the network or off. Any ideas?

    Have you tried the ePrint mobile app?
    http://h30434.www3.hp.com/t5/ePrint-Print-Apps-Mobile-Printing-and-ePrintCenter/How-to-Print-with-an...
    Although I am an HP employee, I am speaking for myself and not for HP.
    Twitter: @Ciara_B_HP

  • HT4356 My iPad does not find the printer. I have tried the HP app and it works, but in any other app the printer is not seen. How do I get this printer visible to the iPad. All my other network computers find and print with out a problem.

    My iPad does not find the printer. I have tried the HP app and it works, but in any other app the printer is not seen. How do I get this printer visible to the iPad. All my other network computers find and print with out a problem.

    hi
    could you tell us what the other app is please

  • HP D110 AIO printer. Prints jam when printing with wireless, but not when hooked to USB cable! HELP!

    I have a HP D110. It jams the paper when I print with wireless, but not when I use USB cable. Any ideas?

    From what you describe you are having issues printing from MS Office. Have you had trouble printing from other resources on your computer (e.g. from the internet or another program)? The first thing I am going to suggest is that we start by uninstalling and reinstalling the printer from the resources available online. 
    First if you use a USB cord, make sure to remove it (this is important). Do not plug it back in until the software directs you to. Then go through the Devices and Printers, Programs and Features and Device Manager folders and insure that all copies, files, and programs related to the printer are removed. Then as directed, restart the computer. 
    In the START menu type "%temp%" and press ENTER. Here I want you to press Ctrl+A and hit DELETE. Some of the files will not allow you to delete them, skip those files and delete the majority that allows it. 
    http://h20000.www2.hp.com/bizsupport/TechSupport/DriverDownload.jsp?prodNameId=3562006&lang=en&cc=us...
    Install that and let me know the result! 
    Have a great day!

  • How to connect my cannon mx470 series printer with bluetooth to my mini mac?

    how to connect my cannon mx470 series printer with Bluetooth to my mini mac

    Does the printer actually support BlueTooth? If the printer is wireless, then most likely it uses Wi-Fi. Did you read the user guide that came with it? Or contact Canon tech support at their website.

  • I have an airport extreme.  i am trying to connect a laptop with windows 7 to a wireless printer, with no luck.  any ideas?

    I have an airport extreme.  i am trying to connect a laptop with windows 7 to a wireless printer, with no luck.  any ideas?

    The problem is not the router.. the issue is the vpn has put your computer in a different IP range with a different gateway. When you turn off the vpn the computer returns to local lan and can print.
    Some vpn software allows you to set gateway to use local net instead of remote gateway or access to other webistes or local lan.
    Read up the issue.
    http://stevejenkins.com/blog/2010/01/using-the-local-default-gateway-with-a-wind ows-vpn-connection/
    Cisco vpn client..
    https://supportforums.cisco.com/thread/239113
    I did not search much.. just grabbed the first article I could find that explains the issue.
    The whole point of the vpn is whilst it is connected your computer is NOT part of the Local Lan .. it is part of the Remote LAN via the vpn tunnel.
    It is also a security risk using split tunnelling so often it will not be allowed.
    Plug the printer directly into the computer via usb or whatever.. Local connection will work.. not local lan.

  • Report printing with BI pubisher - 500 Internal server error

    Hi,
    I was having problems using BI publisher to print with. I thought we didn't have it at first, however since found we do have BI Publisher Enterprise edition.
    When I put the settings into APEX, reports don't display as expected. I get
    report error:
    ORA-20001: The printing engine could not be reached because either the URL specified is incorrect or a proxy URL needs to be specified.Now if I navigate to the URL in my web browser, http://[server]:[port]/xmlpserver/convert, I get a 500 - Internal Server Error page. The requets is definitely hitting something because if I change "convert" to say "convert1" then I get 404 (as expected). So it seems as if convert is found but then a problem occurs.
    If I navigate to just http://[server]:[port]/xmlpserver/ then I see the BI publisher enterprise login screen.
    Any ideas what might be causing this or what I could do to resovle it?
    Our APEX instance is on a unix box and BI on a M$ box if that matters (long story)?
    Thanks

    Ignacio Cobos wrote:
    Hello
    >
    > I get this error when i try to access to Bex Analyzer
    >
    > ERROR: URL used, "http://sesue:50300", is not fully qualified.
    > A fully-qualified URL has a schema with the format "<protocol>://server.company.com:<port>". URLs with the format "<protocol>://server:<port>" or "<protocol>://<ip address>:<port>" are not fully qualified.
    > See SAP Notes 581329 (Not possible to implement) , 596698 (Not possible to implement) and 654326 (Not yet released)
    >
    > Can anybody say me any idea how to solve the problem?
    >
    > Thanks in advance
    Dear Cobos, For FQDN related issues : Set profile param "icm/host_name_full" with corresponding FQDN via RZ10 transaction. Also check login/create_sso2_ticket & /accept_sso2_ticket parameters in the profile you have created.  Instead of "http://sesue:50300" you may to have the URL like "http://sesue.domain.com:50300//SAP/BW/BEX/". Please refer this #scn article for more details : http://goo.gl/QPlrx Similar Issues : http://goo.gl/mRCh0 Hope it helps. Thanks.

  • Printing with PSE 8 for Mac

    Hi,
    hope some of you may give me some help.
    Have tried to print with PSE 8 for Mac, but in the printing options there is none where i can choose the type of paper (ie: glossy, premium glossy....).
    My printer is an Epson Stylus Photo 1400.
    It works fine with iPhoto, here i can choose paper type. And prints come out fine.
    Thanks for any advice,
    dangerly

    My printer is a Canon so not entirely sure if this helps but when I print from PSE 8 I do not get to choose the media type until I have clicked on the print button in the PSE dialog box. I am then presented with the dialog box for my printer where I can set the media type amongs other attributes.
    It is normal for the media type to be the job of the printer driver so perhaps it is the same for your printer.
    Jim Graham

Maybe you are looking for

  • Battery issues!! takes 6hrs to charge and runs out in less 2hrs

    I've had my laptop(unibody 2008 model) for 8 months now. I've noticed that battery life is so much shorter than the one I had before (early 2007 model) However, when i took it to apple service center they said there's nothing wrong with the numbers a

  • Macbook pro 13 screen fades to black?

    Does any other owner of a mid 2010 MBP 13" (puchased 2/11) have this weird problem: when the laptop is warmed up, the screen randomly dims then fades to black then in a few seconds lights up again. In addition, while the screen fades, the lights look

  • Open Purchase Orders Report with Confirmation Dates

    Hi Friends, I have searched a lot for the following need and I have found nothing. I was wondering if there ia any report that I can show the scheduled delivery dates from a Purchase order. I have seen in ME2L that by placing EINT in scope of list I

  • Problems with croatian letters (CP1250)

    Hello. I have got a small problem with some characters in my application. I am working on Java Card tehonlogy with Gemplus GemXpresso 211PK tool (reader is GemPC410) and when I made an application in JBuilder 8 (I am using(I had to) JDK 1.2. not new

  • Bass/treble controls greyed out on audigy 2 nx sound mixer pa

    Hello, I have just re-installed my audigy 2 nx and all related software and the controls for bass and treble are now greyed out and unusable, is this a software problem, i have videlogic fi've one speakers, what can i do to rectify it's thanks