Print in format A3

Hi everyone,
actually I make an intership in a society and it's my last week. And durinf more than 4 weeks, I hardly tried to print a Jpanel in A3 format.
So I explain more : my JPanel has 3 parts : one with textarea, JLabel, JTextfield... and the two other with imageIcon. Actually, I have no problem to print this in A4 format with a landscape orientation. But when I try to print in A3, my JPanel keep the A4 dimension!!!
So I have a question : How can I print this in A3 format?
I have tried to use iText, but I can't give my JPanel in parameter.
Let's have a look at my source :
class LeftPage extends JPanel {
   public ImageIcon img1;
   public LeftPage(){
     img1 = new ImageIcon("page1.jpg");
   public void paint(Graphics g) {
     Graphics2D graphics2D2 = (Graphics2D) g;
     graphics2D2.drawImage(img1.getImage(), 0, 0, getWidth(), getHeight(), this);
class RightPage extends JPanel {
  public ImageIcon img2;
  public RightPage(){
    img2 = new ImageIcon("page2.jpg");
  public void paint(Graphics g) {
    Graphics2D graphics2D2 = (Graphics2D) g;
    graphics2D2.drawImage(img2.getImage(), 0, 0, getWidth(), getHeight(), this);
public class PageA3 extends JPanel implements Printable{
  //Panels
  public JPanel panPage1 = new JPanel();//contient panEntete et PageGauche
  public JPanel panPage2 = new JPanel();
  public JPanel panEntete = new JPanel();
  PageDroite panRight = new PageDroite();
  PageGauche panLeft = new PageGauche();
//others graphics elements like JLabel, JTextfiels, JTextarea ..
//Constructor
public PageA3() {
    this.setLayout(new GridLayout(1,2));
   public void imprimer() {
     PrinterJob printJob = PrinterJob.getPrinterJob(); //pr obtenir un objet de type PrinterJob
     printJob.setPrintable(PageA3.this);
     boolean choix = printJob.printDialog();
     if (choix) {
       try {
         printJob.print();
       catch (Exception PrintException) {}
   * print
   * @param graphics Graphics
   * @param pageFormat PageFormat
   * @param pageIndex int
   * @return int
  public int print(Graphics g, PageFormat pageFormat, int pageIndex) {
    Graphics2D g2 = (Graphics2D)g;
   if (pageIndex >= 1)
   { return Printable.NO_SUCH_PAGE;
    g2.rotate(Math.PI /2);
   //g2.rotate(1.57);
   g2.scale(72.0/100, 72.0/100);
   g2.translate(pageFormat.getImageableX(), pageFormat.getImageableY());
   paint(g2);
   return(PAGE_EXISTS);
}Have you an idee, it's very urgent. Thanks a lot and best regards.

Hi,
I look the java.awt.print.Paper 's Class. And I have added this to my source :
     PageFormat pf = printJob.defaultPage();
     Paper papier = new Paper();
     papier.setSize(16.5*72, 11.69*72); //A3 dimension, I think
     papier.setImageableArea(0.0, 0.0, papier.getWidth(), papier.getHeight());
     pf.setPaper(papier);But now , I have 2 problems :
- first : my Y coordinate isn't exactly on the the upper left hand corner of my paper.
- second : it keep the A4 's width!! Why??? I don't understand, I have exactly precise papier.setSize(16.5*72, 11.69*72); //A3 dimension, I thinkI'm going a little bit crazy, please.
Best Regard.

Similar Messages

  • How to print a formatted page in java?

    hi all
    i've made my simple application that writes and retrieves information to/from a database, and organizes them in reports
    now, i got to print these reports in formatted pages like, for example:
    title centered and bold
    first db record
    second db record
    eccc
    i followed the http://java.sun.com/products/java-media/2D/forDevelopers/sdk12print.html documentation and wrote this class
    import java.awt.print.*;
    import java.awt.*;
    import java.text.*;
    import java.awt.geom.*;
    import java.awt.font.*;
    public class print implements Printable
    //the "\n" token doesn't allow me to do a new line, as i want!!
        String mText="The JavaTM Print Service \n is a new Java Print API that allows printing on all Java platforms, including platforms requiring a small footprint, such as a J2ME profile, but still supports the current Java 2 Print API. Thie Java Print Service API includes an extensible print attribute set based on the standard attributes specified in the Internet Printing Protocol (IPP) 1.1 from the IETF. With the attributes, client and server applications can discover and select printers that have the capabilities specified by the attributes. In addition to the included StreamPrintService, which allows applications to transcode data to different formats, a third party can dynamically install their own print services through the Service Provider Interface ";
        AttributedString mStyledText=new AttributedString(mText);
        static public void main (String args[])
            PrinterJob printerJob=PrinterJob.getPrinterJob();
            PageFormat format=new PageFormat();
            format=printerJob.pageDialog(format);
            Book book=new Book();
            book.append(new print(),format);
            printerJob.setPageable(book);
            boolean doPrint=printerJob.printDialog();
            if(doPrint)
                try
                    printerJob.print();
                catch(PrinterException ex)
                    ex.printStackTrace();
        public int print(java.awt.Graphics g, java.awt.print.PageFormat format, int param) throws java.awt.print.PrinterException
            Graphics2D g2d=(Graphics2D)g;
            g2d.translate(format.getImageableX(), format.getImageableY());
            g2d.setPaint(Color.black);
            g2d.setFont(new Font("Serif",Font.PLAIN,5));  //this doesn't work!!!
            Point2D.Float pen=new Point2D.Float();
            AttributedCharacterIterator charIterator=mStyledText.getIterator();
            LineBreakMeasurer measurer=new LineBreakMeasurer(charIterator,g2d.getFontRenderContext());
            float wrappingWidth=(float) format.getImageableWidth();
            while(measurer.getPosition()<charIterator.getEndIndex())
                TextLayout layout=measurer.nextLayout(wrappingWidth);
                pen.y +=layout.getAscent();
                float dx=layout.isLeftToRight()?0:(wrappingWidth-layout.getAdvance());
                layout.draw(g2d,pen.x+dx, pen.y);
                pen.y+=layout.getDescent()+layout.getLeading();
            return Printable.PAGE_EXISTS;
    }this works, and is great the dialog to choose the paper orientation and the printer, but i'm still not able to do the simplest things: like
    - change the font of my text (as you can see in the print() method)
    - do a new line in my text (as you can see in the beginning of the code)
    so, now that i'm able to print some text, i'd like to be able to change the format of my printable page
    any advice?
    i didn't find any tutorial really complete! anyone can suggest me any?
    thanx a lot in advance
    sandro

    I'm not sure if you still need this, but try \n\r instead of simply \n.
    \n is a new line, but \r signifies the carriage return, back to the left. I'm not sure if it's always necessary, but it was in my case.

  • Unable to Align the fields according to the Pre-Printed Cheque format

    Hi,
    I am having a requirement where I need to align the report output according to the Pr-printed Chekc Format which is loaded in the printer.
    In detail we have a pre-printed format of the cheque which will be loaded into the printer which includes the logo and the amount fields with the symbol of currency,date etc.
    I need to print the output which is runned by formating the payment batch.I am getting the output printed but not in the exact palces where I need.I tried to modify the report fields by increasing the length and width of the main section but of no use.Can any one help me out at the earliest.
    I am getting the output either out of the symbol of currency and even the date as well.
    Thanks for your help in advance.
    With Regards,
    Sunil.

    Can you explain briefly the below point which you have mentioned.
    "Also set the increase the size of fields upon the size of pre-printed area and set the horizontal Elasticity to FIXED. Then align and print."I meant that increase the size of fields according to the size of pre-printed document and set the horizontal elasticity to FIXED so it will not go out from the desired space.
    Well, this is what i said you will have to set the alignment and will have to check by printing again. There is no specified format of pre-printed document type reports.
    -Ammad

  • How can I print File Format definitions?

    We have multiple text and spreadsheet input files we use to load data to our DW.  Is there a way I can print the format definitions for the the text and spreadsheet files?
    I've used the Auto documentation feature for work flows and data flows, but don't see an option for the print the File Formats (very well could be user error!).
    Thanks for any insight...
    Dan

    You can view the file format in the Auto Documentation page but don't see a button to print it out.  Is this what you are looking for? ...
    May print the web page in browser  

  • Print out Format Modification for Orders & Notifications

    Dear All,
    I need to create new Print out format for Order & Notification.
    Can any body suggest what will be the necesary config settings need to be done after creation of new  Print out form & how i can achieve it?
    Regards
    Dhiren

    Dhiren,
    After creating a new form,please follow the below steps..
      1) Use transaction OIDF to create  a New shop paper by copying a existing shop paper (Which suits your needs). Replace the SAP Script form with your new form and try to keep the same standard program. 2) Use transaction OIDG to assign the shop paper to order type.
    Use transaction OIDA and OIDB to do the same two steps for the Notification.
    Regards
    Narasimhan

  • UML Class diagrams: Printing and formatting

    I really like the UML capabilities of NetBeans 5.5. In particular, I like the ability to create a "centered" dependency class diagram by right-clicking on a class and selecting "Generate Dependency Diagram."
    However, I am having trouble with some basic printing and formatting issues. I am hoping that I'm just being stupid, but I haven't been able to find documentation on how to fix this. I am using Red Hat Enterprise (3.4.6-3).
    I recently reverse engineered an 800 class project, and it didn't take too long. Less than a minute, probably.
    1. Can't get a landscape printout. Fiddle with Page Setup and Print menu items, set to landscape, but almost always get a portrait mode printout. Why?
    2. The arrowheads are frightfully small. How do you make them bigger?
    3. How can you globally set a preference to only show public attributes and operations for all classes?
    Thanks for the help.
    Dave Godbey

    Good to hear your feedback. Thanks.
    #1. there's a known bug on printing to landscape mode. However, the following workaround should print you a landscape diagram.
    - from the diagram window toolbar, click on the Print Preview button
    - from the Print Preview dialog, click on Print Setup
    - from the Print Setup dialog, click on Page Setup at the bottom left
    - from the Page Setup dialog, toggle the Landscape orientation radio button
    - press the OK button on the Page Setup and Print Setup dialogs: Your print preview should now be displayed in landscape orientation
    - now click on the Print button from the Print Preview dialog to print
    #2. I believe your diagram must be big so that the arrowheads are displayed small. Currently I don't see a way to make them bigger. Sorry for the inconvenience. I can file an enhancement on this for you or you can file one for yourself too thru the following URL.
    http://uml.netbeans.org/issues/enter_bug.cgi?component=uml
    #3. As for global preference to show only specific attributes or operations, there's an enhancement bug already, but the current version of the tool doesn't have this preference setting.

  • Camera shops can't print RAW format

    Recently I've come back from a beautiful Caribbean cruise with new photos taken with my Nikon camera. As soon as I came home from my vacation, I immediately took my flash card to the local camera shop hoping to get my pictures developed. I thought it was going to be as simple as me handing over my flash card, and getting my pictures. Unfortunately, I found out that my local camera shop doesn't print RAW format pictures. What is the best format to transfer to without losing quality? The local dealer said jpeg.

    The reason you shoot in Raw format is so you can have more options and control in post processing. If you intend to let a program (or a printing lab) use automatic setings to convert the raw imagesto JPG then there is no point in shooting raw images. In other words the point of using Raw is so you can exercise crative control over processing and printing.
    Typically when shooting raw format you would download the images onto you computer and then use a program (CS2, Aperture, or iPhoto) to select the best shots, trash the others and then crop, color balance and apply other edits to the images then finaly export them as JPG and burn to a CD or DVD to give to the lab. But if you only have a few images, say around 100 or so, like you say you have, there are services where you can upload the image files over the Internet. Just start the upload process before you go to bed one night and then pick them up at the retail outlet the next day. Saves you a trip.
    If what you want is prints made straight off the camera then set the camera to record in JPG. Some photographers can "get it right" in the camera but I find one advantage of digital is that I get a chance to fine tune the image after I shoot. Many times I'll do much more then "fine tune" and go in with an editor and make changes to the background or something. I'll spend at least a couple minutes on each image I think is worth printing and sometime I'll work on it for an hour if I really like it

  • Output in print out format

    hi
       i have a problem.
       i am doing a alv report. the output of the report should be in print out format.
       is there any function module?
       tell me the complete step to solve my problem.
    thank u.

    Hi muthuktl  ,
    If you are using FM REUSE_ALV_GRID_DISPLAY to disply report then use REUSE_ALV_LIST_DISPLAY.
    or else when you execute the report in Grid Display format in menu bar -> List - >Print Preview it shows the List format you need not to change anything.
    Hope it ll be useful.
    Regards,
    Sunil kairam.

  • Print tiff format

    Hi guys,
    I'm trying to print a tiff format image, I can print gif formats, but if the image is tiff, it doesnt print, on my researchs I saw that is not so simple as I'd like it to be, so if anyone here has done it before, print tiff images, pls send me directions.
    tks

    You need to make a Feature Request here: http://feedback.photoshop.com/photoshop_family
    This is a User forum and request here are lost.
    delroy wrote:
    I would really like to see the ability in the Print to File option in the Print Module to print to a TIFF file, not just jpeg. I deal with print shops that accept 16bit files in both ProPhoto and Adobe RGB formats. Would save time instead of having to create file in PS.
    Thanks.

  • 57F4 Print Output format for Subcontracting

    1. How to assign Print out put format for goods issue made against a subcontracting vendor
    2. How to assign print output format for 57F4 Subcontracting challan
    3. What are CIN settings for subcontracting po.

    Hi,
    Maintain the Outout type J1IF for the excise group - SPRO - IMG - Logisitics general - Tax on goods & movements - India - Business transactions - Subcontracting - Maintai subcontracting attributes
    check following link
    [http://wiki.sdn.sap.com/wiki/display/ERPLO/SubcontractingChallan57F4_J1IF01_J1IF11]
    Regards
    Kailas Ugale

  • Printing multiple format/language in one submission

    I'm new to XML Publisher and want to bounce my understanding off of someone to see if I'm understanding things. I have been requested to have one concurrent manager request submitted that will print all of the days invoices in the proper language and format.
    Following is my understanding - please verify:
    1. I think I need a RTF template per language/format. I can register one "Template" but assign multiple RTF formats based on Lang/Territory.
    2. I could allow the user to submit one request and it would execute a PL/SQL procedure that would submit multiple XML Report Publisher requests with the appropriate language and territory parameters so the correct RTF is used.
    3. The part I'm not so sure about is how to generate the XML Data. I'm thinking that I would have to actually submit a language/territory specific XML Data generation process before the XML Report Publisher process and feed that request id to the XML Report Publisher process.
    4. Question: is it wise to use the existing Oracle Report with output type XML to do #3 since it is already built and has all of the invoice logic in it?
    Any and all feedback on the above is greatly appreciated.
    Carl

    You can use the existing report logic to get the data out in XML format as you mentioned.

  • How to print a page in printer friendly format.

    Hi,
    I have a requirement, I need a Print button which can print APEX page in given formate. I can not use just window.print. Since I need Print option in APEX page not in report, Please let me know how t oachive this.
    Thanks,
    Priyanka

    Not sure what you mean, but if you add "YES" as 9th parameter in your APEX URL your Page is rendered in "PrinterFriendly" Mode.
    For URL Syntax: http://www.oracle-and-apex.com/apex-url-format
    See the documentation for details.
    brgds,
    Peter
    Blog: http://www.oracle-and-apex.com
    ApexLib: http://apexlib.oracleapex.info
    Work: http://www.click-click.at

  • How to Print PDF Format In SAP SCRIPT

    Hi All,
    I have a requirement to print the output in PDF format.
    First we can pass the parameter from Excel sheet,through on the parameters , we can fetch the output and print the PDF format.
    Please help me.
    regards
    raghava

    Hi Ragha,
    SAP has created a standard program RSTXPDFT4 to convert your Sapscripts spools into a PDF format.
    You will get the spool number from transaction SP02.
    Also go through the following document:
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/49e15474-0e01-0010-9cba-e62df8244556
    Regards,
    Nitin.

  • 10.9.1: Mail 7.1 screws up Print layout / formatting

    Mail 7.1 in Mac OS X 10.9.1 screws up the layout of Messages you try to Print.
    The two most common symptoms are that:
    1)  Blank space is inserted after the Headers and before the first line of the body of the message, so that the body of the message starts on the 2nd page.  These are apparently blank lines (not a Page Break) because if you reduce the scaling below 100% the body of the message starts to show on the bottom of the 1st page, but still with a large chunk of bogus, blank space between it an the headers.  And,
    2)  Extra blank pages are printed at the end of the message.  This could be 1 to several blank pages.  The number of extra blank pages is constant for each message, but differs between messages.  These DO appear to be Page Breaks -- not simply a large chunk of blank lines.
    These problems happen regardless of which printer is selected -- even happening if you Print via "Save As PDF".
    These problems are NOT cured by Resetting the Printing System and then re-installing the printers.
    For problem (1), the error seems to be uniquely associated with the use of "US Letter" Paper Size -- and only when used in Portrait orientation.  If you switch to Landscape orientation, or if you use Portrait orientation with either US Legal Paper Size (which is larger) or A4 Paper Size (which is smaller) the bogus blank space after the Headers goes away.
    However, problem (2) is NOT altered by switching either Paper Size or orientation.  You still get the same number of bogus, blank pages at the end.
    So far, I've only seen problem (1) when attempting to print Messages saved in my Sent folder.  Problem (2) appears both with messages in the Inbox and Sent folders.
    These problems only ever appear when the Message is printed.  Messages viewed on screen have no such issues.  The print formattting problems appear regardless of whether you Print the Message directly from the list of Messages in the Mail folder, or if you first double click on the Message to open it in its own window and THEN Print it.
    Note that I have "Organize by Conversation" *NOT* selected in the view menu, so Reply and Forward messages include the prior text attached at the end -- forming one, longer Message.  However, both problems (1) and (2) are exhibited on Messages which are comprised of a single Message *AND* Messages which included embedded text from prior Messages in their Reply or Forward chains.  NOTE:  Problem (1) only seems to show between the FIRST Headers and the start of the Message body -- not between any embedded Headers and the following text of their attached, Reply or Forward content.
    Both problems also show both on Messages with attachments and Messages without attachments.
    Has anyone found a way to cure these two problems?
    Of course you can workaround problem (2) by adjusting the Print dialog to only print the non-blank pages.  And you can kinda sorta work around problem (1) by selecting a Paper Size other than US Letter and then making judicious application of scaling in the Paper Handling sub-portion of the Print dialog, but these are manual steps you need to do DIFFERENTLY for EACH Message you want to print.
    Deep sigh....
    --Bob

    I should add that these Print formatting issues do *NOT* show on every Mail 7.1 message in Mavericks 10.9.1.
    So far, I've not been able to ferret out just what it is about a Message that cause Print formatting to screw up.  Things I believe I've ELIMINATED include:
    1)  Newly created Messages vs. old Messages.
    2)  Messages with or without attachements
    3)  Messages with or without signatures
    4)  Messages which include prior Messages in a Reply or Forward string, or not (i.e., single, original Messages)
    5)  Mesages with multiple recipients or not or with CC: recipients in the Header or not.
    However this problem is by no means "random".  Any Message that shows one of the Three Problems I've detailed above will exhibit that Problem every single time you try to Print it.  Any Message which Prints cleanly, will continue to Print cleanly every time as well.  So there is SOMETHING about the data in the failing Messages which is triggering this problem.
    One new behavior I've noted is that for some Messages a new notice appears on screen -- briefly -- the first time you try to Print them.  It appears so briefly that I may have the exact text wrong, but it is something like "Generating Print Content".  I'm beginning to  suspect the Printing problems show ONLY on Messages that need to go through that "extra step" the first time you try to Print them.  But I don't know what that Message implies -- i.e., is there a new, "printable" file being generated by Mail specific to that Message which might persist across different Print attempts?  If so, the error may be due to how THAT file is created.
    This new notice only seems to appear the FIRST time you try to Print a Message -- and evidently not on every Message (or pehaps it is so brief on some Messages that I just don't see it).
    --Bob

  • APEX on Oracle XE PDF printing produces: Format error: not a PDF or corrupted.

    Dear fellow Apexers and Oracle Gurus,
    I have the following configuration:
    Oracle XE 11gR2
    APEX 4.2.3.00.08
    Listener 2.0.5
    On this setup I can create workspaces and applications as I please.
    Now I want to print a PDF report.
    I have set up PDF printing to "Oracle Listener" in the "manage Instance" settings in the instance administration.
    I have created a classical report on the EMPLOYEES table (Select * from EMPLOYEES)
    and enabled PDF printing in the "Printing" area of the "Print Attributes" of the page.
    When I run the page I do get the "print" link on the bottom of the page.
    Clicking the link does produce a .PDF but showing this file triggers an error in my PDF reader: Format error: not a PDF or corrupted.
    Opening the .PDF file in a text editor reveals the corrupt content.
    %PDF-1.4
    %ª«¬
    Unknown function: gatherContextInfo
    The same setup works fine and produces the expected PDF file with the report on the following configuration:
    Oracle Vbox with Developer days image;
    DB 11gR2
    Upgraded to apex 4.2.3.00.08
    Listener 2.0.5
    Since the PDF shows "unknown function" I suspected the XE configuration to lack some of the necessary rights, maybe I forgot to configure the ACLs correctly.
    So I compared the ACL info on both configurations. Alas,.. on both machines they return the same result..
    SQL> SELECT * FROM DBA_NETWORK_ACLS
    HOST         LOWER_PORT    UPPER_PORT    ACL
    localhost    null          null           /sys/acls/local-access-users.xml
    *            null          null           /sys/acls/power_users.xml    
    SQL> select * from dba_network_acl_privileges
    ACL                                  PRINCIPAL      PRIVILEGE   IS_GRANT    INVERT
    /sys/acls/local-access-users.xml     APEX_040200    connect     true        false
    /sys/acls/power_users.xml            APEX_040200    connect     true        false 
    Anyone any idea why this works fine on the Vbox and not on the local XE configuration?
    Any hint or answer as to where the problem might be is appreciated
    TIA
    Wouter

    I'm having the same issue. I'm using Oracle XE 11gR2 as well. I've tried with APEX 4.2.2 and APEX 4.2.4. I have set up the Oracle Listener in instance settings and set the report to print and I have the same result as you. Have you had any progress yet?
    Thanks
    Jason

  • Print different format files using java API

    Hi All,
    I need to print documents ( MS-DOC, PDF, Plain Text ) using Java API. I do not need window for configuring number of pages to be print etc etc.. Whatever the file specified should be printed.
    I checked with printerJob.print(); from java API and able to print simple text. I need to approach same for files of different formats.
    Any other API's ? How do i approach?
    Any help will be appreciated.
    Thanks,
    Praveen

    Which of the LiveCycle products are you looking at? (there is no Java API to Acrobat)

Maybe you are looking for

  • MB and world travel adapter kit

    I'm thinking about buying a MB for use in travel. I have a world travel adaptor kit, but I notice the store page specifically does not list the kit as supporting the regular MB (it lists the MB Pro, iPods, etc.). Does this mean the kit is not recomme

  • A very strange thing happening with Nokia Map Load...

    I am trying to load new maps onto my x6. When I click on Nokia Map Loader it tells me that another instance of the programme is running and that I need to close that one down first. But this is not the case. I have no other programmes running. It men

  • Calculating 2 fields without a script error.

    Is there a way to make a calculation of two fields not calculate until the 3rd field is reached.  I have a calculation that takes (field1/field2)*100.  Once the user puts in field1, it throws a script error, which is annoying.  Anyway around this???

  • How to Filter Data in Model

    Hi Gurus, I have a Table in database (53 Million records)  Eg: Employee Table I Reverse Eng. Table and as i want only Records with Employee Id:  1 to 10 as a source to my target table.  I applied the filter in the source datastore. And, able to do ma

  • Wireless bridge - encrypting all VLANs

    I'm bridging two VLANs across a wireless bridge link. I have the following configuration: dot11 ssid bridge vlan 1 authentication open interface Dot11Radio1 ssid bridge station-role root bridge interface Dot11Radio1.1 encapsulation dot1Q 1 native bri