Embedding a PDF Document Using the PopChart Embedder

You can generate a PDF PopChart image by setting the PopChart Embedder imageType attribute to "PDF". For example, assuming your PopChart Embedder object is named myPopChart, you should use the following command to set the image format to PDF:

myPopChart.imageType = "PDF";

For the afore-mentioned reasons, most people don't embed PDF documents within web pages. Instead, they create PDF PopChart images that can be served by themselves or can be embedded into other PDF documents. If this is your intent, you will probably be interested in the getImageData() method, which allows you to access a byte array of the PDF image and even return a PDF image directly from a Java Servlet.

Another alternative is to save a PDF image for future viewing using either the saveImageToAppServer(String, String) or saveImageToPopChartServer(String) PopChart Embedder methods. For example, you could run a batch process to generate a PDF image at regular intervals, and then provide a link to it for users to download. If you save the PDF image to PopChart Server, you could load the image in a different session with the loadServerSideImage(String)method.

Many users use PopChart Server as a library to create PDF images for non-web applications. To learn how to create a PopChart image using PopChart Server as a library, contact the Corda Technologies support team (support@corda.com).