Creating PDF documents using MagicBox

CloudIO supports MagicBox, a Java tool to create PDF documents. Its “Design and Data Centric” approach allows you to create PDF documents with minimal code that is easy to write and understand.

  • To create a PDF page, refer to the code below:

MagicBox magicBox = MagicBox.getInstance(); 
PDFPage page = magicBox.createPage();
  • To save a PDF to stream, refer to the code below:

magicBox.save(outputStream);
circle-info

You can add the code to create PDF documents in the Java Snippets page.

The platform supports a list of widgets for page formatting. A widget is the parent type to use the available child methods, such as, Div, Image, and many more.

Available methods:

void setWidth(float width); 
float getWidth(); 
float getOffsetWidth(); 
void setHeight(float height); 
float getHeight(); 
float getOffsetHeight(); 
void setStartX(float startX); 
float getStartX(); 
void setStartY(float startY); 
float getStartY(); 
void resetStartY(float startY); 
void setWidthPercentage(int widthPerc); 
void setMarginTop(float marginTop); 
void appendMarginTop(float mt); 
float getMarginTop(); 
void setMarginRight(float marginRight); 
float getMarginRight(); 
void setMarginLeft(float marginLeft); 
void appendMarginLeft(float ml); 
float getMarginLeft();
void setParent(MBWidget parent); 
MBWidget getParent(); 
Void setIgnoreNewPage(Boolean ignoreNewPage) ; 
Boolean isIgnoreNewPage();

Sample widget snippets

Last updated