Does somebody know how to print? If  yes, could you help me?

Please help me with printing data on printer.
Could somebody answer me why data duplicates on second, third and othes pages?
How to make this code print all data on all pages correct?
import java.awt.Graphics2D;
import java.awt.Graphics;
import java.awt.print.PrinterException;
import java.awt.print.Printable;
import java.awt.print.PageFormat;
import java.awt.print.PrinterJob;
public class PrintDataTest implements Printable{
     public static void main(String[] args){
          PrintDataTest pdt=new PrintDataTest();
     public PrintDataTest(){
          str_array0=new String[500];
          for(int i=0;i<str_array0.length;i++){
               str_array0=String.valueOf(i);
          try{
               PrinterJob job=PrinterJob.getPrinterJob();           
               job.setPrintable(this);
               if(job.printDialog()){
     job.print();
catch(PrinterException e){
     e.printStackTrace();
     public int print(Graphics g,PageFormat pf,int pages)throws PrinterException{
          int X=10,Y=10;
          int pageCount=(int)Math.ceil(str_array0.length/43);
          System.out.println((int)Math.ceil(str_array0.length));
          System.out.println(pf.getImageableHeight());
          System.out.println((int)Math.ceil(str_array0.length/pf.getImageableHeight()));
          if(pages>=pageCount)return Printable.NO_SUCH_PAGE;
          Graphics2D g2=(Graphics2D)g;
          g2.translate(pf.getImageableX(),pf.getImageableY());
          for(int i=0;i<str_array0.length;i++){
               g2.drawString(str_array0[i],X,Y);
               Y+=16;
          return Printable.PAGE_EXISTS;
     private String[] str_array0=null;

Geez, I think the javax.print API looks easier than this stuff:
http://www-128.ibm.com/developerworks/java/library/j-mer0322/
%

Similar Messages

  • Does anyone know how to print a text message from a bill?

    Does anyone know how to print text messages from a phone bill or view them?

    There might third party apps or iTunes or iCloud options to backup the text messages from the Apple phone itself. Then you can print the contents of the messages from the backup.
    There are similar applications for Android devices as well.

  • Does somebody know how to get to the desktop via hot corners whilst being in full screen mode? it doesn't work on my mac... :/ thx for helping!

    does somebody know how to get to the desktop via hot corners whilst being in full screen mode? it doesn't work on my mac... :/ thx for helping!

    bump

  • Does somebody know how to synch Windows Live calendar (ie the Hotmail one) with Calendar (Mountain Lion)?

    Does somebody know how to synch Windows Live calendar (ie the Hotmail one) with Calendar (Mountain Lion)?

    You will need to selct other at the bottom and then put in your hotmail.
    alternativly read this ms forum http://answers.microsoft.com/en-us/windowslive/forum/hotmail-calendar/ical-and-h otmail-calendar-sync-setup/2086d109-d763-40aa-9e1b-0eae8b8b3596
    Ryan

  • Does anyone know how to print from my pad to my desktop?

    does anyone know how to print from my pad to my desktop?

    A desktop is not a printer. Your question is not clear. Explain what you are trying to do.
    iOS AirPrint Printers  http://support.apple.com/kb/HT4356
    How to Print from Your iPad: Summary of Printer and Printing Options
    http://ipadacademy.com/2012/03/how-to-print-from-your-ipad-summary-of-printer-an d-printing-options
    Print from iPad / iPhone without AirPrint
    http://ipadhelp.com/ipad-help/print-from-ipad-iphone-without-airprint/
    How to Enable AirPrint on a Mac and Use Any Printer
    http://ipadhelp.com/ipad-help/how-to-use-airprint-with-any-printer/
    iPad Power: How to Print
    http://www.macworld.com/article/1160312/ipad_printing.html
    Check out these print apps for the iPad.
    Print Utility for iPad  ($3.99) http://itunes.apple.com/us/app/print-utility-for-ipad/id422858586?mt=8
    Print Agent Pro for iPad ($5.99)  http://itunes.apple.com/us/app/print-agent-pro-for-ipad/id421782942?mt=8   Print Agent Pro can print to many non-AirPrint and non-wireless printers on your network, even if they are only connected to a Mac or PC via USB.
    FingerPrint turns any printer into an AirPrint printer
    http://reviews.cnet.com/8301-19512_7-57368414-233/fingerprint-turns-any-printer- into-an-airprint-printer/
     Cheers, Tom

  • Does somebody know how to configurate iphone without usin itunes or wifi? coz its  not workin for me

    does somebody know how to configurate iphone without usin itunes or wifi? coz its  not workin for me

    slonecznik wrote:
    The error number computer just showed me once n now all the time it say we cant activate your iphone at the moment. try again later.
    Resolve iOS update and restore errors

  • Since I use Mac os x mountain lion it is no more possible to share files with my pc windows 7. Does somebody know how to solve this problem?

    Since I use Mac os x mountain lion it is no more possible to share files with my pc windows 7. Does somebody know how to solve this problem? I have been answered by an Apple technician that with the new Mountain Lion the problem was with Windows. I am not convinced.

    I have renamed my pc and everything is ok with the file sharing SMB. Both my iMac and my pc can share files very easily.

  • I need to erase the contents of my phone and restore to factory settings. Does anybody know how to save your texts so you don't lose them?  Can I back those up to iCloud?  My phone was very likely hacked (Apple's advice was to call the police!)

    "I need to erase the contents of my phone and restore to factory settings. Does anybody know how to save your texts so you don't lose them?  Can I back those up to iCloud?  My phone was very likely hacked (Apple's advice was to call the police!)"
    That was all I could put in the initial "box."  Then it brought me to this page with instructions on how to write a good sentence.
    Proceeding ...
    After going back and forth between Apple, AT&T and the police (all telling me to go to the other two) I took AT&Ts suggestion and got a new number. One tech warned against doing a backup, especially on my Mac, saying if my phone had been hacked then whatever bug was there would then invade my computer. But nobody knows how to determine if the phone has been hacked or a virus was planted there. Unfortunately I know who would have reason to do such a thing and all I can say is that he is at the top technologically and could easily do it. Almost impossible to prove, however.
    So I need to preserve my text messages and my emails as well. I backed up my photos to that Microsoft product (One-Drive) and it froze (Surprise, Surprise) with four short videos to go, and no way of stopping that (when I tried it crashed repeatedly) so I'm in crisis mode here.
    Help ...
    Running 8.0 on 5S
    Thanks!

    Betty I don't know if you fixed your hacking problem but I feel your pain. I've seen some strange things going on between my iMac and my iPhone and Apple has told me the same thing, call the police which I have done. The hackers have stole 500.00 out of my checking account have access to every internet account I use and no matter how often I change the password their right back on the account. I closed my FB account 3 times only to have someone reopen it. Right now I've got a link in my reading list (Safari) that if I click on it, it allows me to log onto my FB account anonymously.
    I've seen a green folder come out of no where while I was trying to delete my passwords out of keychain when that green folder was put into the key chain I was immediately locked out. I than went into system preferences to try to make changes to my security settings, when I clicked on the icon it wouldn't open. I've seen log files of automator receiving commands and sending out my personal information thats on my computer.
    I have a legitamate program called iExplorer that allows you to look at the contents of your iPhone back ups and saw a transaction someone made at the Apple store for some full length movies, some albums, ibooks and other apps but when I called the iTunes store and they said none of those items were showing up on my account. If their not on my account how can they be on my iPhone 6? One day someone was using my gmail account and unknowingly used google maps to search for an Italian restaurant, than a Mexican restaurant than a coffee shop and their search showed up on my iPhone but I didn't have my gmail account installed on my iPhone 6. Using my computer I logged onto my gmail account and looked at the maps history and sure enough there were the searches when I'd hover my curser over the link it gave me the longitude and latitude of the where the hacker was when he was using google maps. I know whoever reads this thinks Im crazy but I've documented everything and can prove the things that I have mentioned in this post actually happened.
    One day I had my laptop (pc) and my iMac next to each other as I was using both. when I clicked on airport it showed that my laptop and my iMac had made a connection and were actually communicating with each other. I know I didn't do it I don't know how. The iMac was logged into my iCloud account while my laptop wasn't. I have formatted my iPhone at least a dozen times, Apple and an Apple retailer have formatted my hard drive not to mention the numerous times I have formatted it but the hackers keep getting on my devices. Im formatting my lap top at this very second because during the course of the night I left the ethernet cable plugged into it and they locked me out of my c: drive, and configured the system so I can't download any updates from Microsoft, overtime I type in www.microsoft.com it changes to ww38.microsoft.com which takes me to a blank page. I right clicked on the page I was redirected to and read the java script and couldn't believe that someone had actually configured Internet Explorer to redirect me to a blank page when I tried to go to Microsoft. Apples answer to all this is there was nothing wrong with my iPhone or my iMac and if I thought there was a problem to call the police which I have done.
    Theres no doubt the hackers are reading this while I type it or will read it and I simply don't care anymore. I no longer email anyone, don't use my iCloud account and have taken precautions to protect my credit but if I ever find out who has invaded my privacy to this extreme the police are going to want to talk to me because Im going to hurt them like they've never been hurt before

  • After the new update of the latest iOS, I noticed a yellowish color on the sides of my iPhone 5 screen (Top,Down,Left,Right). Does anyone know how to fix this? Thank You.

    After the new update of the latest iOS, I noticed a yellowish color on the sides of my iPhone 5 screen (Top,Down,Left,Right). Does anyone know how to fix this? Thank You.

    It is highly unlikely that any iOS update could cause this.
    Try a restore as new, if the problem persists, take the device to Apple for evaluation.

  • Does anyone know how to unlock an IPAD, if you forgot th passcode

    Does anyone know how to unlock an Ipad, if you have forgotten the passcode.

    Follow the steps in http://support.apple.com/kb/HT1212 and you may need to it more than once.

  • Does anybody know how to print a document from a ipad2 to a C6380 wireless all in one

    I have just bought an ipad2 and a first time user. i want to print from my ipad2 to the hp C6380 wireless printer. Does anybody know how to do this with out some kind of special app? right now  the pages app does not see the printer.

    As well, you may install the HP iPrint Photo App, which is through the App Store, however it provide functinality to print images rather than documents..
    For more information of the App, please follow
    http://www8.hp.com/us/en/products/smart-phones-han​dhelds-calculators/mobile-apps/app_details.html?ap​...
    Say thanks by clicking the Kudos thumb up in the post.
    If my post resolve your problem please mark it as an Accepted Solution

  • Does anyone know how to edit your profile if you have more than one apple device but only 1 email address?

    Hi I am trying to update my email address since I quit work and left my work email address behind.  I now only have one email address, but an iphone and ipod classic and want both of them to use the same email address - but am having problems using the address for my iphone as it is already attached to the ipod classic.  Does anyone know how I fix this??
    thanks
    Jenny

    My profile: bookmarks - I added one of someone that did manage, it does take planning.
    take a look and good luck, it is not supported or standard but can be done.
    NTFS and HFS drivers to write back and forth may be easier and better though.
    or 2nd hard drive - and use NTFS along with HFS driver as needed.

  • Does anyone know how to print in color on a pages on Pages on a MacBook Pro?

    I have a project that I need to print out, and I recently just got a MacBook Pro, so I'm not 100% acquainted to Pages. SO PLEASE HELP!!!!

    Any application can print in color, which is the default, if a color-capable printer is configured and accessible by the Mac. It is no different than printing in B/W.
    Just make sure the printer is set up correctly so the Mac knows what it can do and how to drive it. If you want more help in the set up department, you'll have to provide more info as to what printer(s) you have.

  • Does anyone know how to print out a premiere timeline to use as a shooting board?

    I've put together an animatic in Premiere. What I'd like to do is print it out now as some kind of shooting board. So premiere could take one frame from each clip and print them out in order... Is that remotely possible? Does anyone know if there's a plugin that can do this kind of thing?
    Thanks in advance for any replies...
    Olly

    Ann is correct, of course. Unless...
    It depends on exactly what you have and where you want to go with it. It is possible to just export to a series of images from the sequence. Then just use Bridge to find the exact frame you want and copy, or move it, to a different directory. Or use Lightroom and create a Collection. Then print them as desired.
    I can't determine your experience level, so if you have questions about what I just wrote, please ask them. I don't want you accusing me of filling up your hard drive.
    Basically, I am suggesting that if you have the hard drive space, export to TIF, or PNG or JPG. Just be aware that the files sizes can be unreasonably large. A TIF of a 1920X1080 frame just came out to 7.92MB for me, while the JPG was only 920KB. If you have the drive space, and it can be an external drive if you have the time to wait, you would end up with a huge folder full of images, but with Adobe Bridge, if the differences in the images were easy enough to see as you scroll through them, you could pick out the ones you want and it would certainly be faster than exporting each one individually.
    One way to cut down on the number of pictures would be to nest the sequence, then change the speed of the sequence to 1000%. That way you get every tenth frame. If that is sufficient for your needs (kind of depends on the footage, I suppose) then you get 1/10th the number of images exported.
    I am a bit of a lazy guy, always looking for the easy way out. And if you have the drive space, believe me, this is the lazy way to do it.

  • Does anyone know how to print a selection on macbook air?

    is it possible to print only a selection of a page?

    Any application can print in color, which is the default, if a color-capable printer is configured and accessible by the Mac. It is no different than printing in B/W.
    Just make sure the printer is set up correctly so the Mac knows what it can do and how to drive it. If you want more help in the set up department, you'll have to provide more info as to what printer(s) you have.

Maybe you are looking for