Printing only one page problem

Hi,
I have a printable class that needs to print some text only on 1 page.
The thing is that when I hit print the printer prints 3 pages:
page 1 - with correct content
page 2 - empty page
page 3 - page with content translated some how
then the printing stops.
Here is the code:
private static final double FACTOR = 2.83;
private double width, height;
private void setupJob(){
          // page width and height
          width = 75*FACTOR;
          height = 50*FACTOR;
          job = PrinterJob.getPrinterJob();          
          pf = new PageFormat();
          //PageFormat pf =job.pageDialog(job.defaultPage());
          aset = new HashPrintRequestAttributeSet();
          // Create a letter sized piece of paper with one inch margins
          paper = new Paper();
          // resize the paper and the imageable area
          paper.setSize(width, height);
          paper.setImageableArea(0, 0, width, height);
          // set paper for the pageFormat
          pf.setPaper(paper);
          // set the job printable by calling the painter of this object with the pf pageFormat
          job.setPrintable(this, pf);
          job.setCopies(1);          
          // set the media printable area in mm
          aset.add(new MediaPrintableArea( 0f, 0f, 75f, 50f, MediaPrintableArea.MM));          
          try {
               job.print(aset);
          } catch (PrinterException e) {
               e.printStackTrace();
@Override
     public int print(Graphics g, PageFormat pf, int page)
               throws PrinterException {     
          if (page > 0) { // We have only one page
               return NO_SUCH_PAGE;
          }else{          
               Graphics2D g2d = (Graphics2D)g;
               // no translation needed
               // g2d.translate(11.34f, 0);
               // scale to fit page size
               double sx = 0, sy = 0;
               sx = width/(75*4);
               sy = height/(50*4);
               double scale = Math.min(sx, sy);
               g2d.scale(scale,scale);
               // draw the elements
               for (int i=0; i<4; i++){
                    texts.drawText(g);
          return PAGE_EXISTS;
Any help would be appreciated!
Thanks!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Solved myself

Similar Messages

  • Page breaks in form - can't print only one page?

    Hi guys
    This might be a really simple question - but how do I insert page breaks into my form?
    I have 8 pages in my document, and it is showing me this, so there seems to be no issue until I try to print only one page, and the whole document prints out.
    Is there an easy fix to this?
    Cheers
    Jess

    Hi,
    how are you printing? Control+P? File > Print? or a Print button?
    In any case the print command should bring up a print dialog, where you can set the pages that you want Acrobat to print. By default it is set to 'All' pages.
    Hope that helps,
    Niall

  • Photosmart C7280 locks up after printing only one page

    Recently, my Photosmart C7280 has started locking up after printing only about one page of any document. The LCD display just says, "printing....", and the only way I've found to clear it is to unlug the printer from the mains. It happily prints multiple copies of single page documents, but the only way to print muli-page documents is to do them one page at a time.
    I have the same problem from both my desktop and laptop.

    Thank you for the suggestion. unfortunately, it did not help with this problem. I ran the utility and it indicated that there were no problems with the printer.
    it seems likely to me that this is some sort of memory or buffering problem within the printer itself. However, I can't find any options on the printer's menu to clear the buffer or internal memory. I have tried 'restore factory settings' but this made no difference.
    The problem appears to be getting worse - while printing multiple copies of a single page document today, the printer locked up after just 3 copies. I had to rpint 20 copies by printing 3 copies several times over.
    Thanks,
    Anne

  • Hp laserjet 3500 printing only one page

    My HP Color Laserjet 3500 is printing but it only prints multiple pages of the first page of my document jobs.  It doesn't matter how many pages in the print job, it only prints multiple copies of just the first page of the job.  Even if it's just one page of a document, it still prints multiple pages of that document even when it set at 1 of 1 on the settings page.  Any suggestions???

    Try a reset of the printing system. This will remove the printer from Print & Scan but not the supporting driver, so you will just to have to add the printer again.

  • Adobe Reader 9 prints only one page

    We have a Windows lab that we just updated to Reader 9, and now are having problems with some PDF's and only being able to print the first page. We first uninstalled version 8 before installing 9, and all the computers were cast with Symantec Ghost and we are using Deep Freeze.
    It seems to be an issue with postscript printers, as we don't have the problem if you print to a file (XPS document writer) and then proceed to print from there. We've tested it with the IE plugin and also the application and still get the same result. The problem doesn't happen if you select "print as image" in the Adobe printing preferences. However, to set this as the default action it seems that you have to set it in the registry for every printer that is installed.
    Does anyone know of any fixes for this? Thanks.

    I've had the same problem.  I can no longer find the post, but what worked to solve the problem was to ...
    Under File
              Print
              Advanced Button
                   Change Font and Resource Policy : was to change this to "Send for Each Page".

  • Printing only first page

    --____FSVYRLDZXHAFLIWKCCOF____
    Content-Type: text/plain; charset=iso-8859-15
    Content-Transfer-Encoding: quoted-printable
    Greeitngs,=20
    We have numerous long pages - lists, lists and more lists -
    created in =
    DW8. Just about everyone here uses IE7, but we also have a
    few IE6 and =
    Firefox workstations.=20
    If a user tries to PRINT one of these long pages, such as
    this one:=20
    http://www.tsc.state.tn.us/geninfo/Programs/ADR/mediatorList.asp?chooseType=
    =3DGeneral+Civil&mnuCounty=3DAnderson&DisplayList=3DDisplay+List
    all they get is the first page of what ought to be six to
    nine print =
    pages.=20
    It gets weirder. On our index page,
    http://www.tsc.state.tn.us/
    if the =
    user tries to print it, the columns react differently. The
    center column =
    does not print past what fits ona printed page, while the
    right hand =
    column prints in its entirety. =20
    I've checked the CSS to see if there was a "don't print me"
    feature in any =
    of the CSS scripts, and there is not. the z-indexes appear to
    be ok. (the =
    two columns have the same z-index and are reacting
    differently to the =
    print command) =20
    My question(s) is(are): Can I better control the content of
    the page (the =
    two columns) and how? Is it CSS, html, or some other language
    that will =
    help me control this? Why is IE7 printing only one page of a
    multi-page =
    print job?=20
    Any ideas?
    NOTE: IE6 prints the entire page (multiple print pages). IE7
    and FF do =
    not.=20
    Peter
    --____FSVYRLDZXHAFLIWKCCOF____
    Content-Type: multipart/related;
    boundary="____RIVEUQBROELBXRGDYMGQ____"
    --____RIVEUQBROELBXRGDYMGQ____
    Content-Type: text/html; charset=windows-1252
    Content-Transfer-Encoding: quoted-printable
    <HTML><HEAD>
    <META http-equiv=3DContent-Type content=3D"text/html;
    charset=3Diso-8859-15=
    ">
    <META content=3D"MSHTML 6.00.6000.16525"
    name=3DGENERATOR></HEAD>
    <BODY style=3D"MARGIN: 4px 4px 1px; FONT: 10pt Tahoma">
    <DIV>Greeitngs, </DIV>
    <DIV>We have numerous long pages - lists, lists and
    more lists - created =
    in DW8. Just about everyone here uses IE7, but we also have a
    few IE6 and =
    Firefox workstations. </DIV>
    <DIV> </DIV>
    <DIV>If a user tries to PRINT one of these long pages,
    such as this one: =
    </DIV>
    <DIV> </DIV>
    <DIV><A href=3D"
    http://www.tsc.state.tn.us/geninfo/Programs/ADR/mediatorLis=
    t.asp?chooseType=3DGeneral+Civil&amp;mnuCounty=3DAnderson&amp;DisplayList=
    =3DDisplay+List">
    http://www.tsc.state.tn.us/geninfo/Programs/ADR/mediatorLi=
    st.asp?chooseType=3DGeneral+Civil&amp;mnuCounty=3DAnderson&amp;DisplayList=
    =3DDisplay+List</A></DIV>
    <DIV> </DIV>
    <DIV>all they get is the first page of what ought to be
    six to nine print =
    pages. </DIV>
    <DIV> </DIV>
    <DIV>It gets weirder.  On our index page,
    <A href=3D"
    http://www.tsc.st=
    ate.tn.us/">
    http://www.tsc.state.tn.us/</A> if
    the user tries to =
    print it, the columns react differently.  The center
    column does not =
    print past what fits ona printed page, while the right hand
    column prints =
    in its entirety.  </DIV>
    <DIV> </DIV>
    <DIV>I've checked the CSS to see if there was a "don't
    print me" feature =
    in any of the CSS scripts, and there is not. the z-indexes
    appear to be =
    ok. (the two columns have the same z-index and are reacting
    differently to =
    the print command)  </DIV>
    <DIV> </DIV>
    <DIV>My question(s) is(are): Can I better
    control the content of the =
    page (the two columns) and how?  Is it CSS, html, or
    some other =
    language that will help me control this? Why is IE7 printing
    only one page =
    of a multi-page print job? </DIV>
    <DIV> </DIV>
    <DIV>Any ideas?</DIV>
    <DIV> </DIV>
    <DIV>NOTE: IE6 prints the entire page (multiple print
    pages). IE7 and FF =
    do not. </DIV>
    <DIV> </DIV>
    <DIV>Peter</DIV>
    <DIV> </DIV>
    <DIV> </DIV></BODY></HTML>
    --____RIVEUQBROELBXRGDYMGQ____--
    --____FSVYRLDZXHAFLIWKCCOF____--

    Try one of these:
    1/ In Adobe, deselect "Choose Paper based on PDF size" - you can leave the "Auto Rotate and Center" on.
    2/ In Adobe, go into Advanced and choose "Print as Image".
    3/ If this is a Canon H1 Fiery RIP, go into Printer Properties, Printing Preferences, Layout, Rotate 180degrees and choose "Large Paper Only."

  • Need to Print only 1 Page

    Hi,
    I need to get print only one page..But my script is printing 2 pages. how to do this.
    I have one page in PAGES form.
    But still it is printing 2 pages..what could be the reason.
    Regards,
    Maruti

    Hi Maruti,
    You can achieve that by checking PAGE value inside your script window
    /:   IF &PAGE& EQ 1.
    /:   INCLUDE &T024E-TXADR& OBJECT TEXT ID ADRS LANGUAGE &EKKO-SPRAS&
    /:   ENDIF.
    /:   DEFINE &STREET&
    /:   DEFINE &STR_SUPPL1&
    /:   DEFINE &TEMP&
    /:   PERFORM GET_DATA_ADRC IN PROGRAM Z_RFFOUS_C
    /:   USING &LFA1-ADRNR&
    /:   CHANGING &STREET&
    /:   CHANGING &STR_SUPPL1&
    /:   CHANGING &TEMP&
    /:   ENDPERFORM
    /:   ENDIF.
    Reward points if useful
    ~Lakshmiraj~

  • How to setup a four page PDF in Adobe Acrobat 9 Pro to print only one of four pages?

    Hello,
    I have a request from a end-user to setup a four page PDF in Adobe Acroat 9 PDF to only allow printing of one specific page of the four page PDF.
    The end-user will abe able to view the four pages in the PDF - however - the PDF would only allow printing of one page.  The PDF would need to be pre-set for the end-user.  Is there a setting Adobe Acrobat 9 Pro to allow this type of specific pre-set printing.
    I appreciate your help.  I hope to hear from you soon.

    No, Acrobat can't do that.

  • Why do my email attachments open as only one page in Preview, I can't print multiple page documents

    Why do my emailattachments open as only one page in Preview? Multiple page attachments only will print as 1 page with very small  print?

    It's a Finder feature, related to Quick Look. You can hit the space bar in the file list to get a preview.
    If that doesn't work, you may have an issue witha  preference file or similar. I find rebuilding the launch databse works quite well resilving tis kind of thing, as does trashing Finder preferences

  • Photosmart All in one C4780 Printer prints only blank pages, connected to a MacBook Pro

    My Photosmart C4780 all in one printer which is connected by USB to my MacBook Pro OS 10.6.8 prints only blank pages, and no text; I have turned it on and off; disconnected and reconnected; uninstalled the HP software and reloaded and updated drivers, firmware and patches.  The scan function works and scans the document to my Mac.  The copy function also does not work; when I press the OK function next to the copy icon, nothing happens

    Hi mpmehta
    I understand you are not able to print in black and the copy function isn't working.
    I will be happy to assist you with this.
    Make sure the printer is connected directly to wall outlet. (don't use a power hub or a surge protector)
    Try and print a hardware self test on the printer to find out if it is a hardware or
    software issue. Click Here.
    I have included a document for not being able to print in black.
    Here is a document for the copy function not working.
    If you require further assistance please provide the following so I can assist you better.
    Did the configuration page print?
    Any black print on the page?
    What are the ink levels?
    Are you getting a error when trying to copy?
    Please let me know the results.
    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" on the right to say “Thanks” for helping!
    Gemini02
    I work on behalf of HP

  • Contact print , prints only one picture ??

    I am using Iphoto 08 , 7.1.3
    The contact sheet print , prints only one picture per page, although I chosed 4 rows .
    Help

    Ali:
    Can you describe, step by step, how you're setting up iPhoto to print in the contact sheet mode?
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto (iPhoto.Library for iPhoto 5 and earlier) database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    I've created an Automator workflow application (requires Tiger), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. It's compatible with iPhoto 6 and 7 libraries and Tiger and Leopard. iPhoto does not have to be closed to run the application, just idle. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.

  • HP 6510 printing only blank pages after changing print cartridges

    Hi,
    My HP 6510 is printing only blank pages after I installed new print ink cartridges. I tried cleaning the print heads, aligning the printer... which did result in some pages printing with a little color (but it seemed "off" to me). That said, when I try to print a regular document from my PC it only prints a blank page. 
    I can't seem to figure this one out on my own - please help!
    Thanks!
    Chloe

    The document here may help resolve black not printing on your Photosmart 6510.  Be sure the cartridges are vented as shown in solution two.
    Is your printer still in warranty? You can check with HP's warranty tool here.
    Bob Headrick,  HP Expert
    I am not an employee of HP, I am a volunteer posting here on my own time.
    If your problem is solved please click the "Accept as Solution" button ------------V
    If my answer was helpful please click the "Thumbs Up" to say "Thank You"--V

  • Palm Desktop 6.2.2: Can't print only one category in Month View

    I recently upgraded my palm desktop to 6.2.2 when I got a new PC with windows vista.  When I am in the month view of the calendar and I choose to print, it prints all categories regardless of which category I have selected in the onscreen display.  In my previous version of palm desktop running on windows XP I was able to print only a single category of appointmenets in the month view.  I think of this as a bug.  Is there any way to fix this? 
    Post relates to: Treo 650 (Sprint)

    I have the similar problem.  I have three separate calendars but when I try to print only one, the outcome is that the information in all three calendars gets printed as one.  I cannot find a fix.  HELP.
    Post relates to: Treo 755p (Sprint)

  • How can i print a one page spread sheet without having it spread over several sheets of paper none of which is complete?

    I have an iMac less than 1 year old with lion o/s and numbers. i have been spoiled in the printing of spread sheets on PC's. I find it impossible to print only 1 page when printing a single page spread sheet. The result is my spread sheet spread over several sheets of paper with no usable spread sheet printed. Can anyone help this 86 year old man who has been to the Apple Store twice to learn this but I still have trouble. Thanks in advance for your help. jim

    Jim,
    Take heart.  We can help.
    First turn on page view so you can see how the content of your sheet fits on the page(s).  A Numbers document contains sheets (listed on the left) which in turn contain tables, charts, text, and graphics.  Select the sheet you want to print on the left, then enable page view by selecting the menu item:
    "View > Show Print View":
    Now you should see your content and how it fits on one, or more, pages.  If thie content is too big for one page use the controls and the bottom left of the window to expose the sheet controls:
    Here a table is too big to fit on one page:
    slide the "Content Scale" slider so the content fits:

  • HP Photosmart all in one C309a printing multiple copies when its set to print only one copy.

    having issues with my C309a its now printing multiple copys when its set to print only one copy.it started doing this 4 days ago and its happening on both my Windows 7 64 bit computer and my Vista 32 computer that both have the latest release drivers already installed need help.HP please sort this issue out.still under warranty do i have to return it? 

    I am using a Motorola SBG900 Wirless Surfboard Gateway - supplied with Bigpond Cable. It is set to be using WPA security and have never had a problem with it before whilst connecting any wireless devices such as a laptop, PDA etc.
    My feeling is that the wireless functionality of this printer needs some serious work before the next release. And furthermore they should never have released it the way it is as it wouldn't pass 5% of user acceptance tests if using wireless. There are too many complaints on this forum and others about similar problems to suggest that I am not by myself here. Dissapointing considering this is the feature that would be at the top of the list of most purchasing this model. It lets down what could of been a vg printer.
    I agree, I think if I want to get this printer working on a wirless network, I will have to set the IP address manually. The problem is the printer refuses to connect to the router now even after it connected a few days ago with no intervention. I have powered down both the router, PC, and printer without any luck yet. I will set the IP address manually first on the printer and see how it goes, then if it connects will see if the PC/router can see the printer during the SW install procedure which has failed >10 times to date.
    For now I think I will stick with Ethernet as it is no doubt much faster anyway and will try the wirless setup again in a few days when my patience grows back. Does anyone know differences in speed between USB/Wireless/Ethernet? I know this is dependant on a number of things but just interested in ball park figures here.

Maybe you are looking for

  • Photoshop- Batch tool missing in Bridge?

    My Photoshop-> Batch is missing from the bridge tools menu?  And when I go into Photoshop to automate->Batch I can't choose Bridge as a source. It is there, but it is not in bold(i.e.cannot be selected.) I have checked my Bridge->Preferences-> Start

  • Icc profiles for aperture book printing...

    Do the Aperture Book Printing folks provide icc profiles so I can soft-proof the images beforehand?

  • CPU in Quicksilver 2002

    I have an Apple Quicksilver G4 and im currently using a Sonnet 1.67ghz CPU w/ 512 L2 Cache and I just ordered a Sonnet 1.0ghz CPU w/ 256 L2 and a 2mb L3. What one is better?

  • Error when downloading application from Server

    Hi, I have installed MI Client 7.0 SPS 11 Patch 0 on Symbol Device ;OS Windows Mobile5.0 i have successfully completed <b>first</b> synchronization . After that i assigned Mobile Component to the device and tried synchronizing. "Error when downloadin

  • Problem with embedded images in emails

    After downloading OS X Yosemite onto my Mac , the images embedded in my emails have now turned to question marks. How do I re-instate ?