Example usage for java.awt FontFormatException toString

List of usage examples for java.awt FontFormatException toString

Introduction

In this page you can find the example usage for java.awt FontFormatException toString.

Prototype

public String toString() 

Source Link

Document

Returns a short description of this throwable.

Usage

From source file:edu.harvard.iq.dvn.core.web.ExploreDataPage.java

private void writeImageFile(File fileIn, File pdfFileIn) {

    File imagePngFile = null;//from   w w w. j a v a  2  s  .  c  om

    try {
        String decoded = URLDecoder.decode(imageURL, "UTF-8");

        if (!decoded.isEmpty()) {
            URL imageURLnew = new URL(imageURL);

            try {
                BufferedImage image = ImageIO.read(imageURLnew);

                BufferedImage combinedImage = getCompositeImage(image);

                if (fileIn != null) {
                    ImageIO.write(combinedImage, "png", fileIn);
                }

                if (pdfFileIn != null) {
                    imagePngFile = File.createTempFile("pdfDownload", "png");
                    ImageIO.write(combinedImage, "png", imagePngFile);
                    Document convertPngToPdf = new Document();
                    PdfWriter.getInstance(convertPngToPdf, new FileOutputStream(pdfFileIn, true));
                    convertPngToPdf.open();
                    Image convertBmp = PngImage.getImage(imagePngFile.getAbsolutePath());
                    convertBmp.scaleToFit(530f, 500f);
                    convertPngToPdf.add(convertBmp);
                    convertPngToPdf.close();
                }
            } catch (IIOException io) {
                System.out.println(io.getMessage().toString());
                System.out.println(io.getCause().toString());
                System.out.println("IIOException " + imageURLnew);

            } catch (FontFormatException ff) {
                System.out.println("FontFormatException " + imageURLnew);

                System.out.println("FontFormatException " + ff.toString());
            }
        }

    } catch (UnsupportedEncodingException uee) {
        System.out.println("UnsupportedEncodingException ");
    } catch (MalformedURLException mue) {
        System.out.println("MalformedURLException ");
    } catch (IOException io) {
        System.out.println("IOException - outer ");
    } catch (DocumentException io) {
        System.out.println("IOException - document ");
        System.out.println(io.getMessage());
    } finally {
        if (imagePngFile != null && imagePngFile.exists()) {
            if (!FileUtil.keepTempFiles("core.web.ExploreDataPage")) {
                imagePngFile.delete();
            }
        }
    }
}