Package java.awt.print

Examples of java.awt.print.PageFormat


        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void printButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_printButtonActionPerformed
        PrinterJob pjob = PrinterJob.getPrinterJob();
        PageFormat pf = pjob.defaultPage();
        pjob.setPrintable(this, pf);

        try {
            if (pjob.printDialog()) {
                pjob.print();
View Full Code Here


                        {
                            public void actionPerformed (ActionEvent ev)
                            {
                                final PrinterJob printerJob = PrinterJob.getPrinterJob();
                                if (m_pageFormat == null) m_pageFormat = printerJob.defaultPage();
                                PageFormat pf = printerJob.pageDialog(m_pageFormat);
                                if (pf != m_pageFormat)
                                {
                                    m_pageFormat = pf;
                                    printerJob.setPrintable(m_imgView, m_pageFormat);
                                    printerJob.setJobName(Main.getString("caption"));
View Full Code Here

     */
    public PageFormat getPageFormat(int pageIndex)
    {
        PDPage page = (PDPage)getDocumentCatalog().getAllPages().get( pageIndex );
        PDRectangle mediaBox = page.findMediaBox();
        PageFormat format = new PageFormat();
        Paper paper = new Paper();
        //hmm the imageable area might need to be the CropBox instead
        //of the media box???
        double width=mediaBox.getWidth();
        double height=mediaBox.getHeight();
        if( width > height )
        {
            format.setOrientation( PageFormat.LANDSCAPE );
            width=mediaBox.getHeight();
            height=mediaBox.getWidth();
        }
        paper.setImageableArea( 0,0,width,height);
        paper.setSize( width, height );
        format.setPaper( paper );
        return format;
    }
View Full Code Here

        frame.setSize( 1000, 700 );
        frame.show();
*/

        showPageSetupDialog( null );
        final PageFormat pf = getPageFormat();
        dumpPage( pf );

        //print( image, args[0], frame );
        System.exit( 0 );
    }
View Full Code Here

        System.out.println("Setting PageFormat");
        dumpPage(pageFormat);
    }

    public PageFormat getPageFormat() {
        PageFormat pf = WindowsPrintManager.getPageFormat();
        if (pf != null) {
            System.out.println("Printer PageFormat");
            dumpPage(pf);
        }
        return pf;
View Full Code Here

                    info.m_pageBoundsHeight, info.m_pageBoundsWidth
                );
                break;
        }

        final PageFormat format = new PageFormat();
        format.setOrientation( info.m_orientation );
        format.setPaper( paper );
        return format;
    }
View Full Code Here

        );
        dialog.addPageSetupAction(
            new ActionListener() {
                public void actionPerformed(ActionEvent event) {
                    PrinterLayer printer = Platform.getPlatform().getPrinterLayer();
                    PageFormat format = printer.pageDialog(null);

                    if (format != null)
                        dialog.setPageFormat(format);
                }
            }
View Full Code Here

            image = ImageIO.read(new File(args[0]));
        } catch (IOException e) {
            e.printStackTrace();
            System.exit(-1);
        }
        PageFormat format = new PageFormat();

        JFrame frame = new JFrame("PreviewComponent Test");
        frame.setContentPane(new PreviewComponent(image, format));
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setBounds(100, 100, 400, 400);
View Full Code Here

class PreviewPanel extends JPanel implements PrintLayoutModelListener {

    private PreviewComponent component;

    PreviewPanel(BufferedImage image, PrintLayoutModel model) {
        PageFormat page = model.getPageFormat();
        component = new PreviewComponent(image, page);
        layoutChanged(model);
        setLayout(new BorderLayout());
        add(component);
        Border border = BorderFactory.createTitledBorder("Preview");
View Full Code Here

        setBorder(border);
        model.addListener(this);
    }

    public void layoutChanged(PrintLayoutModel model) {
        PageFormat page = model.getPageFormat();
        component.setPageFormat(page);
        Rectangle2D rect = model.getImageRect();
        component.setImageRect(rect);
    }
View Full Code Here

TOP

Related Classes of java.awt.print.PageFormat

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.