com.cete.dynamicpdf.text
Class WebOpenFont



Example: This example shows how to use the web open font.

import com.cete.dynamicpdf.*;
import com.cete.dynamicpdf.text.*;
 
public class MyClass{
    public static void main(String args[])
    {
        // Create a PDF Document
        Document document = new Document();

        // Create a Page and add it to the document
        Page page = new Page();
        document.getPages().add(page);

        // Create a web open font
        WebOpenFont webOpenfont = new WebOpenFont("[fontPath]/webFont.woff");

        //Create a label
        Label label = new Label("This text uses web opent font ", 0, 0, 300, 300);

        // Assign web open font to label
        label.setFont(webOpenfont);

        // Add label to the page
        page.getElements().add(label);

        // Save the PDF document
        document.draw("[outputPath]/output.pdf");
    }
}