EndOfLineWithTextRenderModePDF.java Source code

Java tutorial

Introduction

Here is the source code for EndOfLineWithTextRenderModePDF.java

Source

import java.awt.Color;
import java.io.FileOutputStream;

import com.lowagie.text.Chunk;
import com.lowagie.text.Document;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfWriter;

public class EndOfLineWithTextRenderModePDF {
    public static void main(String[] args) {
        Document document = new Document();
        try {
            PdfWriter.getInstance(document, new FileOutputStream("EndOfLineWithTextRenderModePDF.pdf"));

            document.open();

            Chunk chunk = new Chunk(
                    "1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0");
            chunk.setTextRenderMode(PdfContentByte.TEXT_RENDER_MODE_STROKE, 0.3f, new Color(30, 30, 30));
            document.add(chunk);

        } catch (Exception e) {
            System.err.println(e.getMessage());
        }
        document.close();
    }
}