APIDemo to render to Byte Array Output

Please refer to the attached file for your references.
In our sample:
  • import java.io.ByteArrayOutputStream;
  • comment out FileOutputStream portion:
                       //FileOutputStream fos = new FileOutputStream(
//new File("test.pdf"));
  • create a ByteArrayOutputStream to store the output, after that you can stream the bytes[] to the users
ByteArrayOutputStream bos = new ByteArrayOutputStream(); byte[] bytes = bos.toByteArray();

APIDemo.txt (6.7 KB)