How to use different pageFormats while printing in the same book object.

Hi All,
I m able to print Multiple pages, but the problem is when i want print multple pages with different pageformates I mean One pages having 4X2" size and another one is 5X5", while print second page objects not appears properly
Pls see the below code to get the problem.
any works around this will be appreciated.
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.Rectangle2D;
import java.awt.print.Book;
import java.awt.print.PageFormat;
import java.awt.print.Paper;
import java.awt.print.Printable;
import java.awt.print.PrinterJob;
public class MultiplePageFormatTest
public static void main(String[] args)
  MultiplePageFormatTest example3 = new MultiplePageFormatTest();
  System.exit(0);
private final static int POINTS_PER_INCH = 72;
public MultiplePageFormatTest()
  PrinterJob printJob = PrinterJob.getPrinterJob();
  Book book = new Book();
  PageFormat documentPageFormat = new PageFormat();
  PageFormat documentPageFormat1 = new PageFormat();
  Paper paper = new Paper();
  Paper paper1 = new Paper();
  paper.setSize(4.5 * POINTS_PER_INCH, 2.5 * POINTS_PER_INCH);
  paper.setImageableArea(.25 * POINTS_PER_INCH, .25 * POINTS_PER_INCH,
   4 * POINTS_PER_INCH, 2 * POINTS_PER_INCH);
  documentPageFormat.setPaper(paper);
  paper1.setSize(5.5 * POINTS_PER_INCH, 5.5 * POINTS_PER_INCH);
  paper1.setImageableArea(.25 * POINTS_PER_INCH, .25 * POINTS_PER_INCH,
   5 * POINTS_PER_INCH, 5 * POINTS_PER_INCH);
  documentPageFormat1.setPaper(paper1);
  book.append(new Document(), documentPageFormat);
  book.append(new Document(), documentPageFormat1);
  printJob.setPageable(book);
  if (printJob.printDialog())
   try
    printJob.print();
   catch (Exception PrintException)
    PrintException.printStackTrace();
private class Document implements Printable
  public int print(Graphics g, PageFormat pageFormat, int page)
   Graphics2D g2d = (Graphics2D) g;
   g2d.translate(pageFormat.getImageableX(), pageFormat
    .getImageableY());
   g2d.setPaint(Color.black);
   g2d.setStroke(new BasicStroke(
    2));
   Rectangle2D.Double border = new Rectangle2D.Double(
    0, 0, pageFormat.getImageableWidth(), pageFormat
     .getImageableHeight());
   g2d.draw(border);
   return (PAGE_EXISTS);
}

Hi,
Till now this question is not answered.........
Any Answer around this deeply apprciated.
Edited by: DoraiRaj on Sep 29, 2009 3:55 AM

Similar Messages

  • How to Use different icons for JTree in the same level

    Hi guys, i come cross a problem with JTree. The module need a JTree which need to represent items in the same level using different icons. For example:
    [Icon for Root]Root
    |
    |_____________[Icon for Table] TABLES
    |
    |_____________[Icon for Index] INDEXS
    |
    |_____________[Icon for Views] VIEWS
    As i know, the default behavior for JTree is using the same icon for all leaves and
    the same icon for all node that has children. How can i achieve that?
    Thansk a lot!

    subclass DefaultTreeCellRenderer. if you overwrite the method below, then you can set the icon to whatever you want....!
        public Component getTreeCellRendererComponent(JTree tree, Object value,
                                    boolean sel,
                                    boolean expanded,
                                    boolean leaf, int row,
                                    boolean hasFocus) {
         String         stringValue = tree.convertValueToText(value, sel,
                               expanded, leaf, row, hasFocus);
            this.tree = tree;
         this.hasFocus = hasFocus;
         setText(stringValue);
         if(sel)
             setForeground(getTextSelectionColor());
         else
             setForeground(getTextNonSelectionColor());
         // There needs to be a way to specify disabled icons.
         if (!tree.isEnabled()) {
             setEnabled(false);
             if (leaf) {
              setDisabledIcon(getLeafIcon());
             } else if (expanded) {
              setDisabledIcon(getOpenIcon());
             } else {
              setDisabledIcon(getClosedIcon());
         else {
             setEnabled(true);
             if (leaf) {
              setIcon(getLeafIcon());
             } else if (expanded) {
              setIcon(getOpenIcon());
             } else {
              setIcon(getClosedIcon());
            setComponentOrientation(tree.getComponentOrientation());
         selected = sel;
         return this;
        }

  • Can anyone give me simple instructions on how to use more than one ipod on the same computer with itunes? Both my daughters have ipods, my wife has one

    Dear All
    Can anyone give me simple instructions on how to use more than one ipod on the same computer with itunes. My daughters have a different generation 'nano' each & my wife a 'shuffle'?
    Many thanks

    Click here for options.
    (69081)

  • How to use parallel flowed subforms begining at the same position.

    How to use parallel flowed subforms begining at the same position in my form.
    Ex
    Subform1
    Subform2
    Subform3
    DropDownList1
    DropDownList1
    DropDownList1
    I would like to repeat  with a button the 3 subforms in parallel
    Subform1
    Subform2
    Subform3
    DropDownList1
    DropDownList1
    DropDownList1
    Subform1
    Subform2
    Subform3
    DropDownList1
    DropDownList1
    DropDownList1

    Post your question in the LiveCycle Designer forum.

  • HT3130 trying to export a 4 minute video to desktop.  Only 1:08 seconds exports.  I've tried other clips and they all cut at 1:08.  Used different exports like Quicktime with the same results.

    trying to export a 4 minute video to desktop.  Only 1:08 seconds exports.  I've tried other clips and they all cut at 1:08.  Used different exports like Quicktime with the same results.

    Good to hear that you've had some success with the import.
    I tried 3 times to do it before I finally changed it to H.264, and it worked on the first try.  The quality of the compression was terrible with those settings compared to my standard settings, but I'm just glad it worked.
    Rather than Share>Export using QuickTime and then choosing your own settings for H.264, you may get a better result if you simply use the Share>Export Movie option. Alternatively, use the Share>Media Browser option (as I mentioned in my earlier post). You will be presented with a range of sizes to choose from. Depending on your target, it's usually best to select the highest size available, such as Large, HD 720p or HD 1080p. However, for producing a DVD it's best to not go beyond the HD 720p size, as the DVD will be downscaled during encoding to Standard Definition in the appropriate size for either PAL or NTSC.
    In my experience, both these options (Export Movie or Media Browser) produce a video file of excellent quality. The files will be in H.264 format and will have the file extension .mov or .m4v depending on the size of the export. I'm assuming that your camera records HD video in AVCHD format.
    These files work well with iDVD (or other DVD authoring programs). The export process for the presets is optimised by Apple to produce high quality video files at a reasonable file size. So, selecting a preset may give you a much better result. Choosing your own H.264 settings when using the "Export using QuickTime" method could be why "the compression was terrible". You may have selected a data (bit) rate that was too low. There is always a trade-off between quality and file size when compressing video.
    So, to summarise, try one of the Apple presets using either Share>Export Movie or Share>Media Browser.
    John

  • How to apply different styles to Portlets on the same Portal page?

    How do you apply different styles to Portlets on the same Portal page?
    I'm new to this kind of thing, but understand that something called "cascading style sheets" can help here?
    What are these, how do you use them, and can you make different Portlets (all types - PL/SQL, Java, Applications, etc) on the same Portal page have different styles assigned?
    Thanks!

    Jeff,
    Apply Oracle Portal styles at the region level. Your portlets within each region will inherit the style defined for the region.
    You may want to check out Report #40050 at portalcenter.oracle.com, "Design an Attractive and Compelling Portal Interface" for a good overview of the various design features of Oracle Portal.
    Here is the link:
    http://portalcenter.oracle.com/pls/ops/docs/FOLDER/COMMUNITY/OTN_CONTENT/MAINPAGE/OWSF_2003_PAPERS/40050_STOVER.PDF
    Regards,
    Jay

  • How to use family sharing when already sharing the same iCloud account

    My wife and I started separate iTunes account many years ago, and thus made many purchases on each account.  Some time later we started using iCloud, and when we did, we decided we wanted to share the same iCloud account so my wife, for example, could add entries in the Notes app and I'd be able to see them, and vise versa.  In addition, we have another iPhone for our daughter, and with that she has her own iCloud account in use on her phone, however, she is signed into my iTunes account on her phone (so her/my purchases were on the same iTunes account, namely mine).
    Now, years later, Family Sharing came along and I'm trying to figure out how I can also make that work with the iTunes and iCloud setup we currently have.  My hope, with the Family Sharing feature, is that my wife's purchases (on her iTunes account) and my purchases on my iTunes account would be able to be shared.  That said, how should I go about setting up Family Sharing such

    sounds like you only need to share with the other account that your daughter used.  the same id in icloud on wifes devie is fine.  this article will help. Sharing purchased content with Family Sharing - Apple Support Peace, Clyde

  • [SOLVED] How to use timidity++ and other programs at the same time?

    I have installed timidity following arch wiki instructions - I have soundfont, and I start it in /etc/rc.conf
    It works properly with tuxguitar (and tuxguitar-alsa) or kmid, but I cannot play MIDI and - for example - oggs in amarok at the same time.
    I suspect that the problem is that timidity doesn't use dmix alsa plugin I have made in my ~/.asoundrc.
    The question is: how to tell timidity to use my dmix plugin?
    Last edited by senjin (2007-11-19 19:53:50)

    but they don't define "default" there, but "!default"...
    anyway, I have already both "default" and "!default" defined exactly the same way:
    pcm.!default
    type plug
    slave.pcm "dmixer"
    pcm.default
    type plug
    slave.pcm "dmixer"
    pcm.dmixer
    type dmix
    ipc_key 1024
    slave
    pcm "hw:0,0"
    format "S32_LE"
    channels 2
    period_time 0
    period_size 1024
    buffer_size 4096
    rate 44100
    bindings
    0 0
    1 1
    ctl.dmixer
    type hw
    card 0
    pcm.w_y_h
    type hw
    card 0
    device 0
    pcm.what_you_hear
    type plug
    ttable.0.10 1 # digital mix left
    ttable.1.11 1 # digital mix right
    slave.pcm w_y_h
    pcm.skype
    type asym
    playback.pcm "dmixer"
    capture.pcm "skype_input"
    pcm.skype_input
    type dsnoop
    ipc_key 2048
    slave
    pcm "hw:0,0"
    period_time 0
    buffer_time 0
    period_size 1024
    buffer_size 8192
    rate 44100
    and it doesn't work!
    Last edited by senjin (2007-11-18 17:49:21)

  • How to use 2 webcam for java at the same time?

    hi there,
    I have a question to ask regarding webcam and java. Basically i want to know whether is it possible to have 2 web cam running in java at the same time? I have no problem when running one usb webcam since i m using "
    ml = new MediaLocator("vfw://0") ;
    what parameter must i use to specify when using 2 web cam
    many thanks
    sun

    Hi
    I am making a project in which i have to capture a image through webcam. How can I do it will you please guide me or if can provide me code. Many thanks for your support. My email id is [email protected]

  • Using different sources to display on the same indicator

    I am using three slide bars and three different mathematical equations using the same indicator bars. I would like to control each equation with a different control button. When I hook up the output of each mathematical equation to the same indicator, I get indicators saying there can only be one output hooked to an indicator. Is there anyway around this??
    Thanks

    To elaborate on the previous poster's suggestion, I wrote the attached example
    Jeremy
    Attachments:
    lv60_multiplex_string.vi ‏23 KB

  • Win 8 - How to use StereoMix and Headphones Mic at the same time?

    I am using Windows 8 64 bit and believe I may have an IDT driver problem.
    I need to enable StereoMix and my Headphones Mic at the same time. I know this was previously possible with windows xp and windows 7.
    What happens is If I enable either Headphones Mic (Logitech headphones with Mic) or StereoMix the other one becomes " current;ly unavailable"  I cannot get them both to work together. I can get StereoMix and the Internal Mic to work together ( both enabled at the same time) but the sound quality is bad because the internal mic picks up noises from the PC. I need to have both my headphones mic and stereo mix enabled at the same time.
    The driver I'm using is the one provided by HP with the laptop. It is called sp59620.exe
    Would another IDT driver solve the problem? Can you think of another reason this is not working?
    Here are my specs.
    System Manufacturer/Model Number HP Pavillion G7-2251dx
    OS Windows 8 64 bit
    CPU AMD A-8 4500M
    Memory 8 Gigabytes DDR3 sdram
    Graphics Card Discrete ATI Radeon HD 7640G with 2 Gigs
    Sound Card IDT Audio
    Monitor(s) Displays 17.3
    Screen Resolution 1600x900
    If you cannot help, where else should I look? i have tried Windows and Microsoft forums and no one can give me an answer.
    Thank you.

    I have tried the instructions in that video and I cant get passed the very bad feedback i get when telling my recording device to Listen.  His secone instruction from his notes here
    ["Right Click the Realtech HD audio device and set as default if its not already.
    (note you may want to turn off any powered speakers you may have to prevent feedback.)
    -Select the Recording Tab at the top of the window.
    -Select the Stereo Mix device and set it to default if its not already.
    -Right click and select Properties.
    -Select the Listen Tab at the top of the window.
    -Change the drop-down box to the entry for USB headset and check the Listen to this device checkbox.
    -click ok to dismiss the window.
    -Right click on the USB headset microphone device and select properties.
    -Select the Listen Tab at the top of the window.
    -Change the drop-down box to the entry for the Realtech HD Audio device and check the Listen to this device checkbox.
    -click ok to dismiss the window.
    So, essentially, the game audio will play through the Realtec, your mic is also set to play to the Realtec. both audio streams are now part of Stereo Mix. Stereo Mix is being listened to by your headset allowing you to hear the game and your voice.]
    ~~~~~~~~~~~~~~~~~
    Don't know about turning off any powered speakers.. the only speakers I have besides the headphones are the internal laptop speakers.  I get the same feedback if i have the headphones plugged in or not.

  • How to set different view parameter programmatically in the same task flow

    Hello everyone,
    I have a view activity A that calls another view activity B with a link. In this link the action is set to a method (I use JSFUtils class: http://jdeveloper-adf.googlecode.com/svn/trunk/TGPrototype2/ViewController/src/com/tgslc/defaultManagement/utils/JSFUtils.java):
    public String goToB() {
    String paramToPass = "someParameterTakenInSomeWay";
    JSFUtils.setExpressionValue("#{pathToViewB_pageBPageDef.paramName}",paramToPass);
    return "openActivityB";
    where openActivityB is the control flow case to call B.
    In the B pageDef file I have set a parameter "paramName" without any value:
    <?xml version="1.0" encoding="UTF-8" ?>
    <pageDefinition xmlns="http://xmlns.oracle.com/adfm/uimodel"
    version="11.1.1.59.23" id="pageBPageDef">
    <parameters>
    <parameter id="paramName"
    value=""/>
    </parameters>
    <executables/>
    <bindings/>
    </pageDefinition>
    But at running time I have a oracle.jbo.expr.JIEvalException:
    JBO-25077: Name paramName not found in the specified object: pathToViewB_pageBPageDef.
    The question is: how can I set the parameter programmatically from the view activity A?
    Note that I use this method to set the parameter because in the real application I have many "view activity A" that will call B, but all of these have to set this parameter.
    I use JDeveloper 11.1.1.4.
    Thanks in advance,
    Baduel

    Hi,
    this is because PageDef B represents a binding container that is not active to the time you try to call it. The binding container becomes available when navigating to the page but not before. Instead:
    1. define a managed bean in pageFlowScope and expose a setter/getter method to hold the value to pass on
    2. Reference the managed bean in pageFlowScope from the attributebinding NDValue property using EL
    3. Set the managed bean value before navigating to view B
    Frank

  • How to use Counter B0 and B1 in the same time

    Hi, I am a rookie, and first time post question at here.
    my Card is DAQcard-1200, and data acquisition code is based on MFC of VC6. now I used counter B0 as timer for data sample. how can i use B1 as a suqare wave generator?
    Thank you.

    Hello P.
    The post says that you cannot setup a squarewave generator using B1 unless you provide an external clock; which would not make any sense since you are trying to generate a clock signal. But if you use B0, then the first thing I would advise you to do is read the general purpose timing section of the manual.
    I would then search National Instruments' web site for examples such as this one. You can search for examples in the NI Developer Zone.Message Edited by sergesl on 06-29-2005 02:05 AM

  • How to run different Oracle client versions on the same PC

    I have developped an application (.Net 2.0, ODP v. 10). I must run it on PC where Oracle client version 8 is installed. The PC cannot be upgraded because of a client software running under this version.
    I tried to install ODP v. 10 on this PC in different home, but the software using version 8 stops running.
    Can Oracle Instant Client help ? But which version, 11 ? My application is based on ODP 10. Can ODP 10 access database via Instant Client 11 ?
    Thanks for your help
    LK

    The problem on Windows is: The 10g installation changed the default ORACLE_HOME,now it points to 10g and makes the 8.0.5 application invalid,because it runs now in a much higher environment. What I did in a similar situation, I created a batch file, which sets temporarily the old environment (in my case PATH,ORACLE_SID,ORACLE_HOME) and then invokes the application.
    I don't know whether such a solution will work for you (8.0.5 is very old,desupported since a long time), my old version was 8.1.7.4.
    Werner

  • How to use different page scapes in smartforms

    hi
    How to use different page scapes in smartforms.
    I want Potrait format in the 1st page and Lanscape format in 2nd page is it possible if so plz suggest me an idea

    Hi,
    It is possible in smart forms, but not in scripts.
    we can have 3 tabbed options for pages in smart forms.
    <b>General...
    Output options
    Conditions</b>.
    In <b>output options</b> u can define whether a page can portrait or land scape in <b>print attributes</b>.
    Reward if helpful.
    Regards,
    Sandhya

Maybe you are looking for