Package org.apache.harmony.x.print.ipp

Examples of org.apache.harmony.x.print.ipp.IppDocument


            return supportedEx[0];
        }

        boolean supported = false;
        try {
            IppDocument document;
            IppResponse response;
            IppAttributeGroup agroup;
            IppAttributeGroupSet agroupset;
            Attribute[] attrs;
            String mime = null;
            String aname;

            aname = Ipp2Java.getIppAttributeNameByClass(attribute.getClass(),
                    -1);
            if (aname == null) {
                return false;
            }
            if (flavor == null) {
                mime = "application/octet-stream";
            } else {
                mime = java2ipp(flavor).getMimeType();
            }
            if (attributes == null || attributes.isEmpty()) {
                document = new IppDocument("Qwerty", mime, "");
                agroupset = new IppAttributeGroupSet();
                agroupset.setAttribute(aname, Ipp2Java.getIppByJava(attribute));
                response = printer.requestValidateJob(aname, document,
                        agroupset);
                agroup = response
                        .getGroup(IppAttributeGroup.TAG_UNSUPPORTED_ATTRIBUTES);

                if (agroup == null) {
                    supported = true;
                } else if (agroup != null && agroup.findAttribute(aname) < 0) {
                    supported = true;
                }
            } else {
                document = new IppDocument("Qwerty", mime, "");
                agroupset = new IppAttributeGroupSet();
                agroupset.setAttribute(aname, Ipp2Java.getIppByJava(attribute));
                attrs = attributes.toArray();
                for (int i = 0, ii = attrs.length; i < ii; i++) {
                    agroupset.setAttribute(Ipp2Java.getIppAttributeNameByClass(
View Full Code Here


    /*
     * request IppPrinter printer to print document
     */
    private void printsimple(Doc doc, HashAttributeSet as)
            throws PrintException {
        IppDocument document;
        IppResponse response;
        IppAttributeGroupSet agroupset;
        Attribute[] attrs;
        DocFlavor df = doc.getDocFlavor();
        String docname = doc.toString();

        try {
            document = new IppDocument(docname, java2ipp(df).getMimeType(), doc
                    .getPrintData());

            agroupset = new IppAttributeGroupSet();
            attrs = as.toArray();
            for (int i = 0, ii = attrs.length; i < ii; i++) {
                agroupset.setAttribute(Ipp2Java.getIppAttributeNameByClass(
                        attrs[i].getClass(), -1), Ipp2Java
                        .getIppByJava(attrs[i]));
            }
            document.setAgroups(agroupset);

            doVerbose(1, "Validating print job...");
            response = printer.requestValidateJob(docname, document, agroupset);
            doVerbose(1, response.toString());
            checkResponseIsZero(response, "IPP Validate Job: \n");
View Full Code Here

        /*
         * SPECIAL processing application/ps
         */
        if (mime.equals("application/postscript")) {
            try {
                IppDocument document = new IppDocument("Qwerty",
                        "application/postscript", "");
                IppResponse response = printer.requestValidateJob("Qwerty",
                        document, null);
                if (response.getStatusCode() != 0) {
                    document = new IppDocument("Qwerty", "application/ps", "");
                    response = printer.requestValidateJob("Qwerty", document,
                            null);
                    if (response.getStatusCode() == 0) {
                        if (pDocFlavor instanceof DocFlavor.INPUT_STREAM) {
                            ippDocFlavor = new DocFlavor.INPUT_STREAM(
View Full Code Here

            return supportedEx[0];
        }

        boolean supported = false;
        try {
            IppDocument document;
            IppResponse response;
            IppAttributeGroup agroup;
            IppAttributeGroupSet agroupset;
            Attribute[] attrs;
            String mime = null;
            String aname;

            aname = Ipp2Java.getIppAttributeNameByClass(attribute.getClass(),
                    -1);
            if (aname == null) {
                return false;
            }
            if (flavor == null) {
                mime = "application/octet-stream";
            } else {
                mime = java2ipp(flavor).getMimeType();
            }
            if (attributes == null || attributes.isEmpty()) {
                document = new IppDocument("Qwerty", mime, "");
                agroupset = new IppAttributeGroupSet();
                agroupset.setAttribute(aname, Ipp2Java.getIppByJava(attribute));
                response = printer.requestValidateJob(aname, document,
                        agroupset);
                agroup = response
                        .getGroup(IppAttributeGroup.TAG_UNSUPPORTED_ATTRIBUTES);

                if (agroup == null) {
                    supported = true;
                } else if (agroup != null && agroup.findAttribute(aname) < 0) {
                    supported = true;
                }
            } else {
                document = new IppDocument("Qwerty", mime, "");
                agroupset = new IppAttributeGroupSet();
                agroupset.setAttribute(aname, Ipp2Java.getIppByJava(attribute));
                attrs = attributes.toArray();
                for (int i = 0, ii = attrs.length; i < ii; i++) {
                    agroupset.setAttribute(Ipp2Java.getIppAttributeNameByClass(
View Full Code Here

    /*
     * request IppPrinter printer to print document
     */
    private void printsimple(Doc doc, HashAttributeSet as)
            throws PrintException {
        IppDocument document;
        IppResponse response;
        IppAttributeGroupSet agroupset;
        Attribute[] attrs;
        DocFlavor df = doc.getDocFlavor();
        String docname = doc.toString();

        try {
            document = new IppDocument(docname, java2ipp(df).getMimeType(), doc
                    .getPrintData());

            agroupset = new IppAttributeGroupSet();
            attrs = as.toArray();
            for (int i = 0, ii = attrs.length; i < ii; i++) {
                agroupset.setAttribute(Ipp2Java.getIppAttributeNameByClass(
                        attrs[i].getClass(), -1), Ipp2Java
                        .getIppByJava(attrs[i]));
            }
            document.setAgroups(agroupset);

            doVerbose(1, "Validating print job...");
            response = printer.requestValidateJob(docname, document, agroupset);
            doVerbose(1, response.toString());
            checkResponseIsZero(response, "IPP Validate Job: \n");
View Full Code Here

        /*
         * SPECIAL processing application/ps
         */
        if (mime.equals("application/postscript")) {
            try {
                IppDocument document = new IppDocument("Qwerty",
                        "application/postscript", "");
                IppResponse response = printer.requestValidateJob("Qwerty",
                        document, null);
                if (response.getStatusCode() != 0) {
                    document = new IppDocument("Qwerty", "application/ps", "");
                    response = printer.requestValidateJob("Qwerty", document,
                            null);
                    if (response.getStatusCode() == 0) {
                        if (pDocFlavor instanceof DocFlavor.INPUT_STREAM) {
                            ippDocFlavor = new DocFlavor.INPUT_STREAM(
View Full Code Here

            return supportedEx[0];
        }

        boolean supported = false;
        try {
            IppDocument document;
            IppResponse response;
            IppAttributeGroup agroup;
            IppAttributeGroupSet agroupset;
            Attribute[] attrs;
            String mime = null;
            String aname;

            aname = Ipp2Java.getIppAttributeNameByClass(attribute.getClass(),
                    -1);
            if (aname == null) {
                return false;
            }
            if (flavor == null) {
                mime = "application/octet-stream";
            } else {
                mime = java2ipp(flavor).getMimeType();
            }
            if (attributes == null || attributes.isEmpty()) {
                document = new IppDocument("Qwerty", mime, "");
                agroupset = new IppAttributeGroupSet();
                agroupset.setAttribute(aname, Ipp2Java.getIppByJava(attribute));
                response = printer.requestValidateJob(aname, document,
                        agroupset);
                agroup = response
                        .getGroup(IppAttributeGroup.TAG_UNSUPPORTED_ATTRIBUTES);

                if (agroup == null) {
                    supported = true;
                } else if (agroup != null && agroup.findAttribute(aname) < 0) {
                    supported = true;
                }
            } else {
                document = new IppDocument("Qwerty", mime, "");
                agroupset = new IppAttributeGroupSet();
                agroupset.setAttribute(aname, Ipp2Java.getIppByJava(attribute));
                attrs = attributes.toArray();
                for (int i = 0, ii = attrs.length; i < ii; i++) {
                    agroupset.setAttribute(Ipp2Java.getIppAttributeNameByClass(
View Full Code Here

    /*
     * request IppPrinter printer to print document
     */
    private void printsimple(Doc doc, HashAttributeSet as)
            throws PrintException {
        IppDocument document;
        IppResponse response;
        IppAttributeGroupSet agroupset;
        Attribute[] attrs;
        DocFlavor df = doc.getDocFlavor();
        String docname = doc.toString();

        try {
            document = new IppDocument(docname, java2ipp(df).getMimeType(), doc
                    .getPrintData());

            agroupset = new IppAttributeGroupSet();
            attrs = as.toArray();
            for (int i = 0, ii = attrs.length; i < ii; i++) {
                agroupset.setAttribute(Ipp2Java.getIppAttributeNameByClass(
                        attrs[i].getClass(), -1), Ipp2Java
                        .getIppByJava(attrs[i]));
            }
            document.setAgroups(agroupset);

            doVerbose(1, "Validating print job...");
            response = printer.requestValidateJob(docname, document, agroupset);
            doVerbose(1, response.toString());
            checkResponseIsZero(response, "IPP Validate Job: \n");
View Full Code Here

        /*
         * SPECIAL processing application/ps
         */
        if (mime.equals("application/postscript")) {
            try {
                IppDocument document = new IppDocument("Qwerty",
                        "application/postscript", "");
                IppResponse response = printer.requestValidateJob("Qwerty",
                        document, null);
                if (response.getStatusCode() != 0) {
                    document = new IppDocument("Qwerty", "application/ps", "");
                    response = printer.requestValidateJob("Qwerty", document,
                            null);
                    if (response.getStatusCode() == 0) {
                        if (pDocFlavor instanceof DocFlavor.INPUT_STREAM) {
                            ippDocFlavor = new DocFlavor.INPUT_STREAM(
View Full Code Here

TOP

Related Classes of org.apache.harmony.x.print.ipp.IppDocument

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.