Print Preview class

I'm trying to build a WordProcessor and i'm stuck on the print preview.
I've been using the Manning book, Swing. I think they have some typo's
in the print chapter or I'm missing something.
Well here the problem:
Wordwrite.java:103: cannot resolve symbol
symbol : constructor PrintView (Wordwrite)
location : class Wordwrite.PrintView
m_printView = new PrintView(Wordwrite.this);
My code is slightly off from the books
Here's what the book had
new PrintPreview(Wordwrite.this);
for your info: PrintPreview is only mentioned here and nowhere else.
Any Clues.

The error is telling you that either the class PrintView doesn't exist or that it doesn't have a constructor that takes Wordwrite as an argument.
Is there a PrintView class? Perhaps you've called it PrintPreview? If there's a PrintPreview class then change the line that says
m_printView = new PrintView(...)
to
m_printView = new PrintPreview(...)
Hope this helps.

Similar Messages

  • 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");
    }

  • Since installing Firefox 4, I keep getting this message "TypeError: Components.classes[cid] is undefined" when a window should open. Also print and print preview don't work properly anymore.

    Since installing the newest version of Firefox, This message "TypeError: Components.classes[cid] is undefined" appears in a box when a new window should open. Also, what you see in print print preview is not what prints.

    This type of error is usually caused by an add-on you are using that is not compatible. It could be anything from an antivirus link scanner like AVG Safe Search add-on, or McAfee Site Advisor add-on, or something similar. To confirm what add-on is causing this use the procedure in this link:
    https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes
    Try Disabling the last add-on that was installed prior to upgrading to version 5.0
    Check and tell if its working.

  • JasperReports - how to save as PDF from Print Preview page?

    Hi all!
    How can I save reports created with JasperReperts (with iReport tool) as PDF?
    On print preview, when I select it is as PDF, and click on "save", nothing is saved. Also, I get NoClassDefFoundError despite I included all nessesry classes (did I?). Here are list of included classes
    jasperreports-1.2.7.jar;
    jasperreports-1.2.7-javaflow.jar;
    commons-beanutils-1.5.jar;
    commons-collections-2.1.jar;
    commons-logging-1.0.2.jar;
    commons-digester-1.7.jar;Here is my code:
    void printWithPreview() {
        try {
          JasperPrint print = JasperFillManager.fillReport(report, reportParam, conn);
          JasperViewer.viewReport(print, false);
          //byte[] pdfasbytes = JasperExportManager.exportReportToPdf(print); // can I use it somehow?
          JasperExportManager.exportReportToPdf(print);
        } catch (JRException e) {
          e.printStackTrace();
      }Can you help me with this?
    Also, I need to know, how to limit options "save as" only to PFD (on same Print Preview page)?
    Thank you in advance!

    Right!
    I was missing iText.jar.
    So, you need only this code to get report preview and feature to export to pdf, html and other formats:
    void printWithPreview() {
        try {
          JasperPrint print = JasperFillManager.fillReport(report, reportParam, conn);
          JasperViewer.viewReport(print, false);
          JasperExportManager.exportReportToPdf(print);
        } catch (JRException e) {
          e.printStackTrace();
      }You do not need to save it specificly to c: or other "hard coded" directory.
    Thanx 1000 times!!!

  • Adobe form is going to Spool directly want a print preview

    HI Experts,
    I have created a class where I am calling a standard Material document print form WOST_WSGM_MATDOC_PDF but it is directly going to spool.
    NOTE : I am calling this class method in one of my POWL Feeder class which is linked with standard GR print application and I want it to be previewed for user to save.
    Please refer the code below.
      DATA iv_funcname TYPE  funcname.
      CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
        EXPORTING
          i_name              = 'WOST_WSGM_MATDOC_PDF'"gc_mat_doc_form_name
        IMPORTING
          e_funcname          = iv_funcname  .
      DATA iv_outputparams TYPE  sfpoutputparams.
      CALL FUNCTION 'FP_JOB_OPEN'
        CHANGING
          ie_outputparams = iv_outputparams
        EXCEPTIONS
          cancel          = 1
          usage_error     = 2
          system_error    = 3
          internal_error  = 4
          OTHERS          = 5.
      IF sy-subrc <> 0.
    Implement suitable error handling here
      ENDIF.
      DATA fp_docparams TYPE sfpdocparams.
      DATA fp_formoutput TYPE fpformoutput.
    Now call the generated function module
      CALL FUNCTION iv_funcname
        EXPORTING
          /1bcdwb/docparams  = fp_docparams
          mat_doc_header     = es_mkpf
          doc_type_txt       = es_t003t
          vendor_data        = es_lfa1
          plant_data         = es_t001w
          move_plant_data    = es_t001w_move_plant
          mat_doc_item_tab   = et_mseg
          mat_doc_printgrgi  = et_printgrgi
        IMPORTING
          /1bcdwb/formoutput = fp_formoutput
        EXCEPTIONS
          usage_error        = 1
          system_error       = 2
          internal_error     = 3
          OTHERS             = 4.
      IF sy-subrc <> 0.
        CALL FUNCTION 'FP_GET_LAST_ADS_ERRSTR'
          IMPORTING
            e_adserrstr = ls_adserrstr.
      ENDIF.
    Close spool job
      CALL FUNCTION 'FP_JOB_CLOSE'
        EXCEPTIONS
          usage_error    = 1
          system_error   = 2
          internal_error = 3
          OTHERS         = 4.
    When  I am running this class individual then I am getting the print preview but when I am running it through portal by calling it in the feeder class then It is going directly to SPOOL request.

    try passing PREVIEW field  "X" in  FP_JOB_OPEN.
    Uma

  • Converting Smartforms to PDF and displaying Smartforms on print preview

    Hi,
    How to convert smartforms to pdf?
    How to attach this pdf to email?
    How to attach this pdf to the email and at the same time can print preview the smartforms?
    Thanks.

    Hi Navi,
    Code Snippet for Simple Mail
    *& Report  ZZ_TEST                                                     *
    REPORT  zz_test                                 .
    INCLUDE zz_test_top.
    INCLUDE zz_test01.
          FORM entry                                                    *
    -->  RETURN_CODE                                                   *
    -->  US_SCREEN                                                     *
    FORM entry USING return_code us_screen.
      CLEAR retcode.
      xscreen = us_screen.
      PERFORM processing USING us_screen.
      CASE retcode.
        WHEN 0.
          return_code = 0.
        WHEN 3.
          return_code = 3.
        WHEN OTHERS.
          return_code = 1.
      ENDCASE.
    ENDFORM.                    "entry
    *&  Include           ZZ_TEST_TOP                                      *
      TABLES : nast,
               tnapr.
    TYPES : BEGIN OF t_SOUDNAMEI1.
            INCLUDE STRUCTURE SOUDNAMEI1.
    TYPES : END OF t_SOUDNAMEI1.
    Internal Table declarations
      DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,
      i_tline TYPE TABLE OF tline WITH HEADER LINE,
      i_receivers TYPE TABLE OF somlreci1 WITH HEADER LINE,
      i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,
    *Objects to send mail.
      i_objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE,
      i_objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
      i_objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
      i_reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE,
      i_lips LIKE lips OCCURS 0 WITH HEADER LINE,
      i_SOUDNAMEI1 TYPE STANDARD TABLE OF t_SOUDNAMEI1.
    Work Area declarations
      DATA:w_objhead TYPE soli_tab,
      wa_control_parameters TYPE ssfctrlop,
      wa_output_options TYPE ssfcompop,
      w_return TYPE ssfcrescl,
      w_doc_chng TYPE sodocchgi1,
      w_data TYPE sodocchgi1,
      w_buffer TYPE string,"To convert from 132 to 255
      wa_SOUDNAMEI1 TYPE t_SOUDNAMEI1,
    Variables declarations
      w_form_name TYPE rs38l_fnam,
      w_len_in LIKE sood-objlen,
      w_len_out LIKE sood-objlen,
      w_len_outn TYPE i,
      w_lines_txt TYPE i,
      w_lines_bin TYPE i,
      retcode      TYPE sy-subrc,
      xscreen      TYPE c,
      w_spld TYPE usr01-spld,
      w_receiver TYPE SOXNA-FULLNAME,
      w_OBJ_RECORD TYPE OBJ_RECORD,
      w_user type sy-uname,
      w_email TYPE ad_smtpadr.
    Constants Declaration
      CONSTANTS : c_x TYPE c VALUE 'X',
                  c_atrate(1) TYPE c VALUE '@'.
    *&  Include           ZZ_TEST01                                        *
          FORM PROCESSING                                               *
    FORM processing USING proc_screen.
      SELECT * FROM lips
        INTO TABLE i_lips
        WHERE vbeln = nast-objky.
    Call Function module to Getfunction Module name Generated by Smartform
      CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
        EXPORTING
          formname           = tnapr-sform
        IMPORTING
          fm_name            = w_form_name
        EXCEPTIONS
          no_form            = 1
          no_function_module = 2
          OTHERS             = 3.
      IF sy-subrc <> 0.
        retcode = sy-subrc.
      ENDIF.
      CLEAR : wa_control_parameters,
              wa_output_options.
      CASE nast-nacha.
        WHEN '1'.
          wa_control_parameters-device    = 'PRINTER'.
        WHEN '7'.
          DATA: l_email TYPE ad_smtpadr.
          wa_output_options-tdnoprev = c_x.
          wa_control_parameters-getotf  = c_x.
    To get the default output device maintained in the
    User profile
         SELECT SINGLE spld FROM usr01
          INTO w_spld
          WHERE bname EQ nast-usnam.
          IF sy-subrc EQ 0.
            MOVE w_spld TO  wa_output_options-tddest   .
          ENDIF.
          wa_output_options-tdnoprev = c_x.
          wa_control_parameters-getotf  = c_x.
    To get the email address maintained for the particular output
          CALL FUNCTION 'NAST_GET_MESSAGE_OBJECT_RECV'
            EXPORTING
              pi_objkey             = nast-tdname
            IMPORTING
              pe_addr               = w_receiver
            CHANGING
              pc_objhandle          = w_obj_record
            EXCEPTIONS
              maildata_not_readable = 1
              OTHERS                = 2.
          IF sy-subrc <> 0.
            MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
           WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
          ENDIF.
          IF w_receiver NA c_atrate.
    To retrieve the E-Mail Id in case we get the User name from NAST
            CLEAR wa_soudnamei1.
            REFRESH i_soudnamei1.
            MOVE w_receiver TO wa_soudnamei1-fullname.
    To get the user name
            CALL FUNCTION 'SO_NAME_CONVERT_API1'
              EXPORTING
                name            = wa_soudnamei1
              TABLES
                names           = i_soudnamei1
              EXCEPTIONS
                user_not_exist  = 1
                parameter_error = 2
                x_error         = 3
                OTHERS          = 4.
            IF sy-subrc <> 0.
              MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
            ENDIF.
            CLEAR wa_soudnamei1.
            READ TABLE i_soudnamei1 INTO wa_soudnamei1 INDEX 1.
            MOVE wa_soudnamei1-sapname TO w_user.
    To get the e-mail Id maintained in the user profile
            CALL FUNCTION 'FTR_CORR_CHECK_EMAIL_SAP_USER'
              EXPORTING
                i_user              = w_user
              IMPORTING
                e_email_address     = l_email
              EXCEPTIONS
                mail_address        = 1
                determination_error = 2
                OTHERS              = 3.
            IF sy-subrc <> 0.
              MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
            ENDIF.
            MOVE l_email TO w_receiver.
          ENDIF.
          MOVE  w_receiver TO w_email.
      ENDCASE.
      wa_control_parameters-no_dialog = c_x.
      wa_control_parameters-langu     = nast-spras .
      wa_output_options-tdteleland    = nast-tland.
      wa_output_options-tdtelenum     = nast-telfx .
      wa_output_options-tdsenddate    = nast-erdat .
      wa_output_options-tdsendtime    = nast-eruhr .
      wa_output_options-tddataset     = nast-dsnam .
      wa_output_options-tdsuffix1     = nast-dsuf1 .
      wa_output_options-tdsuffix2     = nast-dsuf2 .
      wa_output_options-tdimmed       = nast-dimme .
      wa_output_options-tddelete      = nast-delet .
      wa_output_options-tdautority    = nast-tdautority.
      wa_output_options-tdcovtitle    = nast-tdcovtitle .
      wa_output_options-tdcover       = nast-tdocover .
      wa_output_options-tdreceiver    = nast-tdreceiver.
      wa_output_options-tddivision    = nast-tddivision.
      wa_output_options-tdcopies      = nast-anzal .
      wa_output_options-tdnewid       = c_x.
      wa_output_options-tdarmod       = nast-tdarmod.
      wa_output_options-tdnoarmch     = c_x.
      CALL FUNCTION w_form_name
        EXPORTING
         archive_index      = toa_dara
         archive_parameters = arc_params
          control_parameters = wa_control_parameters
          output_options     = wa_output_options
          user_settings      = ' '
        IMPORTING
          job_output_info    = w_return
        TABLES
          it_lips            = i_lips
        EXCEPTIONS
          formatting_error   = 1
          internal_error     = 2
          send_error         = 3
          user_canceled      = 4
          OTHERS             = 5.
      IF nast-nacha EQ 7 AND sy-subrc EQ 0.
        i_otf[] = w_return-otfdata[].
        CALL FUNCTION 'CONVERT_OTF'
          EXPORTING
            format                = 'PDF'
            max_linewidth         = 132
          IMPORTING
            bin_filesize          = w_len_in
          TABLES
            otf                   = i_otf
            lines                 = i_tline
          EXCEPTIONS
            err_max_linewidth     = 1
            err_format            = 2
            err_conv_not_possible = 3
            OTHERS                = 4.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
    Convert PDF from 132 to 255.
        LOOP AT i_tline.
    Replacing space by ~
          TRANSLATE i_tline USING ' ~'.
          CONCATENATE w_buffer i_tline INTO w_buffer.
        ENDLOOP.
    Replacing ~ by space
        TRANSLATE w_buffer USING '~ '.
        DO.
          i_record = w_buffer.
    Appending 255 characters as a record
          APPEND i_record.
          SHIFT w_buffer LEFT BY 255 PLACES.
          IF w_buffer IS INITIAL.
            EXIT.
          ENDIF.
        ENDDO.
        REFRESH: i_reclist,
        i_objtxt,
        i_objbin,
        i_objpack.
        CLEAR w_objhead.
    Object with PDF.
        i_objbin[] = i_record[].
        DESCRIBE TABLE i_objbin LINES w_lines_bin.
    Document information.
        w_doc_chng-obj_name = 'Smartform'.
        w_doc_chng-expiry_dat = sy-datum + 10.
        CONCATENATE 'Delivery' 'Note'
        INTO w_doc_chng-obj_descr.
    *w_doc_chng-obj_descr = 'Smart form output'.
        w_doc_chng-sensitivty = 'F'. "Functional object
        w_doc_chng-doc_size = w_lines_txt * 255.
    Pack to main body as RAW.
    Obj. to be transported not in binary form
        CLEAR i_objpack-transf_bin.
    Start line of object header in transport packet
        i_objpack-head_start = 1.
    Number of lines of an object header in object packet
        i_objpack-head_num = 0.
    Start line of object contents in an object packet
        i_objpack-body_start = 1.
    Number of lines of the object contents in an object packet
        i_objpack-body_num = w_lines_txt.
    Code for document class
        i_objpack-doc_type = 'RAW'.
        APPEND i_objpack.
    Packing as PDF.
        i_objpack-transf_bin = 'X'.
        i_objpack-head_start = 1.
        i_objpack-head_num = 1.
        i_objpack-body_start = 1.
        i_objpack-body_num = w_lines_bin.
        i_objpack-doc_type = 'PDF'.
        i_objpack-obj_name = 'Smartform'.
        CONCATENATE 'Delivery' 'Note' '.pdf'
        INTO i_objpack-obj_descr.
        i_objpack-doc_size = w_lines_bin * 255.
        APPEND i_objpack.
    Document information.
        CLEAR i_reclist.
    e-mail receivers.
        i_reclist-receiver = w_email.
        i_reclist-express = 'X'.
        i_reclist-rec_type = 'U'. "Internet address
        APPEND i_reclist.
    sending mail.
        CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
          EXPORTING
            document_data              = w_doc_chng
            put_in_outbox              = 'X'
          TABLES
            packing_list               = i_objpack
            object_header              = w_objhead
            contents_bin               = i_objbin
       contents_txt               = i_objtxt
            receivers                  = i_reclist
          EXCEPTIONS
            too_many_receivers         = 1
            document_not_sent          = 2
            document_type_not_exist    = 3
            operation_no_authorization = 4
            parameter_error            = 5
            x_error                    = 6
            enqueue_error              = 7
            OTHERS                     = 8.
        IF sy-subrc <> 0.
          MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
          WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
        ENDIF.
      ENDIF.
    ENDFORM.                    "processing
    OTF to PDF
    ========================================================================
    Program1
    *& REPORT  zpmm_print1
    REPORT  zpmm_print1.
    DATA : gw_ssfcrescl TYPE ssfcrescl.
    DATA: gt_otf TYPE STANDARD TABLE OF itcoo ,
          gt_tline TYPE STANDARD TABLE OF tline,
          gv_len LIKE sood-objlen,
          gw_ssfctrlop TYPE ssfctrlop, "for CONTROL_PARAMETERS
          gw_ssfcompop TYPE ssfcompop. "for OUTPUT_OPTIONS
    DATA  fm_name TYPE rs38l_fnam.
    gw_ssfctrlop-getotf = 'X'.
    gw_ssfctrlop-no_dialog = 'X'.
    gw_ssfcompop-tdnoprev = 'X'.
    CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
      EXPORTING
        formname           = 'ZPMM_1'
      IMPORTING
        fm_name            = fm_name
      EXCEPTIONS
        no_form            = 1
        no_function_module = 2
        OTHERS             = 3.
    IF sy-subrc <> 0.
    <error handling>
    ENDIF.
    CALL FUNCTION fm_name
    EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
       control_parameters         = gw_ssfctrlop
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
       output_options             = gw_ssfcompop
       user_settings              = 'X'
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
       job_output_info            = gw_ssfcrescl
      JOB_OUTPUT_OPTIONS         =
    EXCEPTIONS
      FORMATTING_ERROR           = 1
      INTERNAL_ERROR             = 2
      SEND_ERROR                 = 3
      USER_CANCELED              = 4
      OTHERS                     = 5
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    gt_otf[] = gw_ssfcrescl-otfdata[].
    CALL FUNCTION 'CONVERT_OTF'
      EXPORTING
        format                = 'PDF'
        max_linewidth         = 132
      IMPORTING
        bin_filesize          = gv_len
      TABLES
        otf                   = gt_otf
        lines                 = gt_tline
      EXCEPTIONS
        err_max_linewidth     = 1
        err_format            = 2
        err_conv_not_possible = 3
        OTHERS                = 4.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    DATA : gv_filename LIKE rlgrap-filename VALUE 'C:\swet.pdf'.
    CALL FUNCTION 'DOWNLOAD'
      EXPORTING
        bin_filesize     = gv_len
        filename         = gv_filename
        filetype         = 'BIN'
        filetype_no_show = 'X'
      IMPORTING
        act_filename     = gv_filename
        filesize         = gv_len
       cancel           = ''
      TABLES
        data_tab         = gt_tline.
    Program 2
    *& REPORT  zpmm_print2
    REPORT  zpmm_print2.
    DATA : gw_ssfcrescl TYPE ssfcrescl.
    DATA: gt_otf TYPE STANDARD TABLE OF itcoo ,
          gt_tline TYPE STANDARD TABLE OF tline,
          gv_len LIKE sood-objlen,
          gw_ssfctrlop TYPE ssfctrlop, "for CONTROL_PARAMETERS
          gw_ssfcompop TYPE ssfcompop. "for OUTPUT_OPTIONS
    DATA  fm_name TYPE rs38l_fnam.
    gw_ssfctrlop-getotf = 'X'.
    gw_ssfctrlop-no_dialog = 'X'.
    gw_ssfcompop-tdnoprev = 'X'.
    CALL FUNCTION '/1BCDWB/SF00000041'
    EXPORTING
      ARCHIVE_INDEX              =
      ARCHIVE_INDEX_TAB          =
      ARCHIVE_PARAMETERS         =
       control_parameters         = gw_ssfctrlop
      MAIL_APPL_OBJ              =
      MAIL_RECIPIENT             =
      MAIL_SENDER                =
       output_options             = gw_ssfcompop
       user_settings              = 'X'
    IMPORTING
      DOCUMENT_OUTPUT_INFO       =
       job_output_info            = gw_ssfcrescl
      JOB_OUTPUT_OPTIONS         =
    EXCEPTIONS
      FORMATTING_ERROR           = 1
      INTERNAL_ERROR             = 2
      SEND_ERROR                 = 3
      USER_CANCELED              = 4
      OTHERS                     = 5
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    gt_otf[] = gw_ssfcrescl-otfdata[].
    CALL FUNCTION 'CONVERT_OTF'
      EXPORTING
        format                = 'PDF'
        max_linewidth         = 132
      IMPORTING
        bin_filesize          = gv_len
      TABLES
        otf                   = gt_otf
        lines                 = gt_tline
      EXCEPTIONS
        err_max_linewidth     = 1
        err_format            = 2
        err_conv_not_possible = 3
        OTHERS                = 4.
    IF sy-subrc <> 0.
      MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
      WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    DATA : gv_filename LIKE rlgrap-filename VALUE 'C:\swet.pdf'.
    CALL FUNCTION 'DOWNLOAD'
      EXPORTING
        bin_filesize     = gv_len
        filename         = gv_filename
        filetype         = 'BIN'
        filetype_no_show = 'X'
      IMPORTING
        act_filename     = gv_filename
        filesize         = gv_len
       cancel           = ''
      TABLES
        data_tab         = gt_tline.
    =========================================================================
    Cheers
    Mohinder Singh Chauhan

  • SRM front end user cannot see buyer information in PO Print Preview

    Hello,
    In our SRM system, our purchasing users are not able to see the 'BUYER' information in the Print Preview screen within a PO.
    Previously, users with a requistioner role were running into the same issue, but this was resolved by added the following authorizations:
    S_USER_GRP ACTVT = 03 CLASS = *
    The purchasing users currently have access to the authorizations above, but are still not able to see the BUYER information in Print Preview.
    Any information is greatly appreciated.
    Thank you,
    CJB

    As the preview is showing info then print should be coming in same way. Try check in print properties or with other printer. In the same time try on a trace (ST01) while user is printing the PO. See if any relevant missing authorization is there or not.
    Regards,
    Arpan Paik

  • Not able to print preview or print Smartform after the changes

    Hi Experts,
    I made a small change to the smartform, saved it and activated it. Transport it to our QAS system for testing.
    But while trying to print preview the form i am not able to see any print/print preview. After my debug in the report that calls the form i found that at
    call function G_FM_NAME it is not importing any values at all.
    There was no change made on report or call function, we only change it on the smartform.
    Could somebody tell me what might be the problem.
    Thank you
    Mamatha

    i have no clue what your problem is, it would be too much of a guessing.
    But i have a way how you can find out what the problem is:
    After your "CALL FUNCTION fm_name"
    adopt your coding with following:
    IF sy-subrc NE 0.
      CALL FUNCTION 'SSF_READ_ERRORS'
              IMPORTING
                errortab = yy_lt_errors.
    ENDIF.
    this will give you a list of errors if there are any.
    Then have a look at that internal table, see the errornumbers and goto SE91 for outputclass "SSFCOMPOSER" and check what the message behind your error class is.
    This has helped me quite often.
    regards

  • Query on SRM Authorization for PO Print Preview from Web Browser

    Hi All,
    I would like to restrict PO Preview option in Web browser for users who has SAP_EC_BBP_EMPLOYEE Role only. Kindly let me know that how I can restrict the PO Preview option with popup message like 'Authorization is not given to see the PO Print Preview'.
    Thanks a lot in advance.
    Thanks,
    Sudarsan

    You can just revoke the authorization. This would remove the prining option for the user, rather than providing a message.
    I guess this should be
    Authorization Object - BBP_PD_PO
    Activity (ACTVT) - 04
    Note: The necesary object in the Object Class - BBP.
    Regards
    Kathirvel

  • Print & Print Preview in JSP application?

    Hi,
    I moved from swing to JSP. Trying to convert same Swing
    application to JSP application.In the swing application I used
    PRINT method in JPanel classes which implements PRINTABLE
    interface to format and print the data to the printer. Also I
    developed my own class to print preview the data(on a JFrame)
    before sending to the printer. So, each screen had print and
    print preview abilities.
    Now I&#8217;d like to have this functionality in JSP application too.
    Would appreciate to advice me if I could used same print preview
    java class(developed for swing application) in JSP application.
    If yes, please explain how. If No, please advice me how could I
    have print and print preview ability in JSP application.
    Any idea would appreciated.
    Thanks...Ali

    Hi,
    I am asking the JSP team to look at your question to see if
    they can help you.
    As you probably know, many java client functionalities will
    not map to JSP client functionality. That is why some people
    still prefer a java client if they want a richer UI.

  • OBJECTS_OBJREF_NOT_ASSIGNED-E-Recruitment Candidate Profile: Print Preview

    Hi Experts,
    On click of Print Preview on the candidate profile, I am getting short dump as follows:
    Runtime Errors OBJECTS_OBJREF_NOT_ASSIGNED
    Short text
    Access via 'NULL' object reference not possible.
    What happened?
       Error in the ABAP Application Program
       The current ABAP program "CL_BSP_RUNTIME================CP" had
        terminated because it has
       come across a statement that unfortunately cannot be executed.
    Error analysis
      You attempted to use a 'NULL' object reference (points to 'nothing')
      access a component (variable: " ").
      An object reference must point to an object (an instance of a class)
      before it can be used to access components.
      Either the reference was never set or it was set to 'NULL' using the
      CLEAR statement.
    Please guide.
    Thanks
    Deep
    Edited by: depeshn on Apr 22, 2009 8:50 AM

    Hello I am also getting the same problem. Will you plz tell how did you resolve this issue.

  • How i will see print Preview of an excel by clicking a button in java

    hi,
    I have created an excel file from java. Now i want to see the print preview of this file by clicking a button in java? Is it possible in java? I have used JExcelApi for this. Is there anybody can help me?
    This is my code:
    package image_handle;
        import jxl.Workbook;
        import jxl.write.*;
        import java.io.*;
        import javax.print.*;
        import javax.print.attribute.*;
    import javax.print.attribute.standard.*;
        public class Excel {
          public Excel(String name) {
           try{
            Workbook wb= Workbook.getWorkbook(new File("report.xls"));
           WritableWorkbook copy=Workbook.createWorkbook(new File("Workbook.xls"),wb);
          WritableSheet sheet = copy.getSheet(0);
          Label label = new Label(0,1,"Bina");
          sheet.addCell(label);
          Label label1 = new Label(1,1,"187");
          sheet.addCell(label1);
          WritableImage image = new WritableImage(2,3,2,4,new File(name));
          sheet.addImage(image);
          copy.write();
          sheet.p
           copy.close();
          catch(Exception ex){
            ex.printStackTrace();
    }I need solution urgently. PLease help me.
    With regards
    Bina

    Multi-Post
    http://forum.java.sun.com/thread.jspa?threadID=731384&tstart=-1

  • 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);

  • 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]

Maybe you are looking for

  • Camera Raw 5.3 Install Process Baffles Me

    Maybe I am overlooking the obvious, but I can find no reference to Cameraraw.8bi in the four decompressed files from the download of Camera Raw 5.3. The files that are expanded are 1) Setup, 2) Extensions, 3) Resources and 4) InstallerResults.dll. Pl

  • Temporar authority for another Maintenace status

    Hi, is it possible to give via User-exit or BADI some user the authoraty for another Maintenance status? Some users of the sales-department have the right materials in  Maintenance status V (=Sales). When they use MM02 they don't get Basic date (=K).

  • Packages loaded in serial

    In BW3.5 is it possible to configure an InfoPackage to load data in a serial fashion? What I mean is that one packet is processed (by a start routine) and loaded into the data target, before another is processed. The volume of data is much larger tha

  • Could not synchronize the color settings because of a program error.

    Hello, I am using PS CS 5 on a brand new MAC OSX 10.9.4. Upon startup of PS, I get this message: "Could not synchronize the color settings because of a program error." If I click "Okay", the message goes away and I can use PS. What does this message

  • Need XI Material

    Hi Experts, I am new to the XI ,please give me suggestions and send  me the useful materials & Scenarios on XI. Thanks in advance, Regards, vyaass.