Class JsPdf


  • @JsType(isNative=true,
            namespace="<global>")
    public class JsPdf
    extends Object
    Provides the JsInterop API for jsPdf. Provided by the webjar org.webjars.bower.jspdf.
    See Also:
    jsPDF.js
    • Constructor Detail

    • Method Detail

      • create

        @JsOverlay
        public static final JsPdf create​(JsPdfSettings settings)
        Factory method for JsPdf.
        Parameters:
        settings - The settings for the new document's.
        Returns:
        A new JsPdf instance.
      • text

        public void text​(String text,
                         int x,
                         int y)
        Adds text to the document.
        Parameters:
        text - The text to add.
        x - Coordinate (in units declared at inception of PDF document) against left edge of the page.
        y - Coordinate (in units declared at inception of PDF document) against upper edge of the page.
      • addImage

        public void addImage​(String imgData,
                             String imgType,
                             int x,
                             int y,
                             int width,
                             int height)
        Adds an image to the document.
        Parameters:
        imgData - The url data for the image.
        x - Coordinate (in units declared at inception of PDF document) against left edge of the page.
        y - Coordinate (in units declared at inception of PDF document) against upper edge of the page.
        width - The image's width.
        height - The image's height.
      • save

        public void save​(String fileName)
        Saves the document into a PDF file.
        Parameters:
        fileName - The name for the generated file.