JTable height in print preview

hi all,
am trying to print preview the JTable.. the problem is the table height remains same for all the pages..
how i can change the table height for different pages.. i.e for the first page, table height should be half of the page height and in the second page , table height should be the height of page height like that..
is there any example for this ?
regards
suresh

Hi ,
You can try out the changes in below
Please check in /SMB40/FM06PE02:
  IF cf_retcode = 0.
    MOVE-CORRESPONDING ls_itcpo TO cs_composer_param.
   cs_composer_param-tdnoprint = 'X'.
    cs_control_param-device      = lf_device.
    cs_control_param-no_dialog   = 'X'.
    cs_control_param-preview     = xscreen.
    cs_control_param-getotf      = ls_itcpo-tdgetotf.
    cs_control_param-langu       = nast-spras.
  ENDIF.
ENDFORM.                    "set_print_param
You need to set cs_composer_param-tdnoprint = 'X' and then in printpreview page, the print functionality will not
be activated.
The reverse you can do in your case

Similar Messages

  • Print Preview of OLE object

    My table has an OLE object.
    In report it is arranged in tabular format (Arrage ->Table -> tabular)
    so that if height of Other field(Let "Description") is grater than height of OLE object then height of that particular row will increased upto the height of Description.
    In report view this works fine.  But in print preview or in print size of OLE remains to original, it is not printing as it is appearing in Report view.
    Please help me in this regard. 

    Hi AshishKumar1200,
    Thanks for posting in MSDN fourm. Which version of Access are you using?
    Since the issue is more relate to the end-user, I'd like to move it to Office 2013 and Office 365 ProPlus - IT Pro General Discussions forum.
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.
    Thanks for your understanding.
    Regards & Fei
    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.
    Click
    HERE to participate the survey.

  • Problem with Print Preview  Urgent!

    Hello BW Experts,
    1.I am trying to use the Print functionality for web printing.In the print preveiew i see all the text in black and white.It is completely different from the page that is displayed in the browser.
    --I tried using the same print stylesheet but it does not work.
    2.In the print preview how do i change the default header line height to some other value.
    3.If i select file>print preview in internet explorer it is treating the logo as a different page,so the logo is printing in seperate page followed by the text.
    I appreciate all your help.
    Thank you all!
    Raj

    Thanks deepak for the reply.
    I am using the stylesheet and media = print but i still have the problem.
    This is the javascript function i am using
    <head>
    <link href="/sap/bw/Mime/BCT/StyleSheets/ServicePortalBWReports.css" type="text/css" rel="stylesheet"/>
    <script>
    <script language=javascript>
    function callPrintHelpService(parameter, cell_type, filter, parameter1, parameter2, item, dataprovider, x, y) {
    var print_service = "Z_PRINT_HELP_SERVICE"
    <!--if ( parameter == "inches") print_service = "Z_PRINT_HELP_SERVICE_IMP";
    var cmd = url + "&DATA_PROVIDER=DP&HELP_SERVICE_CLASS=" + print_service;--->
    SAP_BW_URL_Get();
    if( dataprovider == "DP") window.open(url, "Print", "width=800, height=600, menubar=yes, toolbar=no, scrollbars=yes, resizable=yes"); }
    </script>
    <!-- Query description in the window title bar --->
    <title>
    <object>
             <param name="OWNER" value="SAP_BW"/>
             <param name="CMD" value="GET_ITEM"/>
             <param name="NAME" value="TITLE"/>
             <param name="ITEM_CLASS" value="CL_RSR_WWW_ITEM_TEXT_ELEMENTS"/>
             <param name="DATA_PROVIDER" value="DP"/>
             <param name="GENERATE_CAPTION" value=""/>
             <param name="ELEMENT_TYPE_1" value="COMMON"/>
             <param name="ELEMENT_NAME_1" value="REPTXTLG"/>
             <param name="ONLY_VALUES" value="X"/>
             <param name="ELEMENT_NAME" value="REPTXTLG"/>
             ITEM:            TITLE
    </object>
    </title>
          <link href="/sap/bw/Mime/BEx/StyleSheets/ServicePortalBWReports.css" type="text/css" rel="stylesheet" media="print"/>
    </head>
    1.---can you please be more specific where i need to change the default header height value.
    2.In the print preview of the report it looks fine but when i say file>print preview from internet explorer it is considering the logo as seperate page .Do i need to make any settings somewhere.
    3.In the print preview it remains same eventhough i use the same stylesheet as that of the report.
    Please advice.
    Thank you,
    Raja

  • Firefox10 was unable to invoke adobe pdf print preview where as Firefox 3 was able to do this.

    Firefox10 was unable to invoke adober pdf print preview where as Firefox 3 was able to do this.
    embed pdf document or use iframe
    Firefox successfully loads the PDF into the iFrame.
    What doesn't happen is printing.
    http://forums.adobe.com/thread/909776

    Also check this out. Firefox10 was able to display the pdf document perfectly.
    Now goto Firefox options and click print which invokes the printer print view and NOT the Adobe print view.
    Also if you click the print preview a blank page is shown.
    <embed id="pdf" src="archive.pdf" type="application/pdf" height="100%" width="100%" ></embed>

  • Position command differ from print preview and print

    hi friends
    *First column box
    POSITION WINDOW
    POSITION XORIGIN 1 CM YORIGIN '6' CM
    SIZE WIDTH '2.5' CM
    BOX HEIGHT '10' CM FRAME 10 TW
    *2nd column box
    POSITION WINDOW
    POSITION XORIGIN 1 CM YORIGIN '6' CM
    SIZE WIDTH '4.6' CM
    BOX HEIGHT '10' CM FRAME 10 TW
    in Print Preview i am getting Line but while taking printout.. i am not getting....
    what may be the issue...
    Regards
    Selva

    The print driver is rather literal in applying your format. The second box is over-writing the first. If you reverse the order you call the boxes in they'll print okay.
    *First column box
    POSITION WINDOW
    POSITION XORIGIN 1 CM YORIGIN '6' CM
    SIZE WIDTH '4.6' CM
    BOX HEIGHT '10' CM FRAME 10 TW
    *2nd column box
    POSITION WINDOW
    POSITION XORIGIN 1 CM YORIGIN '6' CM
    SIZE WIDTH '2.5' CM
    BOX HEIGHT '10' CM FRAME 10 TW
    Or
    *Box
    POSITION WINDOW
    POSITION XORIGIN 1 CM YORIGIN '6' CM
    SIZE WIDTH '4.6' CM
    BOX HEIGHT '10' CM FRAME 10 TW
    *Column divider
    POSITION WINDOW
    POSITION XORIGIN '3.5' CM YORIGIN '6' CM
    SIZE WIDTH 0 CM
    BOX HEIGHT '10' CM FRAME 10 TW

  • My Free Java Print Preview Class

    Ok, for 2 weeks now ive been in agony trying to program a
    print preview for a program im writing for work.
    Alot, of the free print previews online are way complicated
    and crazy and hard to implement.
    Either that, or these forums and "how tos" online never
    answered the question or were to general or hard
    to follow for a beginner.
    I even posted a $40 question on google answers on how to
    do this and never got an answer.
    If ive had this problem others must have also
    so to save them the trouble i went through, here is a good
    starting point.
    I just finished this class.
    All you have to do is pass it a JPanel (or i guess any component
    with a " .paint(Graphics g) " ).
    new PrintPreview( component );all you might have to change is JInternalFrame to JFrame which is
    easy. also, the fit to page doesnt work yet but thats easy to code.
    please, i encourage comments and polite criticism.
    im just starting out so i know this isnt perfect but i posted
    it with good intentions.
    Hope it helps out some out there.
    import javax.swing.*;
    import java.awt.*;
    import javax.swing.event.*;
    import java.awt.event.*;
    import java.awt.print.*;
    import java.lang.Math.*;
    import java.awt.image.*;
    public class PrintPreview extends JInternalFrame implements ActionListener{
    public PrintPreview(Component pc){
         super("Print Preview", true, true, true, true);
         PC = pc;
    // buttons
         pf1 = new JRadioButton("Portrait");
            pf1.setActionCommand("1");
            pf1.setSelected(true);
            pf2 = new JRadioButton("Landscape");
            pf2.setActionCommand("2");
            pf.add(pf1);
            pf.add(pf2);
            pf1.setBackground(Pref.tbgc);
            pf2.setBackground(Pref.tbgc);
            cp.setBackground(Pref.tbgc);
         preview.addActionListener(this);
            print.addActionListener(this);
    // set
         pp.setPreferredSize(new Dimension(460, 460));
         pp.setBorder(BorderFactory.createLineBorder (Color.black, 2));
         pp.setBackground(Pref.tbgc);
         hold.setPreferredSize(new Dimension(200, 280));
         hold.setBorder(BorderFactory.createLineBorder (Color.black, 2));
         hold.setBackground(Pref.tbgc);
    // make main panel
         mp.setBackground(Pref.tbgc);
         GridBagLayout gridbag = new GridBagLayout();
         GridBagConstraints constraints = new GridBagConstraints();
         mp.setLayout(gridbag);
    // make hold panel
         GridBagLayout g1 = new GridBagLayout();
         GridBagConstraints c1 = new GridBagConstraints();
         hold.setLayout(g1);
    // DELETE
         PF.setOrientation(PF.PORTRAIT);
    // GUI
    // hold
         c1.insets.top = 5;
         c1.insets.left = 45;
         c1.insets.right = 5;
         buildConstraints(c1, 0, 2, 2, 1, 1, 1);
         c1.fill = GridBagConstraints.BOTH;
         g1.setConstraints(pf1, c1);
         hold.add(pf1);
         c1.insets.top = 2;
         buildConstraints(c1, 0, 4, 2, 1, 1, 1);
         c1.fill = GridBagConstraints.BOTH;
         g1.setConstraints(pf2, c1);
         hold.add(pf2);
         c1.insets.left = 5;
         c1.insets.right = 0;
         c1.insets.top = 25;
         buildConstraints(c1, 0, 6, 1, 1, 1, 1);
         c1.fill = GridBagConstraints.BOTH;
         g1.setConstraints(xsl, c1);
         hold.add(xsl);
         c1.insets.left = 0;
         c1.insets.right = 5;
         buildConstraints(c1, 1, 6, 1, 1, 1, 1);
         c1.fill = GridBagConstraints.BOTH;
         g1.setConstraints(xs, c1);
         hold.add(xs);
         c1.insets.left = 5;
         c1.insets.right = 0;
         c1.insets.top = 5;
         buildConstraints(c1, 0, 8, 1, 1, 1, 1);
         c1.fill = GridBagConstraints.BOTH;
         g1.setConstraints(ysl, c1);
         hold.add(ysl);
         c1.insets.left = 0;
         c1.insets.right = 5;
         buildConstraints(c1, 1, 8, 1, 1, 1, 1);
         c1.fill = GridBagConstraints.BOTH;
         g1.setConstraints(ys, c1);
         hold.add(ys);
         c1.insets.left = 25;
         c1.insets.right = 5;
         buildConstraints(c1, 0, 10, 2, 1, 1, 1);
         c1.fill = GridBagConstraints.BOTH;
         g1.setConstraints(cp, c1);
         hold.add(cp);
         c1.insets.left = 35;
         c1.insets.right = 35;
         c1.insets.top = 20;
         buildConstraints(c1, 0, 12, 2, 1, 1, 1);
         c1.fill = GridBagConstraints.BOTH;
         g1.setConstraints(ftp, c1);
         hold.add(ftp);
         c1.insets.left = 35;
         c1.insets.right = 35;
         c1.insets.top = 25;
         buildConstraints(c1, 0, 14, 2, 1, 1, 1);
         c1.fill = GridBagConstraints.BOTH;
         g1.setConstraints(preview, c1);
         hold.add(preview);
         c1.insets.bottom = 15;
         c1.insets.top = 5;
         buildConstraints(c1, 0, 16, 2, 1, 1, 1);
         c1.fill = GridBagConstraints.BOTH;
         g1.setConstraints(print, c1);
         hold.add(print);
         constraints.insets.top = 10;
         constraints.insets.left = 10;
         constraints.insets.bottom = 10;
         buildConstraints(constraints, 0, 2, 1, 1, 1, 1);
         constraints.fill = GridBagConstraints.NONE;
         gridbag.setConstraints(hold, constraints);
         mp.add(hold);
         constraints.insets.right = 10;
         buildConstraints(constraints, 1, 2, 1, 1, 1, 1);
         constraints.fill = GridBagConstraints.NONE;
         gridbag.setConstraints(pp, constraints);
         mp.add(pp);
    // display
         this.setContentPane(mp);
         this.setVisible(true);
         this.setResizable(false);
         Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
         setSize(720, 520);
            Dimension windowSize = getSize();
         setLocation(Math.max(0,(screenSize.width -windowSize.width)/2),
            (Math.max(0,(screenSize.height-windowSize.height)/2)));
            DESKTOP.desktop.add(this);
            try {
         this.setSelected(true);
            } catch (java.beans.PropertyVetoException e) {}
    public void buildConstraints(GridBagConstraints gbc, int gx, int gy, int gw, int gh, double wx, double wy){
         gbc.gridx = gx;
         gbc.gridy = gy;
         gbc.gridwidth = gw;
         gbc.gridheight = gh;
         gbc.weightx = wx;
         gbc.weighty = wy;
    public class PreviewPage extends JPanel{
    public PreviewPage(){
    public void paint(Graphics g){
         super.paint(g);
         Graphics2D g2 = (Graphics2D)g;
    // PORTRAIT
         if(PF.getOrientation() == PF.PORTRAIT){
         g.setColor(Color.black);
         g.drawRect(60, 10, 340, 440);
         int x1 = (int)Math.rint( ( (double)PF.getImageableX() / 72 ) * 40 );
         int y1 = (int)Math.rint( ( (double)PF.getImageableY() / 72 ) * 40 );
         int l1 = (int)Math.rint( ( (double)PF.getImageableWidth() / 72 ) * 40 );
         int h1 = (int)Math.rint( ( (double)PF.getImageableHeight() / 72 ) * 40 );
         g.setColor(Color.red);
         g.drawRect(x1+60, y1+10, l1, h1);
         setScales();
         int x2 = (int)Math.rint( 1028 / XSC );
         int y2 = (int)Math.rint( 768 / YSC );
         Image image = new BufferedImage( x2, y2, BufferedImage.TYPE_INT_ARGB);
         PC.paint( image.getGraphics() );
         g.drawImage(image, x1+60, y1+10, l1, h1, this);
    // LANDSCAPE
         if(PF.getOrientation() == PF.LANDSCAPE){
         g.setColor(Color.black);
         g.drawRect(10, 60, 440, 340);
         int x1 = (int)Math.rint( ( (double)PF.getImageableX() / 72 ) * 40 );
         int y1 = (int)Math.rint( ( (double)PF.getImageableY() / 72 ) * 40 );
         int l1 = (int)Math.rint( ( (double)PF.getImageableWidth() / 72 ) * 40 );
         int h1 = (int)Math.rint( ( (double)PF.getImageableHeight() / 72 ) * 40 );
         g.setColor(Color.red);
         g.drawRect(x1+10, y1+60, l1, h1);
         setScales();
         int x2 = (int)Math.rint( 1028 / XSC );
         int y2 = (int)Math.rint( 768 / YSC );
         Image image = new BufferedImage( x2, y2, BufferedImage.TYPE_INT_ARGB);
         PC.paint( image.getGraphics() );
         g.drawImage(image, x1+10, y1+60, l1, h1, this);
    public void actionPerformed(ActionEvent e){
    // fit to page
         if(e.getSource() == ftp){
    // preview
         if(e.getSource() == preview){
         setProperties();
    // print
         if(e.getSource() == print){
         doPrint();
    public void setProperties(){
         if(pf1.isSelected() == true){
         PF.setOrientation(PF.PORTRAIT);
         if(pf2.isSelected() == true){
         PF.setOrientation(PF.LANDSCAPE);
         setScales();
         pp.repaint();
    public void setScales(){
         try{
         XSC = Double.parseDouble( xs.getText() );
         } catch (NumberFormatException e) { }
         try{
         YSC = Double.parseDouble( ys.getText() );
         } catch (NumberFormatException e) { }
    public void doPrint(){
         PrintThis();
    public void PrintThis(){
         PrinterJob printerJob = PrinterJob.getPrinterJob();
         Book book = new Book();
         book.append( new PrintPage(), PF );
         printerJob.setPageable(book);
         boolean doPrint = printerJob.printDialog();
         if (doPrint) {
         try {
         printerJob.print();
         } catch (PrinterException exception) {
         System.err.println("Printing error: " + exception);
    public class PrintPage implements Printable{
    public int print(Graphics g, PageFormat format, int pageIndex) {
         Graphics2D g2D = (Graphics2D) g;
         g2D.translate(format.getImageableX (), format.getImageableY ());
         disableDoubleBuffering(mp);
         System.out.println("get i x " + format.getImageableX ());
         System.out.println("get i x " + format.getImageableY ());
         System.out.println("getx: " + format.getImageableWidth() );
         System.out.println("getx: " + format.getImageableHeight() );
         // scale to fill the page
         double dw = format.getImageableWidth();
         double dh = format.getImageableHeight();
         Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
         setScales();
         double xScale = dw / (1028/XSC);
         double yScale = dh / (768/YSC);
         double scale = Math.min(xScale,yScale);
         System.out.println("" + scale);
         g2D.scale( xScale, yScale);
         ((JPanel)PC).paint(g);
         enableDoubleBuffering(mp);
         return Printable.PAGE_EXISTS;
    public void disableDoubleBuffering(Component c) {
        RepaintManager currentManager = RepaintManager.currentManager(c);
        currentManager.setDoubleBufferingEnabled(false);
    public void enableDoubleBuffering(Component c) {
        RepaintManager currentManager = RepaintManager.currentManager(c);
        currentManager.setDoubleBufferingEnabled(true);
         Component PC;
         PageFormat PF = new PageFormat();
         double XSC = 1;
         double YSC = 1;
    // gui comp
         JPanel mp = new JPanel();
         JPanel hold = new JPanel();
         JPanel pp = new PreviewPage();
         ButtonGroup pf = new ButtonGroup();
         JRadioButton pf1;
         JRadioButton pf2;
         JLabel xsl = new JLabel("X Scale:", JLabel.LEFT);
         JTextField xs = new JTextField("1");
         JLabel ysl = new JLabel("Y Scale:", JLabel.LEFT);
         JTextField ys = new JTextField("1");
         JButton ftp = new JButton("Fit to Page");
         JCheckBox cp = new JCheckBox("Constrain Proportions");
         JButton preview = new JButton("PREVIEW");
         JButton print = new JButton("PRINT");
    }

    Ok, for 2 weeks now ive been in agony trying to program a
    print preview for a program im writing for work.
    Alot, of the free print previews online are way complicated
    and crazy and hard to implement.
    Either that, or these forums and "how tos" online never
    answered the question or were to general or hard
    to follow for a beginner.
    I even posted a $40 question on google answers on how to
    do this and never got an answer.
    If ive had this problem others must have also
    so to save them the trouble i went through, here is a good
    starting point.
    I just finished this class.
    All you have to do is pass it a JPanel (or i guess any component
    with a " .paint(Graphics g) " ).
    new PrintPreview( component );all you might have to change is JInternalFrame to JFrame which is
    easy. also, the fit to page doesnt work yet but thats easy to code.
    please, i encourage comments and polite criticism.
    im just starting out so i know this isnt perfect but i posted
    it with good intentions.
    Hope it helps out some out there.
    import javax.swing.*;
    import java.awt.*;
    import javax.swing.event.*;
    import java.awt.event.*;
    import java.awt.print.*;
    import java.lang.Math.*;
    import java.awt.image.*;
    public class PrintPreview extends JInternalFrame implements ActionListener{
    public PrintPreview(Component pc){
         super("Print Preview", true, true, true, true);
         PC = pc;
    // buttons
         pf1 = new JRadioButton("Portrait");
            pf1.setActionCommand("1");
            pf1.setSelected(true);
            pf2 = new JRadioButton("Landscape");
            pf2.setActionCommand("2");
            pf.add(pf1);
            pf.add(pf2);
            pf1.setBackground(Pref.tbgc);
            pf2.setBackground(Pref.tbgc);
            cp.setBackground(Pref.tbgc);
         preview.addActionListener(this);
            print.addActionListener(this);
    // set
         pp.setPreferredSize(new Dimension(460, 460));
         pp.setBorder(BorderFactory.createLineBorder (Color.black, 2));
         pp.setBackground(Pref.tbgc);
         hold.setPreferredSize(new Dimension(200, 280));
         hold.setBorder(BorderFactory.createLineBorder (Color.black, 2));
         hold.setBackground(Pref.tbgc);
    // make main panel
         mp.setBackground(Pref.tbgc);
         GridBagLayout gridbag = new GridBagLayout();
         GridBagConstraints constraints = new GridBagConstraints();
         mp.setLayout(gridbag);
    // make hold panel
         GridBagLayout g1 = new GridBagLayout();
         GridBagConstraints c1 = new GridBagConstraints();
         hold.setLayout(g1);
    // DELETE
         PF.setOrientation(PF.PORTRAIT);
    // GUI
    // hold
         c1.insets.top = 5;
         c1.insets.left = 45;
         c1.insets.right = 5;
         buildConstraints(c1, 0, 2, 2, 1, 1, 1);
         c1.fill = GridBagConstraints.BOTH;
         g1.setConstraints(pf1, c1);
         hold.add(pf1);
         c1.insets.top = 2;
         buildConstraints(c1, 0, 4, 2, 1, 1, 1);
         c1.fill = GridBagConstraints.BOTH;
         g1.setConstraints(pf2, c1);
         hold.add(pf2);
         c1.insets.left = 5;
         c1.insets.right = 0;
         c1.insets.top = 25;
         buildConstraints(c1, 0, 6, 1, 1, 1, 1);
         c1.fill = GridBagConstraints.BOTH;
         g1.setConstraints(xsl, c1);
         hold.add(xsl);
         c1.insets.left = 0;
         c1.insets.right = 5;
         buildConstraints(c1, 1, 6, 1, 1, 1, 1);
         c1.fill = GridBagConstraints.BOTH;
         g1.setConstraints(xs, c1);
         hold.add(xs);
         c1.insets.left = 5;
         c1.insets.right = 0;
         c1.insets.top = 5;
         buildConstraints(c1, 0, 8, 1, 1, 1, 1);
         c1.fill = GridBagConstraints.BOTH;
         g1.setConstraints(ysl, c1);
         hold.add(ysl);
         c1.insets.left = 0;
         c1.insets.right = 5;
         buildConstraints(c1, 1, 8, 1, 1, 1, 1);
         c1.fill = GridBagConstraints.BOTH;
         g1.setConstraints(ys, c1);
         hold.add(ys);
         c1.insets.left = 25;
         c1.insets.right = 5;
         buildConstraints(c1, 0, 10, 2, 1, 1, 1);
         c1.fill = GridBagConstraints.BOTH;
         g1.setConstraints(cp, c1);
         hold.add(cp);
         c1.insets.left = 35;
         c1.insets.right = 35;
         c1.insets.top = 20;
         buildConstraints(c1, 0, 12, 2, 1, 1, 1);
         c1.fill = GridBagConstraints.BOTH;
         g1.setConstraints(ftp, c1);
         hold.add(ftp);
         c1.insets.left = 35;
         c1.insets.right = 35;
         c1.insets.top = 25;
         buildConstraints(c1, 0, 14, 2, 1, 1, 1);
         c1.fill = GridBagConstraints.BOTH;
         g1.setConstraints(preview, c1);
         hold.add(preview);
         c1.insets.bottom = 15;
         c1.insets.top = 5;
         buildConstraints(c1, 0, 16, 2, 1, 1, 1);
         c1.fill = GridBagConstraints.BOTH;
         g1.setConstraints(print, c1);
         hold.add(print);
         constraints.insets.top = 10;
         constraints.insets.left = 10;
         constraints.insets.bottom = 10;
         buildConstraints(constraints, 0, 2, 1, 1, 1, 1);
         constraints.fill = GridBagConstraints.NONE;
         gridbag.setConstraints(hold, constraints);
         mp.add(hold);
         constraints.insets.right = 10;
         buildConstraints(constraints, 1, 2, 1, 1, 1, 1);
         constraints.fill = GridBagConstraints.NONE;
         gridbag.setConstraints(pp, constraints);
         mp.add(pp);
    // display
         this.setContentPane(mp);
         this.setVisible(true);
         this.setResizable(false);
         Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
         setSize(720, 520);
            Dimension windowSize = getSize();
         setLocation(Math.max(0,(screenSize.width -windowSize.width)/2),
            (Math.max(0,(screenSize.height-windowSize.height)/2)));
            DESKTOP.desktop.add(this);
            try {
         this.setSelected(true);
            } catch (java.beans.PropertyVetoException e) {}
    public void buildConstraints(GridBagConstraints gbc, int gx, int gy, int gw, int gh, double wx, double wy){
         gbc.gridx = gx;
         gbc.gridy = gy;
         gbc.gridwidth = gw;
         gbc.gridheight = gh;
         gbc.weightx = wx;
         gbc.weighty = wy;
    public class PreviewPage extends JPanel{
    public PreviewPage(){
    public void paint(Graphics g){
         super.paint(g);
         Graphics2D g2 = (Graphics2D)g;
    // PORTRAIT
         if(PF.getOrientation() == PF.PORTRAIT){
         g.setColor(Color.black);
         g.drawRect(60, 10, 340, 440);
         int x1 = (int)Math.rint( ( (double)PF.getImageableX() / 72 ) * 40 );
         int y1 = (int)Math.rint( ( (double)PF.getImageableY() / 72 ) * 40 );
         int l1 = (int)Math.rint( ( (double)PF.getImageableWidth() / 72 ) * 40 );
         int h1 = (int)Math.rint( ( (double)PF.getImageableHeight() / 72 ) * 40 );
         g.setColor(Color.red);
         g.drawRect(x1+60, y1+10, l1, h1);
         setScales();
         int x2 = (int)Math.rint( 1028 / XSC );
         int y2 = (int)Math.rint( 768 / YSC );
         Image image = new BufferedImage( x2, y2, BufferedImage.TYPE_INT_ARGB);
         PC.paint( image.getGraphics() );
         g.drawImage(image, x1+60, y1+10, l1, h1, this);
    // LANDSCAPE
         if(PF.getOrientation() == PF.LANDSCAPE){
         g.setColor(Color.black);
         g.drawRect(10, 60, 440, 340);
         int x1 = (int)Math.rint( ( (double)PF.getImageableX() / 72 ) * 40 );
         int y1 = (int)Math.rint( ( (double)PF.getImageableY() / 72 ) * 40 );
         int l1 = (int)Math.rint( ( (double)PF.getImageableWidth() / 72 ) * 40 );
         int h1 = (int)Math.rint( ( (double)PF.getImageableHeight() / 72 ) * 40 );
         g.setColor(Color.red);
         g.drawRect(x1+10, y1+60, l1, h1);
         setScales();
         int x2 = (int)Math.rint( 1028 / XSC );
         int y2 = (int)Math.rint( 768 / YSC );
         Image image = new BufferedImage( x2, y2, BufferedImage.TYPE_INT_ARGB);
         PC.paint( image.getGraphics() );
         g.drawImage(image, x1+10, y1+60, l1, h1, this);
    public void actionPerformed(ActionEvent e){
    // fit to page
         if(e.getSource() == ftp){
    // preview
         if(e.getSource() == preview){
         setProperties();
    // print
         if(e.getSource() == print){
         doPrint();
    public void setProperties(){
         if(pf1.isSelected() == true){
         PF.setOrientation(PF.PORTRAIT);
         if(pf2.isSelected() == true){
         PF.setOrientation(PF.LANDSCAPE);
         setScales();
         pp.repaint();
    public void setScales(){
         try{
         XSC = Double.parseDouble( xs.getText() );
         } catch (NumberFormatException e) { }
         try{
         YSC = Double.parseDouble( ys.getText() );
         } catch (NumberFormatException e) { }
    public void doPrint(){
         PrintThis();
    public void PrintThis(){
         PrinterJob printerJob = PrinterJob.getPrinterJob();
         Book book = new Book();
         book.append( new PrintPage(), PF );
         printerJob.setPageable(book);
         boolean doPrint = printerJob.printDialog();
         if (doPrint) {
         try {
         printerJob.print();
         } catch (PrinterException exception) {
         System.err.println("Printing error: " + exception);
    public class PrintPage implements Printable{
    public int print(Graphics g, PageFormat format, int pageIndex) {
         Graphics2D g2D = (Graphics2D) g;
         g2D.translate(format.getImageableX (), format.getImageableY ());
         disableDoubleBuffering(mp);
         System.out.println("get i x " + format.getImageableX ());
         System.out.println("get i x " + format.getImageableY ());
         System.out.println("getx: " + format.getImageableWidth() );
         System.out.println("getx: " + format.getImageableHeight() );
         // scale to fill the page
         double dw = format.getImageableWidth();
         double dh = format.getImageableHeight();
         Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
         setScales();
         double xScale = dw / (1028/XSC);
         double yScale = dh / (768/YSC);
         double scale = Math.min(xScale,yScale);
         System.out.println("" + scale);
         g2D.scale( xScale, yScale);
         ((JPanel)PC).paint(g);
         enableDoubleBuffering(mp);
         return Printable.PAGE_EXISTS;
    public void disableDoubleBuffering(Component c) {
        RepaintManager currentManager = RepaintManager.currentManager(c);
        currentManager.setDoubleBufferingEnabled(false);
    public void enableDoubleBuffering(Component c) {
        RepaintManager currentManager = RepaintManager.currentManager(c);
        currentManager.setDoubleBufferingEnabled(true);
         Component PC;
         PageFormat PF = new PageFormat();
         double XSC = 1;
         double YSC = 1;
    // gui comp
         JPanel mp = new JPanel();
         JPanel hold = new JPanel();
         JPanel pp = new PreviewPage();
         ButtonGroup pf = new ButtonGroup();
         JRadioButton pf1;
         JRadioButton pf2;
         JLabel xsl = new JLabel("X Scale:", JLabel.LEFT);
         JTextField xs = new JTextField("1");
         JLabel ysl = new JLabel("Y Scale:", JLabel.LEFT);
         JTextField ys = new JTextField("1");
         JButton ftp = new JButton("Fit to Page");
         JCheckBox cp = new JCheckBox("Constrain Proportions");
         JButton preview = new JButton("PREVIEW");
         JButton print = new JButton("PRINT");
    }

  • Firefox print preview

    This is not a question, it is more of a statement of a Print Preview issue in Firefox 4.01 and 3.6.
    When using min-height styling on a webpage, if an element (any element) extends beyond one page while using print-preview, then the element stretches AGAIN to that min-height on the second page.. In other words, min-height is re-applied, even though the element may already be that greater than that min-height.

    Haha, Mr. Smarty Pants, that is pretty much exactly what we ended up doing :) Very quick answer, though, nice stuff. It took us about a half hour so of testing to find out what was causing this issue though... we couldn't figure out why the table was extending so far until I did a print screenshot and measured it in Paint and was able to connect the dots.
    (edit)
    Preferably, rather than doing special, kooky css that i hope looks right, maybe Firefox can fix this.. I probably should have pushed this somewhere else.. it was just difficult for me to find the bug submit area.

  • How to do Print, Print Preview & Page Setup?

    do you have any sample to do Print, Print Preview & Page Setup.
    thanks very much!

    I have a JTable on a dialog and wanted to print it. I discovered the following method (may or may not work for you).
    1) Simply extend your class to implement Prinatable....
    public class EbertPanelProductivityHistory extends JPanel implements Printable {
    2) As pare of your class in #1 make a print() method as follows (i.e. implement print() for Printable)
    public int print( Graphics g, PageFormat pageFormat, int page ) {
    int i,j,k,x,y;
    Graphics2D g2d;
    // We're done! (page is 0 based)
    if( page >= ReportDataPrintPageCnt ) {
    return (NO_SUCH_PAGE);
    // Create a graphic2D object and set the default parameters
    g2d = (Graphics2D)g;
    g2d.setColor( Color.black );
    etc. etc. etc....
    // PRINT IT!!!
    return( PAGE_EXISTS );
    3) And then you can print yourself...
    private void PrintActionPerformed(java.awt.event.ActionEvent evt) {
    PrinterJob PrintJob = PrinterJob.getPrinterJob(); // printer access - instance of PrinterJob
    /**** THIS IS OURSELF - i.e. our class with print() implemented that implements Printable **********/
    PrintJob.setPrintable(this); // this class implements Printable - see print()
    PrintJob.setJobName( Title ); // job name
    if( PrintJob.printDialog() ) {                    // print dialog!
    try { PrintJob.print(); } catch (Exception e) {
    javax.swing.JOptionPane.showMessageDialog(null, MSG_ID + MSG_ERR + e.getMessage(), "Alert", javax.swing.JOptionPane.ERROR_MESSAGE);

  • Firefox10 was unable to invoke adober pdf print preview where as Firefox 3 was able to do this.

    Firefox10 was unable to invoke adober pdf print preview where as Firefox 3 was able to do this.
    embed pdf document or use iframe
    Firefox successfully loads the PDF into the iFrame.
    What doesn't happen is printing.
    http://forums.adobe.com/thread/909776

    Also check this out. Firefox10 was able to display the pdf document perfectly.
    Now goto Firefox options and click print which invokes the printer print view and NOT the Adobe print view.
    Also if you click the print preview a blank page is shown.
    <embed id="pdf" src="archive.pdf" type="application/pdf" height="100%" width="100%" ></embed>

  • Create a Print Preview

    Hi, how can i create a print preview for a Text Component and/or a JTable (or any other component)?
    I know that i must write the print method but i need some intresting examples of all the classes that i have to develop.
    Thanks

    If you only want to print content that can be
    displayed by a JEditorPane then you may want to check
    out my DocumentPrinter, which you can get from
    http://www.dcs.shef.ac.uk/~mark/software/swing/
    As well as printing Documents that can be loaded by a
    JEditorPane it also allows you to specify headers and
    footers and provides a print preview dialog box.
    At the moment it works but it could do with some
    improvements including memory usage which I'm
    currently working on. Any feedback if you do use it
    or feature requests would be appreciated,
    MarkHi Mark,
    I must commend you for developing such a wondeful java printing solution (Document Printer). I have a question, is it posible for me to be able to call a new page from my code. I have generated some pay slips from my application with HTML and i want only 2 pay slips per page. Is it possible for me to call a new page from my code using document printer....please i need it badly...
    Thanks
    Jaji Lukman

  • The Mozilla WHITE start page is blocking the upper left Firefox to Print to Print Preview, so i can not see what is on the Printer Glass

    The BIG WHITE MOSTLY BLANK , MOZILLA START PAGE was blocking my use of PRINT PREVIEW, from the orange "Firefox" in the upper left corner.
    I was told i was using an out of date version of Firefox.
    But no "click here to update".
    So i downloaded the new edition of Firefox.
    And still, i can not see PRINT PREVIEW, because the large white screen of the MOZILLA START PAGE is blocking it.
    I have selected a background wallpaper, so would rather not see ANY of the BIG WHITE START PAGE, at all !!
    HEEEELP,,,,,,

    Hi,
    Can you please post a [https://en.wikipedia.org/wiki/Screenshot screenshot] of the start page when it is blocking the print preview. Please note that you may have to change to the tab of the site to be printed to see the print preview of the page. If the problem persists, please also check in [https://support.mozilla.com/en-US/kb/Safe%20Mode Safe Mode.]
    [http://kb.mozillazine.org/Problematic_extensions Problematic Extensions]
    [https://support.mozilla.com/en-US/kb/Troubleshooting%20extensions%20and%20themes Troubleshooting Extensions and Themes]
    [http://support.mozilla.com/en-US/kb/Uninstalling+add-ons Uninstalling Add-ons]
    [http://kb.mozillazine.org/Uninstalling_toolbars Uninstalling Toolbars]

  • Sy-ucomm value for print preview

    Hi friends,
    Can any one tell me the sy-ucomm value for the print preview..?

    Hi,
    If you are asking the function code of Pop-up you get while printing ..then answer is no..even if you get the fcode you cannot handle it in your program.
    What exactly you are looking for ?

  • Condition type freight is not getting displayed in print preview

    Hi,
    I created PO, and while seeing its print preview:
    Condition type freight is not getting displayed.
    Where i missed?
    Uts

    hi,
    Inddition to M/08...(As given above)...
    Also do check the smart form or SAP script...used for the output...check it with the ABAPer...whether the field is liable for o/p or not??
    Smart form is attached at message type of message determination..
    Regards
    Priyanka.P

  • Text in PO(text tab in header & item) is not shown in the Print Preview

    Hi Guys,
                I face a problem in ME23N.Text maintained in Purchase Orders (text tab in header & item)  is not shown in the Print Preview.
                Can you guys help.Do I need to write a subroutine pool for this.
                <<text removed by moderator>>
    Regards,
    Rajiv
    Edited by: Matt on Nov 12, 2008 1:20 PM

    Hi ,
    Use bapi bapi_po_getdetail .
    CALL FUNCTION 'BAPI_PO_GETDETAIL'
        EXPORTING
          purchaseorder   = is_ekko-ebeln
          item_texts      = c_x
          header_texts    = c_x
        TABLES
          po_header_texts = it_header_text
          po_item_texts   = it_item_text.
    Regards
    Neetesh

  • Why does Print Preview of a .eml file recursively open the same .eml file? I can't print it.

    Hello. I saved an email from my IMAP account locally to file as offlineemail.eml. When I try to open the .eml file later in Thunderbird, it opens up ok, no problem. When I do Print Preview just before sending it to my printer, two windows pop up. In the background is the first window, the Preview itself. However, it only shows "about:blank" in the Preview body. In the foreground, a window with Title: Opening offlineemail.eml. Body: You have chosen to open: offlineemail.eml which is: eml document (27.9 KB) from: /tmp. What should Thunderbird do with this file? [Radio button] Open with [dropdown] Thunderbird (default); [Radio button] Save file; [Checkbox unchecked] Do this automatically for files like this from now on. [Push buttons] Cancel Ok. The Ok button remains greyed out until I click one of the radio buttons. I click Open with Thunderbird, the Ok button is now active, and I click Ok. Here, the same email opens up just fine again in a separate Thunderbird window. I do a Print Preview, and this whole paragraph of steps is repeated. I never see the preview. Any ideas why this would be? My Thunderbird version: 31.3.0. My OS: linux openSUSE 13.1"Bottle". File manager: Thunar 1.6.3 for the XFCE desktop.

    Here's the Audit Space Usage for the original 5 MB file. It shows the images taking up the majority of the space, as expected:

Maybe you are looking for