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

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.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);

  • Help: Resizing images for Printing with CS3

    Hello All,
      Thus far, I've done most of my printing with my Epson 3800 on paper below 8.5 x 11 which was no problem.  Now I'd like to do some larger stuff like 13 x 19 and 17 x 25.  Image size is 3504 x 2336 psd. @ 360ppi. (workflow is RAW to Adobe RGB 16-bit 8.2MP)  I'd like to maintain the 360ppi resolution, but resize to say 12 x 18 or larger and then apply final sharpening. 
      My confusion is with the up-sizing steps themselves.  I've heard it's best to increase image x% over target image size via Bicubic(?) and then to reduce x% to target size using Bicubic sharpener(?) or something to that effect.  Can someone please walk me through the process so I can get the hang of it?  Thank you!
    Mike

    MJCarnegie wrote:I've heard it's best to increase image x% over target image size via Bicubic(?) and then to reduce x% to target size using Bicubic sharpener(?) or something to that effect.
    Sounds like one of those tales from an older technology.
    Just use the resampling method as recommended in the Image size dialog

  • Pages_Document resizes when printing with Comments showing

    I just upgraded to Leopard and also have the latest version of Pages installed. I just went to print out of Pages to my printer (Ricoh Aficio MP C3500) and the weirdest thing is happening. On Tiger I was printing fine with the Comments showing. Now, I'll click on the Print button, the dialog comes up fine. When I click on anything in the dialog box or change a drop down item, the preview resizes the document. The clincher is that the document prints out resized as the Preview shows it. If I keep clicking the Preview keeps getting smaller and smaller... and it will print as small as the Preview shows. I've printed an 8.5 x 11 document the size of a postage stamp.
    Anyone having this same problem printing with Comments turned on? Any fix?

    I also have this problem. As an attorney I need to be able to print out the document with the Markup (Change Bubbles) showing.
    When I have the change bubbles showing, no matter what options I have chosen in the print dialog box, the document prints out at about 1/16th the size of the original on the paper. If I print to PDF, the same thing happens in the PDF file.
    I like the track changes feature, but this is almost enough to make me go back to Word.
    One work around is to export the document to Word and print with Markup showing from within Word.

  • 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.

  • Apex 4.2.2 PDF Printing with Apex 2.0 Listener

    We recently installed Apex 4.2 with the Apex 2.0 Listener and can successfully print interactive reports and classic reports to PDF.  I viewed Mark Sewtz PDF Printing with Apex 4.2.2 and saw how he is using third party tools to format reports.  We have also looked into the Jasper Report Integration Toolkit, but have only got it working on the Tomcat environment, not WebLogic.
    I'm trying to download a classic report in PDF format with our logo displayed at the header.  In the print attributes section, there is a section for header.  I've tried adding the following in the header section:
    <img src = "http://hr.unm.edu/common/images/unm_dept_logo.gif">
    No Logo Prints
    #APP_IMAGES#unm_dept_logo.gif
    Prints in header:
    wwv_flow_file_mgr.get_file?
    p_security_group_id=3930016164431413%26p_flow_id=106%26p_fname=unm_dept_logo.gif
    #WORKSPACE_IMAGES#unm_dept_logo.gif
    Prints in header: /i/unm_dept_logo.gif
    I've also added the logo in the report region, prior to the columns printing, but no logo downloads to PDF.
    Does the Apex Listener only render text?  Is there any way to get the logo to print in the header without using a third party tool?  Any suggestions are greatly appreciated.  Thanks!

    Hi,
    There are different options to include images in your PDF exports. What's important to understand though is that with the PDF export functionality we separate the formatting from the actual data. So the formatting is defined in your RTF or XSL-FO templates and the data is stored in the XML that APEX generates based on your report data. We have several formatting options exposed on the print attributes pages, i.e. you can define page formatting, dimensions, fonts, colors, etc - all of these are applied to what we call generic XSL-FO templates. Those templates are generic in that they can be used with different reports, having variable numbers of columns and variable column names. Those formatting attributes can not be used however with named column templates, such as those that you generate with BI Publisher or those third-party tools I talked about in my Blog.
    So if you want to use these formatting options, you need a generic report layout - which you get out of the box using the built-in layout. But you also have the option to create your own generic report layout (see Shared Components -> Report Layouts). When creating a custom generic report layout, you'll get a copy of the built-in layout as a starting point. Once created, you can manually modify this layout to meet your needs. As you edit this template, you'll find a number of #....# substitution strings. This is what APEX uses at runtime to fill in your formatting values as well as to assemble your generic layout based on your result set.
    Now one way to include your own image would be to add an image reference to this generic report layout. You can't use the page header or footer attributes on the print attributes page for that because the FOP rendering engine does not understand or translate HTML. It renders XSL-FO. So to add your own image reference, you need to use XSL-FO mark-up. If you want to add an image to your page header, look for the #PAGE_HEADER# substitution string in the "Page Template" attribute of your generic report layout. You should be able to find the following:
    <fo:inline xsl:use-attribute-sets="page-header">
        #PAGE_HEADER#
    </fo:inline>
    Now assuming you have a file stored in your local images directory on localhost, you could add the following external graphic reference:
    <fo:inline xsl:use-attribute-sets="page-header">
        <fo:external-graphic src="http://localhost:8080/i/cloud.gif" content-height="scale-to-fit" height="30px"  content-width="150px" scaling="non-uniform"/>
        #PAGE_HEADER#
    </fo:inline>
    Once you're done with your chanages, save the report layout and edit your report. Go to the print attributes and select your generic report layout and then run your report page and export the PDF. Provided the APEX Listener is able to find this external image reference, it will now be included above your report in your PDF document.
    Regards,
    Marc

  • Printing with SDK 1.4

    Hi,
    I have a couple of questions regarding the new print api that comes with JSDK 1.4, JPS.
    1. We have a barcode printer, which we'd like to print using Java JPS. Our attempts are shown here:
    DocFlavor doc_flavor = DocFlavor.SERVICE_FORMATTED.PRINTABLE;
    PrintService print_services[] = PrintServiceLookup.lookupPrintServices(doc_flavor, null);
    DocPrintJob print_job = print_services[0].createPrintJob(); // 0 is the barcode printer
    ShapesPrint data = new ShapesPrint();
    Doc doc = new SimpleDoc(data, doc_flavor, null);
    try {
       print_job.print(doc, null);
    catch(Exception e) {
       e.printStackTrace();
    }We could print, with this code, using our laser printer. However, while trying to print via the barcode printer, we received:
    java.lang.ArrayIndexOutOfBoundsException
    at sun.print.Win32PrintService.getDefaultAttributeValue Win32PrintService.java:786)
    at sun.print.Win32PrintJob.printableJob(Win32PrintJob.java:413)
    at sun.print.Win32PrintJob.print(Win32PrintJob.java:342)
    at print.printtest.<init>(printtest.java:39)
    at print.printtest.main(printtest.java:50)We decompiled sun.print.Win32PrintService to see what went wrong. What we noticed that it may be something with defPaper value. Then, we checked in our debugger, the value of printservices.defPaper, which showed 261. Is it something we do wrong, or is it related with the printer driver?
    2. How does JPS gather information about print services (PrintServices)?
    Thanks in advance.
    Muzaffer Ozakca

    Hi again,
    We found a workaround by adding:
    HashPrintRequestAttributeSet attr = new HashPrintRequestAttributeSet();
    attr.add(MediaSizeName.ISO_A9);
    // and
    PrintService selected_service = ServiceUI.printDialog(
         null,
         100,
         100,
         print_services,
         default_service,
         doc_flavor,
         (PrintRequestAttributeSet) attr);So, instead of requesting a default paper, we set it to a known value avoiding an exception.

  • MG5350 and Greyscale printing with black.

    Hello, I have a Pixma MG5350 and am wondering if there is a way I can print in greyscale using only the black ink?
    Like alot of pritners I have had before when I select the "greyscale" option and print it converys all the colors on the page into shades of gret but it still uses all the color cartridges to print those shades.
    I know printing with only black will be of a lower quality but i'm not converned with that, and in alot of the pages I actually find using the colors to print the greys annoying as i'm reading this B&W document but i'm seeing these cyan and magent specs all over the place where it's trying to print a light color instead of just black specs.
    This is quite annoying as I only print B&W text documents with the occassional B&W graphic in them yet i'm having to constanlty waste money replacing the color cartirdges.
    I know it will use some of the ink when the printer comes on and cleans the heads etc but i'm almost replacing the color cartirdges as often as the black one which is just rediculous.
    Some printers I have used have a "black only" option you can check that will not use the color however I see no option for that in the settings. Is there some way that I can print in greyscale without having to waste color ink?

    Welcome to The Canon Forums, and thank you for your question! We appreciate your participation, however we need to let you know that your product seems to be a model that is not supported by our team here at Canon USA. The Canon Forum is hosted and moderated within the United States by Canon USA. We are only able to provide support for Canon products manufactured for the US market. If you live outside the United States, please click here and select your country or region for your support needs. Feel free to discuss Canon products sold outside of the United States, but please be aware that you will not receive support directly from Canon USA.

  • My OfficeJet 6110 will print (with errors) with Yosemite but will not scan

    I just finished reading this entire thread:
    http://h30434.www3.hp.com/t5/Mac-Printing-and-Scanning/Mac-OS-10-10-Yosemite-and-HP-Printer-Support/...
    I have rebooted the computer; repaired disk permissions; deleted and added the 6110 back; dowloaded the HP printer drivers and manually installed them; deleted printer and reinstalled printer drivers; repaired permissions again.
    Almost everytime I print, the printer does not actuate and I get an "inkjet error." Then I just print again and it works fine. However, it will not scan and although it shows up in SystemPreferencec>Printers and Scanners, it does not show up in Image Capture or Preview>Import from Scanner.
    I also have an Epson GT-S50 scanner. It scans perfectly without any problem.
    I just changed machines to a new iMac from my earlier Mac Pro. The 6110 worked fine with the Mac Pro running Mavericks.
    Here's the kicker: Although the scanner does not show up under ImageCapture or Preview or when R-clicking the installed printer window, it seems to work fine with the scanning software named VueScan. Under VueScan it shows up as an OfficeJet 6105 but seems to work ok.
    I want to use the native scanning software, however.
    I don't know what to do next.
    iMac Retina 5K running 10.10.1, 32GB RAM
    Thanks Stan

    Hello @snsokstan,
    Thank you for visiting the HP Support Forums! I understand you are running into some problems trying to install your HP Officejet 6110 to your Mac running the new Yosemite 10.10 Operating system.
    I see you have tried all the recommendations to install the printer with no success. After taking a look at the supported printers list on the Apple Site, your printer is not supported. This is why you are running into problems with the printing and scanning.
    I suggest contact our technical support at 800-474-6836 to see what upgrade options they may have available to you. If you live outside the US/Canada Region, please click the link below to get the support number for your region.
    http://www8.hp.com/us/en/contact-hp/ww-phone-assist.html
    I hope this helps!
    HevnLgh
    I work on behalf of HP
    Please click “Accept as Solution” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos Thumbs Up" to the left of the reply button to say “Thanks” for helping!

  • A3 color printer with scanner price

    I want to buy A3 color printer with scanner.so plz send details a list of printer with price.

    Hi,
    Please ask dealers at your area/region. The price in my country may be totally unacceptable in your country.
    Regards.
    BH
    **Click the KUDOS thumb up on the left to say 'Thanks'**
    Make it easier for other people to find solutions by marking a Reply 'Accept as Solution' if it solves your problem.

  • Printing with epson RX620

    The RX620 all in one is new to me. Am wanting to print 4 different pictures on an 8 1/2 x 11 sheet. This means a print 4 1/4 by 5 1/2. The printer only recognizes standard 4 x 6 or 5 x 7 and of course printing only 2 pics. Already talked with epson, they sent me to apple which sent me to iBook G3 and was told that maybe appleworks might help. Limited knowledge so go slow for me. Thankyou, Earl.

    N-Up printing must have been added after version 2. It's in iPhoto 5, which shipped with Tiger, but not in version 1.1.x (came with jaguar).
    So...On to using AppleWorks.
    Getting photos into AppleWorks can be a simple matter of Drag and Drop, but you may find some problems with resolution and resizing.
    Sharon Joiner's User Tip on improving graphics resolution in AppleWorks was the first AppleWorks User Tip Library entry in the discussions, and is still relevant.
    I tried a Drag & Drop into a Draw document earlier today with a JPG photo from a 5 Mpix Pentax camera, then used Scale by Percent (in the Arrange menu) to resize it to an appropriate size for 4-Up printing. It appeared to maintain good resolution at a high magnification, but I didn't print, so I don't know what the final product would look like. If it works with your printer, it's a simpler process thn the one in Sharon's tip; if not, hers is a process that will work.
    An alternate is to use a third party application (such as Graphic Converter) to convert the photos to PICT format before dragging them into Appleworks. PICT graphics are resizeable in AW.
    Others may have additional suggestions. These should get you started. Post back with what works for you; the information amy be useful to the next person with a similar issue.
    Regards,
    Barry

  • Printing with Border off centre

    When i try to print a 4x6 print with a border the print module is putting the following minimum margins: L 0.35 R 0.32 T 0.28 B 0.53 so the rpint is off centre. I can't make these any smaller and making them all 0.53 looks to big. Any ideas it doesn't put the image centrally?
    I tried resizing the image in PSE5 editor to exacly 4x6 but made no difference.

    I tried borderless and it does set the margins to zero. However when I put in 0.2 cm and print it doesn't come out quite right. Looks fine on the LR preview. Cell dimension in LR are correct at 14.84x9.76 but actual print is 14.6 x 9.8 and sightly off centre (L 0.15 R 0.25).
    This is much better than I was getting as had a look in the Canon print properties and under Page Layout in the Borderless section there is a slider "Amount of Extension". I set this to the left so the minimum and got a big improvement.
    That's close enough to be usable at least tks Jao

  • I cannot select the Paper Size when I try to print with HP Photosmart B110a with Windows 8.1 64bit

    I cannot select the Paper Size when I try to print with HP Photosmart B110a
    The same printer was working OK with my old PC with OS Windows 7
    However I got a new PC with OS Windows 8.1 64bit
    I installed the new driver for HP Photosmart B110a that I dowloaded from HP site. Driver forWindows 8.1 64bit.
    In addition to not being able to chose the paper size, also when I go to Printer Properties in Options, all the characters are non-ascii.
    Do you know what may be the problem?
    Thank you

    Hello Nanu64,
    Welcome to the HP Forums.
    I see that you are having some issues when attempting to print from your computer.
    I also see that you stated that not all the options are available in the printing preferences options.  This could be because the installation was not complete or it failed.
    I suggest that we do a complete uninstall/ reinstall as well as some additional steps.
    First off, please make sure that you have the printer power cable connected directly to a wall outlet and not a power bar/strip. Here is a document that uses a LaserJet printer as an example but it is meant for HP products in general. Please click on the following link that explains the Issues when Connected to an Uninterruptible Power Supply/Power Strip/Surge Protector.
    If you have the printer connected to the computer with a usb cable, please remove the cable from both ends and leave it disconnected until further notice.
    The next link that I have for you will give you detailed instructions for Uninstalling the Printer Software.  Once the uninstall is complete, reboot the computer so that the changes take affect.
    When the computer is back up and running, please disable any firewalls or anti virus protection you may have running. We don't want anything getting in the way of the reinstall.
    The following download is the HP Photosmart Full Feature Software and Drivers.  Save this download to the desktop of the computer so that it creates its own icon.  This will make it easy for us to find when the download is complete.
    Double click the new icon and follow the installation instructions.  The installation will give you connection options (Wireless , usb or Ethernet), if connecting usb, please wait for the prompt to connect the cable.  Connecting the usb cable before hand can cause an issue with the installation.
    If the troubleshooting does not help resolve your issue, I would then suggest calling HP's Technical Support to see about further options for you. If you are calling within North America, the number is 1-800-474-6836 and for all other regions, click here: click here.
    Thanks for your time.
    Cheers,  
    Click the “Kudos Thumbs Up" at the bottom of this post to say “Thanks” for helping!
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    W a t e r b o y 71
    I work on behalf of HP

  • How do I print directly onto an inkjet printable CD using a Pixma MX922?

    How do I print directly onto an inkjet printable CD using a Pixma MX922?  Does Canon have a template for disc labels?

    Hi KSeghorn,
    There is a program that comes with the printer called the My Image Garden program that can assist you with printing onto inkjet printable CDs. To do this, please follow these steps:
    1. Start My Image Garden.
    2. Select the image you want to use for a disc label (CD/DVD/BD).
    3. Click the NEW ART button and select the Disc Label (CD/DVD/BD) option. The Select Theme dialog appears.
    4. Set the Theme, Paper Size and Orientation, then click the OK button. The disc label (CD/DVD/BD) appears in the Create or Open Items edit screen.
    Note: The layout may not be as expected depending on the photo information or analysis results of the selected images.
    5. Edit/adjust the items on the label using the buttons at the bottom of the window according to your preference, then press the PRINT button. The Print Settings dialog appears.
    Note: In the Advanced Settings dialog displayed by clicking Advanced... at the bottom of the screen, you can set the print area. If Advanced... is not displayed, click the right scroll arrow button to display it.
    6. Set the number of copies to print, the printer and paper to use, etc., then click the PRINT button to print.
    For information on loading the printable CDs into the printer, please click here.
    Hope this helps!
    This didn't answer your question or issue? Please call or email us at one of the methods on the Contact Us page for further assistance.
    Did this answer your question? Please click the Accept as Solution button so that others may find the answer as well.

Maybe you are looking for

  • How to use iCloud on my iPhone

    Hi, Im trying to log in on my iCloud account but it doesnt work even when my Apple ID and my password is correct. I just recieve " Cannot Sign In, The operation couldnt be completed". Does anyone know what I should do? Thanks in advance!

  • My apple tv gen 1 no longer appears in Devices on itunes.  Any ideas?

    My apple tv gen 1 will longer appears in Devices in itunes and therefore can't synch.  Any ideas?  My ATV1 software is up to date, it connects to the Internet, my laptop iTunes is 11.1.3.8, connects to the internet.  Both connect my WiFi.  Since it s

  • Import of Java libs seems to be failing

    Hi, I'm on PI 7.1. I'm creating a SOAP envelope with signatures. To perform this I have to add a lot of java archives with the extra functionality. I have so fair been able to import all the classes. But then I get an error on the following. Applicat

  • Strange sounds-PowerPC G4 and server issues?

    I have recently been getting both a tapping and a buzzing sound through my speakers. Both kinds of sounds come together, intermittently and repeatedly, and each time, the volume rises, peaks, and fades away again (or stays faint until it starts to ri

  • PSE 10 Organizer; Fichiers TIF et JPG non reconnus.

    Bonjour     J'ai scanné des clichés 35 mm sur scanner à plat(EPSON V500) et scanneur films et diapos (Silvercrest).     Sorties en JPG et TIF dans les deux cas.     Quelques uns de ses fichiers avaient été correctement importée dans PSE 10.     Après