当前位置: 首页>>代码示例>>Java>>正文


Java MimeConstants.MIME_PDF属性代码示例

本文整理汇总了Java中org.apache.fop.apps.MimeConstants.MIME_PDF属性的典型用法代码示例。如果您正苦于以下问题:Java MimeConstants.MIME_PDF属性的具体用法?Java MimeConstants.MIME_PDF怎么用?Java MimeConstants.MIME_PDF使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.fop.apps.MimeConstants的用法示例。


在下文中一共展示了MimeConstants.MIME_PDF属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createFopInstance

/** Returns a new Fop instance. Note: FOP documentation recommends using
 * a Fop instance for one transform run only.
 * @param out The target (result) OutputStream instance
 * @param outputFormat Optional output format, defaults to "application/pdf"
 * @param foUserAgent FOUserAgent object which may contains encryption-params in render options
 * @return Fop instance
 */
public static Fop createFopInstance(OutputStream out, String outputFormat, FOUserAgent foUserAgent) throws FOPException {
    if (UtilValidate.isEmpty(outputFormat)) {
        outputFormat = MimeConstants.MIME_PDF;
    }
    if (UtilValidate.isEmpty(foUserAgent)) {
        FopFactory fopFactory = getFactoryInstance();
        foUserAgent = fopFactory.newFOUserAgent();
    }
    Fop fop;
    if (out != null) {
        fop = fopFactory.newFop(outputFormat, foUserAgent, out);
    } else {
        fop = fopFactory.newFop(outputFormat, foUserAgent);
    }
    return fop;
}
 
开发者ID:ilscipio,项目名称:scipio-erp,代码行数:23,代码来源:ApacheFopWorker.java

示例2: parseUnknownOption

private int parseUnknownOption(String[] args, int i) throws FOPException {
    if (inputmode == NOT_SET) {
        inputmode = FO_INPUT;
        String filename = args[i];
        if (isSystemInOutFile(filename)) {
            this.useStdIn = true;
        } else {
            fofile = new File(filename);
        }
    } else if (outputmode == null) {
        outputmode = MimeConstants.MIME_PDF;
        setOutputFile(args[i]);
    } else {
        throw new FOPException("Don't know what to do with "
                       + args[i]);
    }
    return 0;
}
 
开发者ID:pellcorp,项目名称:fop,代码行数:18,代码来源:CommandLineOptions.java

示例3: setupApacheFopMime

private String setupApacheFopMime(FOSettings settings) {
String ret = settings.getApacheFopMime();
	if (ret == null) {
		ret = MimeConstants.MIME_PDF;
	}
	return ret;
}
 
开发者ID:plutext,项目名称:docx4j-export-FO,代码行数:7,代码来源:FORendererApacheFOP.java

示例4: writePDF

private void writePDF(String xmlName, String outfileBasename) {

		if (!OutputFormat.toLowerCase().contains("pdf"))
			return;

		StatusBoard.getStatusBoard().statusChanged(STATUS_WRITE_PDF);

		String pdffileName = outfileBasename + ".pdf";
		String mime = MimeConstants.MIME_PDF;

		if (xmlName != null && xmlName.length() > 0 && xslfofileName != null && xslfofileName.length() > 0
				&& pdffileName != null && pdffileName.length() > 0) {
			fopWrite(xmlName, xslfofileName, pdffileName, mime);
		}
	}
 
开发者ID:ShapeChange,项目名称:ShapeChange,代码行数:15,代码来源:FeatureCatalogue.java

示例5: createFopInstance

/** Returns a new Fop instance. Note: FOP documentation recommends using
 * a Fop instance for one transform run only.
 * @param out The target (result) OutputStream instance
 * @param outputFormat Optional output format, defaults to "application/pdf"
 * @return Fop instance
 */
public static Fop createFopInstance(OutputStream out, String outputFormat) throws FOPException {
    if (UtilValidate.isEmpty(outputFormat)) {
        outputFormat = MimeConstants.MIME_PDF;
    }
    FopFactory fopFactory = getFactoryInstance();
    FOUserAgent foUserAgent = fopFactory.newFOUserAgent();
    Fop fop;
    if (out != null) {
        fop = fopFactory.newFop(outputFormat, foUserAgent, out);
    } else {
        fop = fopFactory.newFop(outputFormat, foUserAgent);
    }
    return fop;
}
 
开发者ID:gildaslemoal,项目名称:elpi,代码行数:20,代码来源:ApacheFopWorker.java

示例6: concatToPDF

/**
 * Concatenates an array of area tree XML files to a single PDF file.
 * @param files the array of area tree XML files
 * @param pdffile the target PDF file
 * @throws IOException In case of an I/O problem
 * @throws TransformerException In case of a XSL transformation problem
 * @throws SAXException In case of an XML-related problem
 */
public void concatToPDF(File[] files, File pdffile)
        throws IOException, TransformerException, SAXException {
    // Setup output
    OutputStream out = new java.io.FileOutputStream(pdffile);
    out = new java.io.BufferedOutputStream(out);
    try {
        //Setup fonts and user agent
        FontInfo fontInfo = new FontInfo();
        FOUserAgent userAgent = fopFactory.newFOUserAgent();

        //Construct the AreaTreeModel that will received the individual pages
        AreaTreeModel treeModel = new RenderPagesModel(userAgent,
                MimeConstants.MIME_PDF, fontInfo, out);

        //Iterate over all area tree files
        AreaTreeParser parser = new AreaTreeParser();
        for (int i = 0; i < files.length; i++) {
            Source src = new StreamSource(files[i]);
            parser.parse(src, treeModel, userAgent);
        }

        //Signal the end of the processing. The renderer can finalize the target document.
        treeModel.endDocument();
    } finally {
        out.close();
    }
}
 
开发者ID:pellcorp,项目名称:fop,代码行数:35,代码来源:ExampleConcat.java

示例7: stampToPDF

/**
 * Stamps an area tree XML file and renders it to a PDF file.
 * @param atfile the area tree XML file
 * @param stampSheet the stylesheet that does the stamping
 * @param pdffile the target PDF file
 * @throws IOException In case of an I/O problem
 * @throws TransformerException In case of a XSL transformation problem
 * @throws SAXException In case of an XML-related problem
 */
public void stampToPDF(File atfile, File stampSheet, File pdffile)
        throws IOException, TransformerException, SAXException {
    // Setup output
    OutputStream out = new java.io.FileOutputStream(pdffile);
    out = new java.io.BufferedOutputStream(out);
    try {
        //Setup fonts and user agent
        FontInfo fontInfo = new FontInfo();
        FOUserAgent userAgent = fopFactory.newFOUserAgent();

        //Construct the AreaTreeModel that will received the individual pages
        AreaTreeModel treeModel = new RenderPagesModel(userAgent,
                MimeConstants.MIME_PDF, fontInfo, out);

        //Iterate over all area tree files
        AreaTreeParser parser = new AreaTreeParser();
        Source src = new StreamSource(atfile);
        Source xslt = new StreamSource(stampSheet);

        //Setup Transformer for XSLT processing
        TransformerFactory tFactory = TransformerFactory.newInstance();
        Transformer transformer = tFactory.newTransformer(xslt);

        //Send XSLT result to AreaTreeParser
        SAXResult res = new SAXResult(parser.getContentHandler(treeModel, userAgent));

        //Start XSLT transformation and area tree parsing
        transformer.transform(src, res);

        //Signal the end of the processing. The renderer can finalize the target document.
        treeModel.endDocument();
    } finally {
        out.close();
    }
}
 
开发者ID:pellcorp,项目名称:fop,代码行数:44,代码来源:ExampleStamp.java

示例8: concatToPDF

/**
 * Concatenates an array of intermediate files to a single PDF file.
 * @param files the array of intermediate files
 * @param pdffile the target PDF file
 * @throws IOException In case of an I/O problem
 * @throws TransformerException In case of a XSL transformation problem
 * @throws SAXException In case of an XML-related problem
 * @throws IFException if there was an IF-related error while creating the output file
 */
public void concatToPDF(File[] files, File pdffile)
        throws IOException, TransformerException, SAXException, IFException {
    // Setup output
    OutputStream out = new java.io.FileOutputStream(pdffile);
    out = new java.io.BufferedOutputStream(out);
    try {
        //Setup user agent
        FOUserAgent userAgent = fopFactory.newFOUserAgent();

        //Setup target handler
        String mime = MimeConstants.MIME_PDF;
        IFDocumentHandler targetHandler = fopFactory.getRendererFactory().createDocumentHandler(
                userAgent, mime);

        //Setup fonts
        IFUtil.setupFonts(targetHandler);
        targetHandler.setResult(new StreamResult(pdffile));

        IFConcatenator concatenator = new IFConcatenator(targetHandler, null);

        //Iterate over all intermediate files
        for (int i = 0; i < files.length; i++) {
            Source src = new StreamSource(files[i]);
            concatenator.appendDocument(src);
        }

        //Signal the end of the processing so the target file can be finalized properly.
        concatenator.finish();
    } finally {
        out.close();
    }
}
 
开发者ID:pellcorp,项目名称:fop,代码行数:41,代码来源:ExampleConcat.java

示例9: stampToPDF

/**
 * Stamps an intermediate file and renders it to a PDF file.
 * @param iffile the intermediate file (area tree XML)
 * @param stampSheet the stylesheet that does the stamping
 * @param pdffile the target PDF file
 * @throws IOException In case of an I/O problem
 * @throws TransformerException In case of a XSL transformation problem
 * @throws SAXException In case of an XML-related problem
 * @throws IFException if there was an IF-related error while creating the output file
 */
public void stampToPDF(File iffile, File stampSheet, File pdffile)
        throws IOException, TransformerException, SAXException, IFException {
    // Setup output
    OutputStream out = new java.io.FileOutputStream(pdffile);
    out = new java.io.BufferedOutputStream(out);
    try {
        //user agent
        FOUserAgent userAgent = fopFactory.newFOUserAgent();

        //Setup target handler
        String mime = MimeConstants.MIME_PDF;
        IFDocumentHandler targetHandler = fopFactory.getRendererFactory().createDocumentHandler(
                userAgent, mime);

        //Setup fonts
        IFUtil.setupFonts(targetHandler);
        targetHandler.setResult(new StreamResult(pdffile));

        IFParser parser = new IFParser();

        Source src = new StreamSource(iffile);
        Source xslt = new StreamSource(stampSheet);

        //Setup Transformer for XSLT processing
        TransformerFactory tFactory = TransformerFactory.newInstance();
        Transformer transformer = tFactory.newTransformer(xslt);

        //Send XSLT result to AreaTreeParser
        SAXResult res = new SAXResult(parser.getContentHandler(targetHandler, userAgent));

        //Start XSLT transformation and area tree parsing
        transformer.transform(src, res);
    } finally {
        out.close();
    }
}
 
开发者ID:pellcorp,项目名称:fop,代码行数:46,代码来源:ExampleStamp.java

示例10: normalizeOutputFormat

private String normalizeOutputFormat(String format) {
    if (format == null) {
        return MimeConstants.MIME_PDF;
    }
    for (int i = 0; i < SHORT_NAMES.length; i++) {
        if (SHORT_NAMES[i][0].equals(format)) {
            return SHORT_NAMES[i][1];
        }
    }
    return format; //no change
}
 
开发者ID:pellcorp,项目名称:fop,代码行数:11,代码来源:Fop.java

示例11: init

private void init(){
	outputMime=MimeConstants.MIME_PDF;
	extension=".pdf";
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:4,代码来源:PrintPDF.java

示例12: PdfReportOutput

public PdfReportOutput(OutputStream outStream,
                       PdfOutputFormat outputFormat,
                       Configuration fopConfig) {
    super(outStream, outputFormat, MimeConstants.MIME_PDF, fopConfig, null);
}
 
开发者ID:humbletrader,项目名称:katechaki,代码行数:5,代码来源:PdfReportOutput.java

示例13: FOP2PDFSerializer

public FOP2PDFSerializer()
{
	mimeType = MimeConstants.MIME_PDF;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:4,代码来源:FOP2PDFSerializer.java

示例14: getMimeType

/** {@inheritDoc} */
public String getMimeType() {
    return MimeConstants.MIME_PDF;
}
 
开发者ID:pellcorp,项目名称:fop,代码行数:4,代码来源:PDFDocumentHandler.java

示例15: parseArguments

private void parseArguments(String[] args) {
    if (args.length > 0) {
        int idx = 0;
        if ("--help".equals(args[idx]) || "-?".equals(args[idx]) || "-h".equals(args[idx])) {
            printHelp();
            System.exit(0);
        }
        if (idx < args.length - 1 && "-c".equals(args[idx])) {
            String filename = args[idx + 1];
            this.configFile = new File(filename);
            idx += 2;
        }
        if (idx < args.length - 1 && "-f".equals(args[idx])) {
            this.configMime = args[idx + 1];
            idx += 2;
        }
        if (idx < args.length) {
            String name = args[idx];
            this.outputFile = new File(name);
            if (this.outputFile.isDirectory()) {
                this.mode = GENERATE_RENDERED;
                this.outputMime = MimeConstants.MIME_PDF;
            } else if (FilenameUtils.getExtension(name).equalsIgnoreCase("pdf")) {
                this.mode = GENERATE_RENDERED;
                this.outputMime = MimeConstants.MIME_PDF;
            } else if (FilenameUtils.getExtension(name).equalsIgnoreCase("fo")) {
                this.mode = GENERATE_FO;
            } else if (FilenameUtils.getExtension(name).equalsIgnoreCase("xml")) {
                this.mode = GENERATE_XML;
            } else {
                throw new IllegalArgumentException(
                        "Operating mode for the output file cannot be determined"
                        + " or is unsupported: " + name);
            }
            idx++;
        }
        if (idx < args.length) {
            this.singleFamilyFilter = args[idx];
        }
    } else {
        System.out.println("use --help or -? for usage information.");
    }
}
 
开发者ID:pellcorp,项目名称:fop,代码行数:43,代码来源:FontListMain.java


注:本文中的org.apache.fop.apps.MimeConstants.MIME_PDF属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。