/** * Creates a WmfImage from a file. * * @param fileName pah to the file * @throws MalformedURLException */ public WmfImageData(String fileName) throws MalformedURLException { this(UrlUtil.toURL(fileName)); }
/** * Create an ImageData instance representing the image from the specified file. * @param filename filename of the file containing the image * @param recoverImage whether to recover from a image error (for TIFF-images) * @return The created ImageData object. * @throws MalformedURLException */ public static ImageData create(String filename, boolean recoverImage) throws MalformedURLException { return create(UrlUtil.toURL(filename), recoverImage); }
/** * Create an ImageData instance representing the image from the specified file. * @param filename filename of the file containing the image * @param recoverImage whether to recover from a image error (for TIFF-images) * @return The created ImageData object. * @throws MalformedURLException */ public static ImageData create(String filename, boolean recoverImage) throws MalformedURLException { return create(UrlUtil.toURL(filename), recoverImage); }
/** * Embed a file to a PdfDocument. * * @param doc * @param filePath * @param description * @param fileDisplay * @param mimeType * @param fileParameter * @param afRelationshipValue * @throws IOException */ public static PdfFileSpec createEmbeddedFileSpec(PdfDocument doc, String filePath, String description, String fileDisplay, PdfName mimeType, PdfDictionary fileParameter, PdfName afRelationshipValue) throws IOException { PdfStream stream = new PdfStream(doc, UrlUtil.toURL(filePath).openStream()); PdfDictionary params = new PdfDictionary(); if (fileParameter != null) { params.mergeDifferent(fileParameter); } if (!params.containsKey(PdfName.ModDate)) { params.put(PdfName.ModDate, new PdfDate().getPdfObject()); } stream.put(PdfName.Params, params); return createEmbeddedFileSpec(doc, stream, description, fileDisplay, mimeType, afRelationshipValue); }