Program to convert image byte array to PDF

Simple sample program to convert image byte array to PDF

        //input path. path where byte array is saved
        String pathOfByteArrayFile = "/home/inputByteArray.txt";

        //output path. path where rendered you need to save . Output PDF should render properly
        String outputPDFPath = "/home/output.pdf";
        try
        {
            File file = new File(pathOfByteArrayFile);
            FileOutputStream fout = new FileOutputStream(outputPDFPath);
            byte[] bArray = Base64.decode(FileUtils.readFileToByteArray(file));
            fout.write(bArray);
            fout.close();
            assertFalse(false);
        }
        catch (Exception e)
        {
            //your logic for failure
        }

Comments

Popular posts from this blog

Mini Project for Image Processing Beginners

Program to convert base64 to Image and vice versa