for public static byte[] convertPDFToTiff(byte[] pdfIn)
{
OutputStream baos = new ByteArrayOutputStream();
try
{
License lic= new License();
lic.setLicense(Utility.class.getClassLoader().getResourceAsStream(“Aspose.Pdf.lic”));
com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document(new ByteArrayInputStream(pdfIn));
com.aspose.pdf.devices.Resolution resolution = new com.aspose.pdf.devices.Resolution(300);
com.aspose.pdf.devices.TiffDevice tiffDevice = new com.aspose.pdf.devices.TiffDevice(resolution);
tiffDevice.process(pdfDocument,1,1, baos);
baos.close();
}
catch(Exception e)
{
e.printStackTrace();
}
return ((ByteArrayOutputStream)baos).toByteArray();
}
public static void mergeTifs2(MergeTifResponse resp, List<byte[]> tifsIn)
{
byte[] x = new byte[1];
int pc = 0;
try
{
License lic= new License();
lic.setLicense(Utility.class.getClassLoader().getResourceAsStream(“Aspose.Pdf.lic”));
TiffImage result = new TiffImage();
for(byte[] tifData: tifsIn)
{
TiffImage source = (TiffImage)Image.load(new ByteArrayInputStream(tifData));
TiffFrame [] frames = source.getFrames();
for(int i = 0; i < frames.length; i++)
{
pc++;
result.addFrame(TiffFrame.copyFrame(frames[i]));
}//end for
}//end for
OutputStream out = new ByteArrayOutputStream();
result.save(out);
x = ((ByteArrayOutputStream)out).toByteArray();
resp.setPageCount(pc);
resp.setTifOut(x);
}
catch(Exception e)
{
e.printStackTrace();
}
}