Class PDFOutput


  • public class PDFOutput
    extends Output
    A subclass of Output that can be used to plot graphs to a PDFCanvas object, which can be included in our companion PDF Library. For example, to create a simple PDF with a graph on the first page:
     PDF pdf = new PDF();
     PDFPage page = pdf.newPage("A4");
     PDFCanvas canvas = new PDFCanvas(400,400);
     graph.draw(new PDFOutput(canvas));
     page.drawCanvas(canvas, 100, 200, 500, 700);
     pdf.render(outputstream);
     
    • Constructor Detail

      • PDFOutput

        public PDFOutput​(PDFCanvas canvas)
        Create a new PDFOutput that will write the graph to the specified PDFCanvas. This canvas can then be drawn onto pages in the document at any scale or position
        Parameters:
        canvas - the PDFCanvas to draw on
    • Method Detail

      • setTexturePaintDPI

        public void setTexturePaintDPI​(int imagedpi)
        Set the resolution at which TexturePaint paints are supposed to be converted to bitmap. The default value is 72
        Since:
        2.4.8
      • setFont

        public void setFont​(String name,
                            PDFFont font)
        Define a custom font for use with this output class. Here's an example:
           output.setFont("myfont", new OpenTypeFont(new FileInputStream("myfont.ttf"), 2));
         
        Parameters:
        name - the name of the font, as passed to TextStyle.setFont(java.lang.String, double). A name of "Default" will override the default font. The name is case-insensitive
        font - the PDFFont object to use
        Since:
        1.0.3