Printing a component that is larger than the paper size

Hi,
I am trying to print a component that may be larger than the size of the paper being used. Is there some way to get it to split between pages - ie, if it's larger than the page, it is printed over two or more pages?
The component in question is a JTextArea. Would it be better to get the text from it and use the graphics drawString rather than the component's paint method?
The relevant part of the code is below.
Thanks,
Helen
     //cast the Graphics object to a Graphics2D object
     Graphics2D g2 = (Graphics2D) g;
     //set the origin to be (0,0)
     g2.translate(format.getImageableX(), format.getImageableY());
     //if double buffering is enabled, disable it before printing
     boolean b = testForDoubleBuffering(c);
     if (b == true){
     disableDoubleBuffering(c);
     //tell the Component to draw itself to the printer
     comp.paint(g2);
     //if double buffering was enabled, reenable it once printing has happened
     if (b == true){
     enableDoubleBuffering(c);
     //return this constant to tell the PrinterJob that the page has been printed
     return Printable.PAGE_EXISTS;

Hi,
I am trying to print a component that may be larger
than the size of the paper being used. Is there some
way to get it to split between pages - ie, if it's
larger than the page, it is printed over two or more
pages?
The component in question is a JTextArea. Would it be
better to get the text from it and use the graphics
drawString rather than the component's paint method?
The relevant part of the code is below.
Thanks,
Helen
     //cast the Graphics object to a Graphics2D object
     Graphics2D g2 = (Graphics2D) g;
     //set the origin to be (0,0)
g2.translate(format.getImageableX(),
format.getImageableY());
//if double buffering is enabled, disable it before
printing
     boolean b = testForDoubleBuffering(c);
     if (b == true){
     disableDoubleBuffering(c);
     //tell the Component to draw itself to the printer
     comp.paint(g2);
//if double buffering was enabled, reenable it once
printing has happened
     if (b == true){
     enableDoubleBuffering(c);
//return this constant to tell the PrinterJob that
the page has been printed
     return Printable.PAGE_EXISTS;I should add that this is part of a class that implements Printable. However, it is being called by a Book class with the Book's append() method. It is the Book class that is being printed by the PrintJob:
     Book book = new Book();
     book.append(new PrintableClass(c), format);
     //set the pageable class to be the book, with the user-selected format
     job.setPageable(book);
     //if the user clicks the print button, start the printing process, otherwise cancel the print
     if(job.printDialog()){
     try {
          job.print();
     } catch(PrinterException pe) {
          System.out.println("Error printing: " + pe);
Thanks,
Helen

Similar Messages

  • How to create a map that is larger than the game in width and height?

    hi,
    i wounder how i can create a map(not the design) that is larger than the game in width and height, part of it will appear in the main page and anther part you can move to it after you press the arrow symbol, but the map is just one image so i want put it in line and out line the game page, and the out line part includes buttons and symbols the player can use, but it will be in line and the other part will be out line when you press the left arrow or the down arrow, how i can do that?
    and is that possible to animate it so when the player press the arrow, will give it action to start the animation in one sec, i know how to animate it if that possible but i don't know which code i will use for the mouse click with the arrow symbol, and how to use the same code in the same symbol to start anther animation depending on which part of the map is on?

    I don't know a lot about mask and masked layers and how to work with the normal layers beside i will use some 3D graphics but not in the background, i will explain all this to you to be more clearly.
    first i am using action script 3.0
    close ex,
    you have 2d map"image"  900*300 pixel.
    this image contains some 2d symbols when you click will go to anther normal map (anther normal layer) so they must appear.
    your game 320*320 px, and the place the map will show on 300*300, and there's basics objects will be in most pages including the page that show the map so i don't know a lot about how this will work with mask layers.
    so you can only see the left side of the map image and what it contains, while there's two arrows one to the left and one to the right there's three cases here,
    first when it show the left side(start from x:0 to x:300), the left arrow will not active when you press and the right arrow will start an animation that make the map image move to the mid side in one sec when you press.
    in mid side (start from x:301 to x:600) the same left arrow will active when you press to send you back to the left side while the same right arrow will be active to send you not to the mid side but to the right side,
    when moved to the right side the same left arrow will be active to send you to the mid and the right will not active when you press and depending on that,
    first how to make the large image appear with the three sides in the same place without effecting the other objects "like disappearing them" ?
    and the codes i need in the same left or right arrow symbol to make different actions with the same symbol when clicked depending on which part of the map is on.

  • FSRM reporting quote usage larger than the actual Size

    File server resource manager is reporting quote usage larger than the actual Size or even “Size on Disk”. The only theory I have so far is that the FSRM is counting data in Shadow Copy. Does FSRM count data in Shadow Copy?

    Hi,
    Please check if you turn on the NTFS file system compression functionality or if you compress the files that you own on an NTFS volume. If so, the disk quota that you are charged increases.
    Disk Quota Charges Increase If You Turn On the NTFS Compression Functionality
    http://support.microsoft.com/kb/320686/en-us
    Regards,
    Mandy
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • How can I print alphabet letters that are larger than 1 page?

    I need to print letters that are larger than 1 sheet of paper. How do I print across multiple pages?

    is another application.
    You should see it on the Dock, in Mission Control or be able to open it by typing Preview in Spotlight.
    It usually is the application that opens when you click on any image file or pdf.
    Just follow my instructions, copy and paste or drag and drop from Finder.
    You don't open the pdf, opening is for .pages, .doc, rtf or txt files that Pages can open as word processing files.
    You can alternatively:
    Menu > Insert > Choose… > browse to your pdf
    But the other methods are faster and easier.
    Peter

  • Navigate an image that is larger than the stage?

    Hello, I would like some assistance getting this to work. I'm not even sure if its possible, but I will be eternally grateful for an answer.
    I would like to have an image much larger than the stage, with little buttons all over it that play a MC when moused over. When the mouse reaches the edge of the screen, I want it to scroll so that the viewer can explore the whole image.
    In short, its a map with destinations, and on mouse over the destinations play a MC. I'd like the viewer to be able to "explore" the map with the mouse.
    It seems simple, is there a good way to do it?
    Also, once it is done, is there a way to begin with the entire image shown, but then have it tween to its final (Very large) size, without breaking that functionality.
    Thank you so much. This is for a class project and I'm trying to "go above and beyond" but, its a little to beyond for me.
    Kayla

    To make the image move, based on the mouse position you might do something like this:
    addEventListener(Event.ENTER_FRAME, checkMouse);
    function checkMouse(e:Event):void
         if(mouseX > 500){
              myImage.x -= 1;
         if(mouseY < 100){
              myImage.y += 1;
    That's just a simple example. You'll need to check the bottom and left too... and you'll need to stop your image from moving past its edges:
    if(myImage.x + myImage.width < theRightEdge){
         myImage.x = theRightEdge - myImage.width;
    to keep it from going too far left...
    I would also suggest using TweenLite to do your tweening. You can simply google TweenLite to find it.

  • How to import PDF image into Pages manuscript that is larger than the text bed margins

    How do I import a PDF image into a Pages book manuscript, whose dimensions are larger than the global text bed margins? Any imported PDF image is automatically shrunk to fit within the text bed. I know I can set up a single page with wider margins and a text bed within it, but I want the image to import to a page already within the manuscript sequence, where the text bed margins are set and constant.
    Larry Kettelkamp
    [email protected]

    By default it should be dragging in as a floating image and not part of the text.
    What version of Pages are you using?
    In Pages 5 this is:
    Format > Arrange > Object Placement > Stay on Page > Size > Original size
    Peter

  • In Cp5, can you record a window that is smaller than the project size?

    We would like to have a project that is sized larger than the application capture areas, in order to have a section to the side of the application captures that can be used for buttons, text boxes, and rollover objects for example. For example, the Cp project size may be 800x600, while the captured window size is 700x600. In Cp4, I can only capture at the size of the project. Is Cp5 different or does the capture size just have to equal the project size? Would this example require capturing at 700x600 and resizing to 800x600, while maintaining the backgorund image sizes and orienting the images left/right during resize? Has anyone done something like this and have a recommended way to accomplish it?

    Hello,
    Sorry to be a bit lazy, but it is late in the evening over here. Perhaps my blog post about Knockout Master slides could help? You will have to rescale anyway and I tried to explain some maths for the rescaling:
    Create and use a knockout master slide
    Lilybiri

  • Why is menu size so much larger than the files?

    I am somewhat perplexed - I'm making a single-layer dvd and have a simple single screen theme (no animation) - it has one drop zone. The movie has 28 chapters so there are five of them, but so far I've added only one montage of photos to each menu page - it's a "mobile" quality in media browser and ave only 10 - 20 MB, then one song. On average these movie clips are 1:00 to 2:00 min long and the music is cut to that length. So, all told, it's probably less than 110 MB in files - but when I look at the project properties, the menus are 3301 MB!!!
    The movie itself is only 1.1 GB so what is going on?
    It's preventing me from doing the project and I've got no idea why it's making the menu size so much larger than the file sizes?
    Can you please help me figure out what to do?
    Alexa

    The 2 min clips were natively 2 min - I had each one separate and actually converted to media browser in "mobile" size (b/c the drop zone was 4 x 6 in size in the theme). They were tiny - in most cases I was shortening the audio (e.g. the song was 4 minutes and I was setting the loop to only 1:30 b/c that's how long the video clip was on the menu).
    BUT, to resolve the question (I always like to post the answer) - I ended up duplicating the project to try to reimport the video. It was a fresh iDVD project and I happened to click on the project tree of screens - and, lo and behold, the ENTIRE menu was duplicated for some reason (and the movie, actually). I went back to the original and it was the same! I have no idea how that would happen do you? It only had one main menu screen - and then an entire duplicate menu - which I wouldn't even know how to access if I didn't see it in the project menu tree?
    The only think of is that at one point I added a title menu link to the scene selection - it gave me a warning that my menu was more than 12 minutes, did I want to fix or ignore and fix later - which confused me b/c it was under 12 min, then but I clicked ignore. Does that create an alternate title menu and send people back to something else?
    Anyway, I deleted the entire extra scene selection menus (5 of them) and it was back to under 4 GB.
    So, I was able to burn, but still wondering about creating the "title menu" link on scene selections? It drives me crazy that it doesn't automatically do that so I like to add "main menu" links.
    Thanks for your help!
    Alexa

  • How to capture a window in Safari that is bigger than the screen

    How do I capture a window in Safari that is larger than the screen it is displayed upon? I am using a MacBook PRO 13" with Mavericks.

    Try Paparazzi

  • Why would the display be larger than the screen?

    My Mac has started opening with a screen that is larger than the display. (I may not have the terminology quite right)  Here's a non-techie description...if the phyical display is 1680x1050, Finder or Safari open up at, say, 1720x1200. If I want to have the toolbar visible at the top, I cannot see the dock at the bottom. If I want the Apple to be at the top left corner, I cannot see the time at the top right. In both cases it is one or the other. Restarting has no effect on this annoyance.

    Try holding down control and scrolling down (or up, it depends). That should zoom down to fit. I assume you've checked the preferences to see that you have the right size selected.

  • IMac monitor desktop appears to be larger than the screen

    Went out to walk the dog and when i came back in the iMac monitor desktop appears to be larger than the screen size have tried to readjust in the display settings but nothing there helps.

    you have the Zoom feature turned on. Go to system preferences, Accesibility and turn it off.

  • When I print a photo to my epson printer, it comes out larger than the original photo - so the photo prints beyond the borders. Tried readjusting all sorts of things but nothing helps. I had this same problem with my Canon. any ideas?

    When I print a photo to my epson printer, it comes out larger than the original photo - so the photo prints beyond the borders. Tried readjusting all sorts of things but nothing helps. I had this same problem with my Canon. any ideas?

    Crop to the print size before pringing
    LN

  • I have an iphone 4s and when I try to connect it to my shared libraries; I get an icon of a circle that only fills up halfway.  I have an ipad and it connects to the shared library without a problem.  My library is much larger than the capacity of either

    I have an iphone 4s and when I try to connect to my shared library I see an icon of a circle that only becomes half full.  It does not connect.  I also have an ipad, which connects without incident. My itunes library is larger than the capacity of both devices, so that cannot be the issue.  How can I get the phone to connect with my shared library?

    My husband and I are using the same iTunes account on all mac & pc computers, but the libraries are different on each machine.  We always manually manage our music (no auto sync).  iTunes is up to date on the PCs.  My husband uses our joint iTunes account on his pc, but once again, has a different collection in his library from those on the other machines.  He can't load any music from his PC to his iphone 4.  I can load music from my mac library to my iphone 4s, but cannot load from my pc library to my iphone 4s.  How can I switch my main library that it syncs with from the mac to the pc?
    Thanks

  • Why has my screen re-sized so that it's approx. 1/4" larger than the frame.

    My screen is approx. 1/4" larger than the frame. I can move it left/right &amp; up/down by dragging the appropriate edge,but cannot get it centered on the frame. This. Just started this morning upon boot. Up.

    Go to settings>General>Accessibility>Zoom>Off. See if that does the trick for you.

  • I'm doing a timemachine backup of my current MBPro. The MBPro has aproximately 250 GB of content that is being "timemachine'd". My new SSD is only 128 GB, how do I restore the timemachine backup, when my old drive was larger than the new drive?

    I'm doing a timemachine backup of my current MBPro. The MBPro has aproximately 250 GB of content that is being "timemachine'd". My new SSD is only 128 GB, how do I restore the timemachine backup, when my old drive was larger than the new drive? Is there a way to pick what you want to restore or am I completely f***ed? I tried googling the answer but all i got was how to move the timemachine backup to another HDD. Sorry for the ******** question, thought I'd try here.
    Thanks for the help.

    I'm doing a timemachine backup of my current MBPro. The MBPro has aproximately 250 GB of content that is being "timemachine'd". My new SSD is only 128 GB, how do I restore the timemachine backup, when my old drive was larger than the new drive? Is there a way to pick what you want to restore or am I completely f***ed? I tried googling the answer but all i got was how to move the timemachine backup to another HDD. Sorry for the ******** question, thought I'd try here.
    Thanks for the help.

Maybe you are looking for

  • Video Capture: is this a good idea?  Also RAID 1 vs. 2 separate HDs

    Family videos on VHS. Original idea was to copy them all to DVD before the tapes degrade. Now thinking to capture the video on hard drives at the same time. This by taking video out of vhs/dvd combo unit (RCA connectors) into Canopus box, then via fi

  • Project no longer works after downloading AIR 3.4

    My AIR project built using sdk 3.5.0.12683 was all working fine with AIR 3.3, but now I've downloaded 3.4 it won't load. The background AIR window opens and that's it. Is there a way to reinstall AIR 3.3, while we try to find out what change in 3.4 i

  • Guidelines to create an optimized SQL queries

    Dear all, what is the basic strategy to create an optimized query? In the FAQ SQL and PL/SQL FAQ , it shows how to post a question on a query that needs to be optimized, but it doesn't tell how to with it. The Performance Tuning Guide for 11g rel 2 d

  • Service Purchase Orders extraction

    Can anyone please tellme where can I find the account assignment for each service line on a service Purchase Order? (not each item, but each service line associated to each item). I really need to find this because I need to extract data from one ser

  • My firefox restarts my PC all the time.

    Hello Guys My firefox restarts my PC all the time. It just hangs everything on the computer and restarts without stopping. What to do? I formatted my machine and I can not use firefox. It restarts my computer all the time, lock screens, freezes and s