Printing in blank on linux

My application use Java Print Service, prints well in windows, but in linux it only prints blank.
Please Help me !!!
This is example code
import java.awt.geom.*;
import java.awt.font.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.print.PrinterJob;
import java.awt.event.*;
import java.awt.*;
import java.awt.print.*;
import javax.print.attribute.HashPrintRequestAttributeSet;
import javax.print.attribute.PrintRequestAttributeSet;
public class ShapesPrint extends Panel implements Printable, ActionListener {
     final static Color bg = Color.white;
     final static Color fg = Color.black;
     final static Color red = Color.red;
     final static Color white = Color.white;
     final static BasicStroke stroke = new BasicStroke(2.0f);
     final static BasicStroke wideStroke = new BasicStroke(8.0f);
     final static float dash1[] = { 10.0f };
     final static BasicStroke dashed = new BasicStroke(1.0f,
               BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 10.0f, dash1, 0.0f);
     final static Button button = new Button("Print");
     public ShapesPrint() {
          setBackground(bg);
          button.addActionListener(this);
     public void actionPerformed(ActionEvent e) {
          if (e.getSource() instanceof Button) {
               PrinterJob printJob = PrinterJob.getPrinterJob();
               PrintRequestAttributeSet pg = new HashPrintRequestAttributeSet();
               printJob.setPrintable(this);
               if (printJob.printDialog(pg)) {
                    try {
                         printJob.print(pg);
                    } catch (Exception PrintException) {
                         PrintException.printStackTrace();
     public void paint(Graphics g) {
          super.paint(g);
          Graphics2D g2 = (Graphics2D) g;
          drawShapes(g2);
     public void drawShapes(Graphics2D g2) {
          Dimension d = getSize();
          int gridWidth = 400 / 6;
          int gridHeight = 300 / 2;
          int rowspacing = 5;
          int columnspacing = 7;
          int rectWidth = gridWidth - columnspacing;
          int rectHeight = gridHeight - rowspacing;
          Color fg3D = Color.lightGray;
          g2.setPaint(fg3D);
          g2.drawRect(80, 80, 400 - 1, 310);
          g2.setPaint(fg);
          int x = 85;
          int y = 87;
          //draw Text Layout
          FontRenderContext frc = g2.getFontRenderContext();
          Font f = new Font("Times", Font.BOLD, 24);
          String s = new String("24 Point Times Bold");
          TextLayout tl = new TextLayout(s, f, frc);
          g2.setColor(Color.green);
          tl.draw(g2, x, y - 10);
          // draw Line2D.Double
          g2.draw(new Line2D.Double(x, y + rectHeight - 1, x + rectWidth, y));
          x += gridWidth;
          // draw Rectangle2D.Double
          g2.setStroke(stroke);
          g2.draw(new Rectangle2D.Double(x, y, rectWidth, rectHeight));
          x += gridWidth;
          // draw  RoundRectangle2D.Double
          g2.setStroke(dashed);
          g2
                    .draw(new RoundRectangle2D.Double(x, y, rectWidth, rectHeight,
                              10, 10));
          x += gridWidth;
          // draw Arc2D.Double
          g2.setStroke(wideStroke);
          g2.draw(new Arc2D.Double(x, y, rectWidth, rectHeight, 90, 135,
                    Arc2D.OPEN));
          x += gridWidth;
          // draw Ellipse2D.Double
          g2.setStroke(stroke);
          g2.draw(new Ellipse2D.Double(x, y, rectWidth, rectHeight));
          x += gridWidth;
          // draw GeneralPath (polygon)
          int x1Points[] = { x, x + rectWidth, x, x + rectWidth };
          int y1Points[] = { y, y + rectHeight, y + rectHeight, y };
          GeneralPath polygon = new GeneralPath(GeneralPath.WIND_EVEN_ODD,
                    x1Points.length);
          polygon.moveTo(x1Points[0], y1Points[0]);
          for (int index = 1; index < x1Points.length; index++) {
               polygon.lineTo(x1Points[index], y1Points[index]);
          polygon.closePath();
          g2.draw(polygon);
          // NEW ROW
          x = 85;
          y += gridHeight;
          // draw GeneralPath (polyline)
          int x2Points[] = { x, x + rectWidth, x, x + rectWidth };
          int y2Points[] = { y, y + rectHeight, y + rectHeight, y };
          GeneralPath polyline = new GeneralPath(GeneralPath.WIND_EVEN_ODD,
                    x2Points.length);
          polyline.moveTo(x2Points[0], y2Points[0]);
          for (int index = 1; index < x2Points.length; index++) {
               polyline.lineTo(x2Points[index], y2Points[index]);
          g2.draw(polyline);
          x += gridWidth;
          // fill Rectangle2D.Double (red)
          g2.setPaint(red);
          g2.fill(new Rectangle2D.Double(x, y, rectWidth, rectHeight));
          g2.setPaint(fg);
          x += gridWidth;
          // fill RoundRectangle2D.Double
          GradientPaint redtowhite = new GradientPaint(x, y, red, x + rectWidth,
                    y, white);
          g2.setPaint(redtowhite);
          g2
                    .fill(new RoundRectangle2D.Double(x, y, rectWidth, rectHeight,
                              10, 10));
          g2.setPaint(fg);
          x += gridWidth;
          // fill Arc2D
          g2.setPaint(red);
          g2.fill(new Arc2D.Double(x, y, rectWidth, rectHeight, 90, 135,
                    Arc2D.OPEN));
          g2.setPaint(fg);
          x += gridWidth;
          // fill Ellipse2D.Double
          redtowhite = new GradientPaint(x, y, red, x + rectWidth, y, white);
          g2.setPaint(redtowhite);
          g2.fill(new Ellipse2D.Double(x, y, rectWidth, rectHeight));
          g2.setPaint(fg);
          x += gridWidth;
          // fill and stroke GeneralPath
          int x3Points[] = { x, x + rectWidth, x, x + rectWidth };
          int y3Points[] = { y, y + rectHeight, y + rectHeight, y };
          GeneralPath filledPolygon = new GeneralPath(GeneralPath.WIND_EVEN_ODD,
                    x3Points.length);
          filledPolygon.moveTo(x3Points[0], y3Points[0]);
          for (int index = 1; index < x3Points.length; index++) {
               filledPolygon.lineTo(x3Points[index], y3Points[index]);
          filledPolygon.closePath();
          g2.setPaint(red);
          g2.fill(filledPolygon);
          g2.setPaint(fg);
          g2.draw(filledPolygon);
     public int print(Graphics g, PageFormat pf, int pi) throws PrinterException {
          if (pi >= 1) {
               return Printable.NO_SUCH_PAGE;
          Graphics g2 = button.getGraphics();
          button.printAll(g2);
          drawShapes((Graphics2D) g);
          return Printable.PAGE_EXISTS;
     public static void main(String s[]) {
          WindowListener l = new WindowAdapter() {
               public void windowClosing(WindowEvent e) {
                    System.exit(0);
               public void windowClosed(WindowEvent e) {
                    System.exit(0);
          Frame f = new Frame();
          f.addWindowListener(l);
          Panel panel = new Panel();
          f.add(BorderLayout.SOUTH, panel);
          f.add(BorderLayout.CENTER, new ShapesPrint());
          panel.add(button);
          f.add(BorderLayout.SOUTH, panel);
          f.setSize(580, 500);
          f.show();
}

Hi,
Make sure that you have printer has been installed properly on your linux desktop.
On SAP, using SPAD tcode, you can set output device using access method G : Frontend printing with control technologie. This is easiest way.
You can also use access method S or U for better printing method. Please refer to my blog posting here (http://sapbasis.wordpress.com/2007/08/23/print-sap-documents-using-linux/)
ardhian
http://sapbasis.wordpress.com

Similar Messages

  • Printing from SAP on Linux

    I am unable to print reports from SAPGUI on linux platform. I am using Fedora 13. I am able to print documents from other applications like Openoffice Writer & all other application. But when I am trying to print reports from SAP, It's showing blank page. I am also unable to see print preview in SAP. The printer I am using is HP 1020 Laserjet.
    Can somebody help me?
    Thanks in advance,
    Srinivas

    Hi,
    Make sure that you have printer has been installed properly on your linux desktop.
    On SAP, using SPAD tcode, you can set output device using access method G : Frontend printing with control technologie. This is easiest way.
    You can also use access method S or U for better printing method. Please refer to my blog posting here (http://sapbasis.wordpress.com/2007/08/23/print-sap-documents-using-linux/)
    ardhian
    http://sapbasis.wordpress.com

  • How to avoid printing a blank page when there is 'no data' in the report.

    how to avoid printing a blank page when there is 'no data' in the report.

    try like this
    if@section:IND=1
    this template
    end ifsectionbreak
    if@section:IND=2
    this template
    end if

  • BI Publisher - if page number is not divisible by 2 then print a blank page

    Hi,
    I have an BI Publisher rtf word template. I want to be able to print a blank page if the page number is not divisible by 2. Does any body know how this can be done? Your input is greatly appreciated and thank you so much in advance.
    MT
    Edited by: user11177994 on Mar 29, 2010 8:19 AM

    Hi Dominic,
    Thank you for the link. The problem that I have is when the job specification last page prints on the front of the page, and the next job specification prints on the back of that page. There is no way I can control what page it is going to print on. This is depending on how much description the user puts in. Any suggestion is greatly appreciated.
    I do have another issue too, and you maybe able to help me with this. Below is a list of form fields on my template. When the job specification is printed on more than one page, I could not get the fk_job_title to print on the continuous pages. Is there a way I can code this fk_job_title to print on all of it's continuos page? I have tried many different ways but could not get it to print. I also posted this in the forum, but didn't get any respond.
    ** form fields **
    CLASS TITLE: F fk_job_title PAY GRADE: p_grade
    JOB CODE: job_code SALARY RANGE: s1 - s2
    LOCATION OF WORK: work_location
    GENERAL DESCRIPTION: general_descr
    ESSENTIAL WORK TASKS: work_task
    KNOWLEDGE, SKILLS, AND ABILITIES: knowledge_skill
    EDUCATIONAL AND EXPERIENCE: education_exp
    SUBSTITUTIONS: sub
    CERTIFICATIONS/LICENSES: certification_license
    OTHER JOB ASPECTS: job_aspect E
    PB
    Thank you so much,
    MT

  • My HP LaserJet 1018 has started printing only blank pages.

    My HP LaserJet 1018 has started printing only blank pages. 
    Help?
    Using Windows XP (Home Version)
    Product # CB419A

    Could be a number of issues.  First could be a bad or not connecting transfer rollers which moves the toner from the drum to the paper.  Only way to test is a half test by putting paper on the manual tray and printing a self test.  When the back edge enters the printer, open the toner door to stop printing.  Remove the toner and flip back the cover over the toner drum to see if there is any image on the drum.  If image is present then it could be transfer roller issues.  Use the service manual and look under engine diagnostics in the index and it will direct you to a page that shows how to perform an engine test.  Do the test to see if you get a sheet of paper with lines on it.  If you get lines, then the issue could be the formatter.  If no lines and the shutter has been removed then I would think you are having high voltage issues.  You may have to bring the printer in for service.

  • Default filename for print to file in Linux

    Hi,
    I'm using print to file in Linux, and I'd like the default filename to be the page title. I couldn't find a config option for this. It retains the last file name I used, which is very problematic for me, as I can easily overwrite my last printed file by accident.
    I'd also like the printer to default to print to file. Is that possible? Not a big deal, but it would save me a click. :-)
    BTW, I've found that the print to file for PDFs is excellent. It often produces PDFs that half the size of other options I've tried. Thank you!
    Ari

    This is not solved as I do not know where to change the default directory.

  • HP7680 inkjet printer prints narrow blank (white) lines in multiple specific parts of page

    My HP7680 inkjet printer prints narrow blank (white) lines in multiple specific parts of each printed page. It appears to happen in the same parts of each page printed.
    - I installed new ink cartridges
    - I verified that the paper I’m using is the standard inkjet paper that I always use
    - In the tools section of the printer setup menu, I ran the “Clean Printhead”, “Align Printer”, and “Calibrate Linefeed” options
    - In reading the printer’s manual, it seems to imply that the printheads could be the problem.
    - So, I manually cleaned the printhead contacts
    - When I print the self-test diagnostics page, it shows printhead health to be “Good” for both. One of them was installed in January of 2009, and the other was installed March of 2008.
    - With a Q-tip, I even cleaned the clear plastic band that runs parallel to the carriage rod. (It was pretty dirty.)
    Here's a scan of the printed output.
    Thanks for your help!

    After a 2hr phone call with tech support, here is the solution; the L7600 Series printer have a firmware update (file name: OfficejetProK7600_R2011PxN.exe) my printer was bought in 2008 thus my print head is a 2008 model, and new print heads are a 2011 modem, they don’t work right in a 2008 model this is PER the tech rep and his name was John unless you upgrade the firmware.
    So I upgraded the firmware from a 2004NxN to the 2011PxN and now my printer says damaged or missing print head, I place the original print head from 2008 back in the machine and it’s fine, so I bought a 3rd print head for 2011 and it says the print head is damaged.
    After another 30min or so I was told I have a bad printer and sorry the warranty is out, but the old print head works but any new print heads do not, this sounds like a HP Error firmware / hardware compatibility issue, not my issue, but HP will not repair.
    HP has no fix nor will they repair the printer.

  • MS Word prints only blank document

    I rarely use MS Word anymore. I use Mellel - except Word (10) does such an easier job with tables.
    I created a two-page table.
    It prints out blank. I tried 3X, it would not print to pdf even.

    This forum is for questions about the Communities themselves. Since this question is about a Microsoft product, you might have more luck getting suggestions if you ask in Microsoft's own forums.
    Good luck and regards.

  • When i print from internet it only prints a blank document

    when i print from internet it only prints a blank document.....whats up with that?

    Neither of your posts answer the question What Browser are you using. Those are the OS version of the model of Mac you have.

  • Need to avoid printing of blank lines at end of report

    Hello friends at www.oracle.com ,
    after printing, any report is sending some blank lines, moving paper up. It pushes printing of next page to some lines below, causing other reports to begin printing much under the correct position, and it's propagating to other reports I print later.
    How can I print a report and avoid printing those blank lines below?
    Printer that's being used is an Epson LQ-570+.
    Thanks, and best regards,
    Franklin Gongalves Jr.

    Hi Franklin,
    What version of Reports are you running? Also, is this a character mode report?
    Toby

  • HP L7680 printing extra blank pages

    I had repeated issues with LHP 7680 printing extra blank pages.  Tried the "new driver" fix and that didn't work.  Found the fix:  Go to Start, Control Panel, Printers and Faxes, RIGHT CLICK the L7680 Printer, click on Properties, click on Advanced tab.  "Spool print documents...." is selected.  Change the selection to PRINT DIRECTLY TO PRINTER.  Tested and resolved the issue when printing Word and Excel docs

    Try this...
    1. Go to the Printers folder and right click on the printer icon, then select ‘Run as Administrator’, and select ‘Properties’.
    2. Click on the ‘Advanced’ tab, and click on the ‘New Driver’ button.
    3. When you have to select the printer driver, select the ‘Have Disk’ button and point it to the installation CD or the ‘7zSxxx’ folder and install it from here. Or you can look under the ‘Manufacturers’ list and select ‘Hewlett-Packard’ instead of ‘HP’, and then select the appropriate printer driver.
    4. Complete the wizard, then apply the settings by pressing the ‘Apply’ button. Try printing again, and the issue should not reoccur.
    Also, are you using Windows Vista?
    Make it easier for other people to find solutions, by marking my answer with \'Accept as Solution\' if it solves your problem.
    Click on the BLUE KUDOS button on the left to say "Thanks"
    I am an ex-HP Employee.

  • Forms that previously worked, print a blank first page.

    I have numerous forms that were created in LiveCycle Designer 8 that worked perfectly, but suddenly they all are printing a blank first page.  When I am in LiveCycle in the Design view, I am able to print both pages but when I go to the Preview PDF view, the first page is blank on print preview.  I'm stumped. There are no security settings around printing.  Any help would be greatly appreciated.

    This seemed to be a property that is causing an additional page to be printed.. If you can send the form to [email protected] , I can have a look at it..
    Thanks
    Srini

  • My psc2115 only prints a blank page except from toolbox in diag mode

    hi any one with an suggestions please, i have a psc 2115 all in one it goes through the motions for printing but only prints a blank page except from the laptop on a network share,  iv tried new drivers, tried microsoft fixit, tried the hp diag software, still not working, its just printing a plain page, in print preview it shows the page that its gonna print then prints a plain page. tried all the hp support and the MS technet and it still dosent work , on the network share it only works from the wifes laptop (win 7) it prints ok. on my workstation (xp pro) it prints from the toolbox diag screen it will print a diag test page. ive un-installed and reinstalled the driver iv rest factory settings, im out of ideas fro the moment, any ideas please

    Hello Burnhug 54,
    Thanks for the post.  With this one, I've included a document below that should assist with this one.  It was some very good basic t-shooting tips.  If after going through these steps, you are still getting blank pages, then be sure to check your driver from control panel and from one of your applications.  Ensure that it is indeed the PSC2115.  Good Luck!
    http://h10025.www1.hp.com/ewfrf/wc/document?docname=c01892627&cc=us&dlc=en&lc=en&product=91430&tmp_t...
    http://h10025.www1.hp.com/ewfrf/wc/document?docname=buu05210&tmp_task=solveCategory&cc=us&dlc=en&lan...
    I worked for HP but my posts and replies are my own....Thank you!
    *Say thanks by clicking the *Kudos!* which is on the left*
    *Make it easier for other people to find solutions, by marking my answer with (Accept as Solution) if it solves your issue.*

  • HP c4280 printing out blank pages

    No matter whether it is color or black, it prints completely blank pages. It sounds like it is doing the print job, but comes out blank. This printer has not been used in 3 or 4 months, but I know the cartridges have ink in them. Is it possible that I need fresh cartridges or could this be caused by something else?
    Thanks

    I forgot to add that im using windows vista home basic and this is the first time using the printer on this computer. I did install the drivers though.

  • LR 4 only prints a blank page on Epson 2880. Print preview panes remain blank. Window 7 OS. Need help desperately!

    LR 4 only prints a blank page on Epson 2880. Print preview panes remain blank. Window 7 OS. Need help desperately!

    Bob
    Thank you for your kind consideration of my problem. Up until the software started to print blank pages the preview pane always showed the selected print within the selected layout. Something has changed. Lightroom will print to the JPEG file but only a blank page on the Epson 2880. I've been in contact with Epson support and an IT tech and they tell me the problem is with Lightroom. I'm at my wits end and thinking of upgrading but the glitch may carry over. Uninstalling and reinstalling and deleting the preferences file did nothing to rectify the situation.
    Thanks again!
    David

Maybe you are looking for

  • How to delete black space under my page..

    though the pages seem to be same size, in some of them i've got some black space under them and i cant take it away with the layout buttons what can I do? thanks

  • Nexus 5000 - Odd Ethernet interface behavior (link down inactive)

    Hi Guys, This would sound really trivial but it is very odd behavior. - We have a server connected to a 2, Nexus 5000s (for resiliancy) - When there is no config on the ethernet interfaces whatsoever, the ethernet interface is UP / UP, there is minim

  • Problem with JCA-DB in Business Service character

    Hi, I'm calling to database with JCA in Business Service, but when output contains the character "*&*" the business show "*&amp*"; Example OUTPUT FROM BD:_ AMERICA NT & SAN FRANCISCO OUTPUT FROM BS_ <Envelope xmlns="http://schemas.xmlsoap.org/soap/en

  • Mac OS x 10.5.6 PSE 6 Paste Anomaly

    Try the following steps: 1. Open a pdf file using Preview. 2. Choose the rectangular selection tool 3. Select a portion of a page. 4. Do a copy (command C) 5. Verify that the clipboard contains the area you selected by: a. Going to Finder > Edit > Sh

  • IDoc issue - update address data vendor

    We make use of iDocs to interface our vendor master data from an AS/400 system to SAP ERP. But we now have an issue with the address data updates of the vendor. If we check the vendor with XK03 - Environment - Field Changes: Date: 12/02/2010 Field: C