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
}
//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
Post a Comment