Examples of HashPrintRequestAttributeSet


Examples of javax.print.attribute.HashPrintRequestAttributeSet

    if (servicesBox.getItemCount() <= 0) {
        for (int i = 0; i < services.length; i++) {
            servicesBox.addItem(services[i].getName());
        }
    }
    newAttrs = new HashPrintRequestAttributeSet(attrs);

    prepareDialog();        // Prepare dialog
    servicesBox.setSelectedIndex(defServiceIndex)
                            // Select default PrintService and
                            // initialize dialog fields
View Full Code Here

Examples of javax.print.attribute.HashPrintRequestAttributeSet

    if ((requestAttrs == null) || (aService == null)) {
        return SETUP_ERROR;
    }
   
    attrs = requestAttrs;
    newAttrs = new HashPrintRequestAttributeSet(attrs);
    myService = aService;
   
    prepareDialog();        // prepare dialog
    fillPageSetupFields()// Initialize dialog fields
    firstUse = false;
View Full Code Here

Examples of javax.print.attribute.HashPrintRequestAttributeSet

//---------------------------------------------------------------------
/*
* Getting result attribute set after OK button click
*/
protected boolean updateAttributes() {
    newAttrs = new HashPrintRequestAttributeSet(attrs);
    if (dialogType == PRINT_DIALOG) {
        updateCopies();
        updateCollate();
        if (!updatePrintRange()) {
            JOptionPane.showMessageDialog(printDialog,
View Full Code Here

Examples of javax.print.attribute.HashPrintRequestAttributeSet

    private FopFactory fopFactory = FopFactory.newInstance();

    private DocPrintJob createDocPrintJob() {
        PrintService[] services = PrintServiceLookup.lookupPrintServices(
                DocFlavor.SERVICE_FORMATTED.PAGEABLE, null);
        PrintRequestAttributeSet attributes = new HashPrintRequestAttributeSet();
        PrintService printService = ServiceUI.printDialog(null, 50, 50,
                services, services[0], null, attributes);
        if (printService != null) {
            return printService.createPrintJob();
        } else {
View Full Code Here

Examples of javax.print.attribute.HashPrintRequestAttributeSet

                ps = printservice;
            }

            if (ps != null)  {

                PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
                aset.add(OrientationRequested.PORTRAIT);
                aset.add(new JobName(AppLocal.APP_NAME + " - Document", null));
                aset.add(media);

                DocPrintJob printjob = ps.createPrintJob();
                Doc doc = new SimpleDoc(new PrintableBasicTicket(m_ticketcurrent, imageable_x, imageable_y, imageable_width, imageable_height), DocFlavor.SERVICE_FORMATTED.PRINTABLE, null);

                printjob.print(doc, aset);
View Full Code Here

Examples of javax.print.attribute.HashPrintRequestAttributeSet

        pf.setOrientation(nOrientacion);

        printJob = PrinterJob.getPrinterJob();
        if (printJob != null)
        {
            HashPrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet();
            printRequestAttributeSet.add(PrintQuality.DRAFT);
            // tenemos que calcular el n�mero de p�ginas. Para ello vamos a suponer que el papel utilizado es din A4.
            int numpaginas = getNumPaginas(ElComponenteAImprimir,159.2 , 246.2, PageFormat.PORTRAIT);

            pageRanges = new PageRanges(1, numpaginas); // una sola pagina
            printRequestAttributeSet.add(pageRanges);

            if (printJob.printDialog(printRequestAttributeSet))
            {
                try {
                    pageRanges = (PageRanges) printRequestAttributeSet.get(PageRanges.class);
                    MediaPrintableArea mpa = (MediaPrintableArea)printRequestAttributeSet.get(MediaPrintableArea.class);
                    float medidas[] = mpa.getPrintableArea(MediaPrintableArea.MM); // x, y , ancho y alto

                    OrientationRequested orientation = (OrientationRequested) printRequestAttributeSet.get(OrientationRequested.class);
                    if (orientation==null)
                        pf.setOrientation(PageFormat.PORTRAIT);
                    else if (orientation.equals(OrientationRequested.LANDSCAPE))
                        pf.setOrientation(PageFormat.LANDSCAPE);
                    else if (orientation.equals(OrientationRequested.PORTRAIT))
View Full Code Here

Examples of javax.print.attribute.HashPrintRequestAttributeSet

    private DocFlavor assignDocFlavor() throws Exception {
        return config.getDocFlavor();     
    }   

    private PrintRequestAttributeSet assignPrintAttributes() throws PrintException {
        PrintRequestAttributeSet printRequestAttributeSet = new HashPrintRequestAttributeSet();
        if (config.getCopies() >= 1) {
            printRequestAttributeSet.add(new Copies(config.getCopies()));
        } else {
            throw new PrintException("Number of print copies should be greater than zero");
        }
        printRequestAttributeSet.add(config.getMediaSizeName());
        printRequestAttributeSet.add(config.getInternalSides());
       
        return printRequestAttributeSet;
    }
View Full Code Here

Examples of javax.print.attribute.HashPrintRequestAttributeSet

     *  Printable or Pageable then those interfaces are used to print
     *  it.
     */
    protected void _print() {
        // Build a set of attributes
        PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
        PrinterJob job = PrinterJob.getPrinterJob();

        if (this instanceof Pageable) {
            job.setPageable((Pageable) this);
        } else if (this instanceof Printable) {
View Full Code Here

Examples of javax.print.attribute.HashPrintRequestAttributeSet

     *  behind other windows.  However, it does honor
     *  the user's choice of portrait vs. landscape
     */
    protected void _printCrossPlatform() {
        // Build a set of attributes
        PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
        PrinterJob job = PrinterJob.getPrinterJob();
        job.setPrintable(plot);

        if (job.printDialog(aset)) {
            try {
View Full Code Here

Examples of javax.print.attribute.HashPrintRequestAttributeSet

        public void actionPerformed(ActionEvent event) {
            if (event.getSource() == _fillButton) {
                fillPlot();
            } else if (event.getSource() == _printButton) {
                // FIXME:  Code duplication with PlotFrame._printCrossPlatform
                PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
                PrinterJob job = PrinterJob.getPrinterJob();

                // rbeyer@LPL.Arizona.EDU: Get the Page Format and use it.
                //PageFormat format = job.pageDialog(job.defaultPage());
                //job.setPrintable(PlotBox.this, format);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.