JAva Printing (Paper Size)

Hello
I've got a big problem when printing some labels to a printer from java.
The label printer is a Toshiba Tec B-SV4
I need to print some labels to the printer. The labels have a 4 by 4 inch size.
The first thing I do is select the printer:
        PrinterJob printerJob = PrinterJob.getPrinterJob();
        try {
            printerJob.setPrintService(services[selectedService]);
        } catch (PrinterException ex) {
            ex.printStackTrace();
        }Then I pass some attributes:
PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet();
        MediaSizeName mediaSizeName = MediaSize.findMedia(4,4,MediaPrintableArea.INCH);
        System.out.println(mediaSizeName.toString());
        printRequestAttributeSet.add(mediaSizeName);
        printRequestAttributeSet.add(new MediaPrintableArea(0, 0, 288, 288,MediaPrintableArea.INCH));I also set the page format:
        PageFormat pf = new PageFormat();//pj.defaultPage();
         Paper p = new Paper();
         p.setSize(288,288); // about 4in x 4in
         p.setImageableArea(0,0,288,288);
         pf.setPaper(p);
        printerJob.setPrintable(this,pf);
        printerJob.setPrintable(this,printerJob.pageDialog(pf));The problem comes when printing.
If I show the native print dialog to the user (WindowS), the correct paper size for the label is not selected.
Instead, if I show the cross-platform printDialog, the correct paper size doesn't appear in the options, the options shoud be "User, 2 x 4, 4 x 4, 4 x 6", instead, you just can select between "2 x 4 and 4 x 6".
In the native version, all options appear
Any suggestions?
ThanlYou

I was wrong when I typed the code into the forum, the actual code shoul look like follows:
        PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet();
        MediaSizeName mediaSizeName = MediaSize.findMedia(4,4,MediaPrintableArea.INCH);
        printRequestAttributeSet.add(mediaSizeName);I solved the problem (not the best solution but functional) installing some generic drivers from:
http://www.nicelabel.com/downloads/drivers/tec.php
maybe this can help someone with the same problem.
The fact is I would like a better solution rather than using 3rd party drivers.
Thanks for your anwser Franck.

Similar Messages

  • I'd like to select print paper size with using AxAcroPDFLib method depend on user

    I'd like to select print paper size with using AxAcroPDFLib method depend on user
    request. Is it possible? in AxAcroPDFLib?
    Is there any method to select print paper size in the C# programming.
    Or if you know another method, please introduce how to use.
    Thank you for your cooperation always.

    I am pretty sure that you can only do this from JavaScript or from C/C++ APIs.

  • Safari won't let me change printer paper size

    I am having a bizarre problem printing USPS labels from Safari. For some reason it shows my paper size as 13x19 in the printer dialog and there is no way I can change this (I tried in the printer driver and through System preferences and the changes would not "take"). I have three HP printers and only one of them can print 13x19 paper. I tried changing the default paper size on all three printer drivers but they all will only show 13x19, so if I try to print a 8x11 document on any of the printers, it won't print scaled normally to 8x11 paper - instead I get large font prints that are cut off. I tried different "scale to fit" settings in the drivers and nothing worked.
    Finally, I switched to Firefox and it worked perfectly!
    Interestingly, when I try printing a normal webpage from Safari, it WILL print on 8x11, but not a USPS label!
    If anyone can help I would greatly appreciate it.
    Thanks
    Peter

    Safari won't let me customize a new computer on the Apple store website.
    Try emptying your Safari cache. From the Safari menu bar click Safari > Empty Cache
    If that doesn't help, go to the menu bar again, click Safari > Reset Safari
    Select the top 5 boxes, click Reset.
    Quit then relaunch Safari, try the Apple Store    http://store.apple.com/us
    If you have installed any extensions, back to the menu bar, click Safari > Prefereces then select the Extensions tab. If you have any installed, turn that OFF, quit then relaunch Safari to test the store.
    And make sure Java is enabled in Safari > Preferences - Security
    edit by: cs

  • Can I programmatically change the printer paper size from ActionScript?

    Hi,
    I'm a newbie Flash/ActionSript developer and I have been searching for answers for a while with no luck. I wonder if I can get some pointers from this forum.
    I'm trying to programmatically print a movie clip to 8.5" x 11" plain paper regardless of the current paper size setting in the printer. e.g if the user's printer is currently set to use paper size A4, can I change the setting to Letter (8.5" x 11") from ActionScript at runtime? I use PrintJob class for printing the movieclip.
    According to the ActionScript online API spec ( http://www.adobe.com/livedocs/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context =LiveDocs_Parts&file=00002066.html), I can only READ the paper size setting after the call to PrintJob.start. I can't believe that we are not allowed to change the setting. Maybe I missed something here. Can somebody help me out?
    Thanks in advance!

    check your duplicate thread.
    and, please don't cross-post.

  • Can I programmatically change printer paper size from ActionScript?

    Hi,
    I'm a newbie Flash/ActionSript developer and I have been searching for answers for a while with no luck. I wonder if I can get some pointers from this forum.
    I'm trying to programmatically print a movie clip to 8.5" x 11" plain paper regardless of the current paper size setting in the printer. e.g if the user's printer is currently set to use paper size A4, can I change the setting to Letter (8.5" x 11") from ActionScript at runtime? I use PrintJob class for printing the movieclip.
    According to the ActionScript online API spec ( http://www.adobe.com/livedocs/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context =LiveDocs_Parts&file=00002066.html), I can only READ the paper size setting after the call to PrintJob.start. I can't believe that we are not allowed to change the setting. Maybe I missed something here. Can somebody help me out?
    Thanks in advance!

    you can't change the paper size used in client side printer.

  • Print Paper Size Problem after Mavericks Upgrade

    I migrated my Apps, Data and System Settings from a Macbook running OSX Lion to a new Macbook Pro running Mavericks.
    The problem I now have is that the application 'Family Tree Maker 2' cannot get the paper size right. No matter which Paper size I select, it is shown as half size in the Application Print Preview screen and this error carries through to actual printing.
    so A4 210 by 297 mm displays as 5.8 x 4.1 inches (which is Half Size).
    The problem is significant because the application formats it's output to fit into half of the available space.
    I have unsuccessfully tried;
    - removing and reinstalling the Application.
    - Adding my Brother Laser printer with the latest Mavericks compatible driver.
    - Resetting the printing system.
    - Repairing disk permissions
    - Adding a new User Account
    - Deleting plists associated with com.ancestry
    iWork Pages is working correctly.
    I have raised this with ancestry.com however it appears that I am the only person that has experienced this problem.
    Any suggestions would be appreciated.

    Problem is worse than that. Whilst the Paper is shown as half size, the family tree diagram boxes are produced twice as wide as they should be.
    If I select A4 Paper, a diagram that would fit on one page is now spread across two.
    If I select A3 Paper, the preview indicates the paper size as A4 8.3 x 5.8 inches however the diagram size and position on the paper are unchanged and I just get loads of white space around the outside of the diagram.
    It does sound like an Application problem but it is still working fine on my old OSX Lion machine. Something has happened in the migration.

  • Epson R2880 - Will not print - paper sizes

    I am having major problems with trying to print to a R2880. I have recently purchased it and have had problems with printing to it from the beginning. Sometimes it works but mostly it doesn't.
    The Epson driver is 6.2 which is the latest. I am running Leopard. Do not want to upgrade to SL cause what I read shows FCS2 does not run on it.
    Keeps on telling me that the "Paper source selected in the printer doesn't macy the paper loaded in the printer" which is of course bollocks.
    I have tried the solution offered by a previous post which was to got to the print preview and then Cmd - P and then choose the right paper. Worked fine on an A4 but when I did the same for a 10 x 15 cm no go.
    It suddenly started working the other day but when I chose a selection of 10 x 15's (varied portrait / landscape aspects) to print it did not orientate them correctly. The paper was installed in a portrait arrangement yet not one of the photos printed on the page correctly.
    What a waste of time this printer and Aperture are.
    Can anyone help on this most frustrating problem. I have had this printer for a few months and have only managed to print a handful of photos !
    Regards

    Hi Colin,
    The R2880 is a little finicky when it comes to paper source. A couple of questions:
    • What paper are you using? What size? Are you using the back tray or the main tray? I had a ton of problems with the back tray and that very error. I now always use the main tray, but it depends on the paper you use since certain types can only be loaded in the back.
    • Are you making sure the preset you choose is for +sheet feeder+ and not +roll paper+?
    The Preview solution you read about is probably mine and was brought on by SL. Fortunately 10.6.2 fixed that problem but I've still had the paper source error come up a couple of times - I need to open the print settings for the preset I want to use and save it again (it's as though it needs to be reminded that it should use the sheet feeder, even though that setting is saved right there in the preset).
    My first thought was that your problem might have to do with the non-conventional paper size, but I also make custom 16x12 prints on 13x19 paper and don't have problems at all.
    I'm guessing it's probably a combination of settings and paper type...

  • HTMLCSS report printing paper size

    hi all,
    i have problem with paper size in report as html css
    i set 8.5 - 14 for A4
    but when my report page more than 2 or 3 pages , my print preview in IE or Mozilla is not correct and this area is variable for header and body
    how to fix this it,
    my oracle report version 11gR2
    plz help

    esmid2 wrote:
    but when my report page more than 2 or 3 pages , my print preview in IE or Mozilla is not correct and this area is variable for header and bodyWhat do you mean by not correct? Give details.

  • C5280 printer paper size error

    It wont let me change the paper size in the features section. I want to custom size the paper and it wont let me hit ok after putting in the size I need. It says the custom paper size that you have defined will not become available until you have exited and re entered the printing preferences/properities Im not sure what this means.

    I can't get anything to save. I exit and return, and the custom paper size I set up won't show up. I hate this printer and will never buy another hp.

  • I have recently bought an HP Colourlase​rjet CP1215 printer paper size problem

    I have recently bought an HP Colourlaserjet CP1215 printer and would like to print on custom sized card of  280  x 140 mm to make a greeting card 14 cm x 14 cm, which I believe falls under the custom size options.of  (127 - 356) mm (3 - 8.5) x (5 - 14) inches) The design either prints at the bottom right ofthe page or not at all.  I have made sure my software and the print settings are the same, but it still doesn't work.  If I am only supposed to print on the sizes given in the literature why is there a custom print option?  Help, please
    Many thanks
    GMJ

    Have you got any chance with this issue. It seems I cannot change the paper size as well!!!!!!

  • Print paper size for Purchase order

    Hello,
    We have purchase orders for Japan, Sweden. The requirement from business to print for A4 size and Legal size. What does Legal size mean? Does it mean 'Japan Legal Size' and 'Sweden Legal Size'.
    Sincerely,
    Sanjay

    It is a size of paper
    Non-ISO size typing paper, 81/2 inch wide and 14 inch tall, used almost exclusively in the UK, USA, and commonwealth countries. Also called foolscap size after an early trademark carried as a watermark.

  • Solaris 9 postscript printing paper size incorrect

    I'm trying to setup a number of remote printers that are by default A4 printers.
    Printing a text test page works correctly.
    When the Oracle Application produced a postscript report, the printer asks for US Letter paper.
    I have tried forcing the media type to be A4 and force printing to the A4 tray, but since the printers are postscript enabled, I think the forcing has no effect as the printer interprets the postscript and sees that it's US letter format.
    So, without changing the printer or the paper, or the format of the Oracle Report, is there a way to have the solaris printing system (not CUPS) change or force the paper format to be A4 ?
    Also, is there any GOOD documentation on Solaris printing?
    Cheers
    A

    go to this link and try solution two :
    http://h10025.www1.hp.com/ewfrf/wc/document?docname=c02844544&cc=us&dlc=en&lc=en&product=4083977&tmp...

  • Unable to figure out paper sizes in PSE 9...

    Hi, I am trying to print a 4x6 photo... when I click print the pse print window opens and asks to select: printer, paper size & print size.  I don't know what paper sizes they are offering, ex: KG, KG.NMg,  PhotoPaper2L, PhotoPaper2L.NMgn, PhotoPaperRoll, PhotoPaperRollNMgn, etc.... ??  When I select these and try to print my 4x6, my image is cut off the edge.  What are these paper sizes? and what should I select to print a standard 4x6 photo?  Thanks for your help.

    Thanks for your reply, "no margin" is probably right, but still unsure what the sizes are.  I don't know why'd they be metric.  Other options on the list were the standard: a4, letter, legal, 8x10in (that looks like a photo size), and some other ones I've never seen before: HiVision 102x180 , Env10 (guessing envelope size), A6.Maximum (??), and Halfletter.  These are the selection for the window for PSE9.... once I move to the next window (after selecting print on the pse window)... my printer window comes up and all is well, though there is not a place to select paper size, just paper type (glossy, etc).  Very frustrating to waste so much costly photo paper.

  • Excel 2010 bug -- cannot place controls on chart properly after changing paper size

    I have encountered unexpected behavior in Excel 2010 when placing controls on a chart that is a separate sheet. The issue is that the controls (e.g. spinner, scroll bar, etc.) cannot be placed or moved to the right side or the bottom.
    Steps to reproduce:
    1) create a chart as a separate sheet
    2) change the paper size to, for example, A6 (4.13" x 5.83")
    3) change paper size back to Letter (8.5" x 11")
    4) controls cannot be placed on right side or bottom of chart.
    It appears that instead of using the current dimensions of the chart paper size to determine where controls may be placed, the smallest dimensions that have ever been applied to the chart are used.
    I am looking for a workaround for this issue since I would like to use a paper size large than 8.5" x 11", but I cannot place controls on such a chart properly at this time.
    Any ideas?

    I have found a workaround for this issue:
    1) change paper size in your default printer's preferences to the paper size you want in Excel.
    2) afterwards insert or create the chart. It is automatically the correct paper size, and controls can be placed or moved properly.
    3) change default printer paper size back.
    In case your chart has already been created, simply copy the existing chart in step 2 instead of inserting/creating.
    Aidan
    Edit: credit to http://webdesignerpark.blogspot.com/2013/02/paper-size-to-set-your-default-paper.htmlfor the idea on changing default paper size.

  • Printing custom size prints with Epson 1430 printer

    We have been trying to print photos slightly larger then standard sizes.  not sure what the the paper sizes are A3 & A4

    As an experiment, please try the following;
    Open the Editor in Expert tab
    Go to File>New>Blank file. Set w=10.5", h=8", resolution 240 px/in, background: white. OK
    Use the brush tool to make a few scribbles on this canvas
    Go to File>Print. Select individual print, paper size letter size or 8.5x11"
    When you try to print this, do you still get the error message?

Maybe you are looking for

  • Addition of field in std reprt S_ALR_87012103

    HI, In std report S_ALR_87012103 (List of vendor line items), we wan't to add one field as ' hard currency'. Plz suggest . Regards,

  • Where are the "content" files located in the directory?

    I want to add some of my own bitmaps as clip art. It would be nice to select them the same way that the Adobe ones can be selected from the thumbnail drop down menu in the content pane. Any ideas? Version 7 and XP Barry in St. Louis

  • Pie slices

    Hi all I need to draw a 3D pie chart using Java 3D. Can anyone tell me the best way to draw separate pie-slices? Using a LineArray could work i guess, but this would be difficult and mathematical because I can't hardcode the coords (pie-chart data is

  • Having trouble with iPhone 5 camera shutter not opening

    Any ideas what I can try. Sometimes it works and other time the shutter locks up.

  • ALV   diplay

    Hello, How to color a particuler column in ALV ? I am sorry..... How to color a particuler row in ALV ? Message was edited by: Johnn Abraham