使用apacheFOP将Image转换为pcl

时间:2016-03-01 17:07:38

标签: java apache-fop

我要求我想将GIF图像转换为PCL,并使用Apach FOP从打印机的特定托盘打印该pcl文件。我可以举个例子吗?

2 个答案:

答案 0 :(得分:0)

您可以查看以下文件:

https://github.com/apache/camel/blob/master/components/camel-fop/src/main/java/org/apache/camel/component/fop/FopOutputType.java#L0

    pdf("application/pdf"),
    ps("application/postscript"),
    pcl("application/x-pcl"),
    png("image/png"),
    jpeg("image/jpeg"),
    svg("image/svg+xml"),
    xml("application/X-fop-areatree"),
    mif("application/mif"),
    rtf("application/rtf"),
    txt("text/plain");

    private final String outputFormatExtended;

    FopOutputType(String outputFormatExtended) {
        this.outputFormatExtended = outputFormatExtended;
    }

    public String getFormatExtended() {
        return outputFormatExtended;
    }

    public static FopOutputType asFooOutputType(String outputFormatExtended) {
        if ("application/pdf".equalsIgnoreCase(outputFormatExtended)) {
            return pdf;
        } else if ("application/postscript".equalsIgnoreCase(outputFormatExtended)) {
            return ps;
        } else if ("application/x-pcl".equalsIgnoreCase(outputFormatExtended)) {
            return pcl;
        } else if ("image/png".equalsIgnoreCase(outputFormatExtended)) {
            return png;
        } else if ("image/jpeg".equalsIgnoreCase(outputFormatExtended)) {
            return jpeg;
        } else if ("image/svg+xml".equalsIgnoreCase(outputFormatExtended)) {
            return svg;
        } else if ("application/X-fop-areatree".equalsIgnoreCase(outputFormatExtended)) {
            return xml;
        } else if ("application/mif".equalsIgnoreCase(outputFormatExtended)) {
            return mif;
        } else if ("application/rtf".equalsIgnoreCase(outputFormatExtended)) {
            return rtf;
        } else if ("text/plain".equalsIgnoreCase(outputFormatExtended)) {
            return txt;
        }

        return null;
    }

答案 1 :(得分:0)

这可能会对您有所帮助:code example