Search in sources :

Example 96 with Paragraph

use of com.itextpdf.layout.element.Paragraph in project i7js-highlevel by itext.

the class C03E17_MaryReillyV10 method createPdf.

public void createPdf(String dest) throws IOException {
    PdfDocument pdf = new PdfDocument(new PdfWriter(dest));
    Document document = new Document(pdf);
    Paragraph p = new Paragraph("Mary Reilly is a maid in the household of Dr. Jekyll: ");
    Image img = new Image(ImageDataFactory.create(MARY));
    img.scale(0.5f, 0.5f);
    img.setRotationAngle(-Math.PI / 6);
    p.add(img);
    document.add(p);
    document.close();
}
Also used : PdfWriter(com.itextpdf.kernel.pdf.PdfWriter) PdfDocument(com.itextpdf.kernel.pdf.PdfDocument) Document(com.itextpdf.layout.Document) Image(com.itextpdf.layout.element.Image) PdfDocument(com.itextpdf.kernel.pdf.PdfDocument) Paragraph(com.itextpdf.layout.element.Paragraph)

Example 97 with Paragraph

use of com.itextpdf.layout.element.Paragraph in project i7js-highlevel by itext.

the class C04E06_CustomParagraph method createPdf.

public void createPdf(String dest) throws IOException {
    // Initialize PDF document
    PdfDocument pdf = new PdfDocument(new PdfWriter(dest));
    // Initialize document
    Document document = new Document(pdf);
    Paragraph p1 = new Paragraph("The Strange Case of Dr. Jekyll and Mr. Hyde");
    p1.setBackgroundColor(ColorConstants.ORANGE);
    document.add(p1);
    Paragraph p2 = new Paragraph("The Strange Case of Dr. Jekyll and Mr. Hyde");
    p2.setBackgroundColor(ColorConstants.ORANGE);
    p2.setNextRenderer(new MyParagraphRenderer(p2));
    document.add(p2);
    document.close();
}
Also used : PdfWriter(com.itextpdf.kernel.pdf.PdfWriter) PdfDocument(com.itextpdf.kernel.pdf.PdfDocument) Document(com.itextpdf.layout.Document) PdfDocument(com.itextpdf.kernel.pdf.PdfDocument) Paragraph(com.itextpdf.layout.element.Paragraph)

Example 98 with Paragraph

use of com.itextpdf.layout.element.Paragraph in project i7js-highlevel by itext.

the class C01E02_Text_Paragraph_Cardo method createPdf.

public void createPdf(String dest) throws IOException {
    // Initialize PDF document
    PdfDocument pdf = new PdfDocument(new PdfWriter(dest));
    // Initialize document
    Document document = new Document(pdf);
    // Add content
    FontProgram fontProgram = FontProgramFactory.createFont(REGULAR);
    PdfFont font = PdfFontFactory.createFont(fontProgram, PdfEncodings.WINANSI, EmbeddingStrategy.PREFER_EMBEDDED);
    PdfFont bold = PdfFontFactory.createFont(BOLD, PdfEncodings.WINANSI, EmbeddingStrategy.PREFER_EMBEDDED);
    PdfFont italic = PdfFontFactory.createFont(ITALIC, PdfEncodings.WINANSI, EmbeddingStrategy.PREFER_EMBEDDED);
    Text title = new Text("The Strange Case of Dr. Jekyll and Mr. Hyde").setFont(bold);
    Text author = new Text("Robert Louis Stevenson").setFont(font);
    Paragraph p = new Paragraph().setFont(italic).add(title).add(" by ").add(author);
    document.add(p);
    // Close document
    document.close();
}
Also used : PdfWriter(com.itextpdf.kernel.pdf.PdfWriter) PdfFont(com.itextpdf.kernel.font.PdfFont) Text(com.itextpdf.layout.element.Text) PdfDocument(com.itextpdf.kernel.pdf.PdfDocument) Document(com.itextpdf.layout.Document) FontProgram(com.itextpdf.io.font.FontProgram) PdfDocument(com.itextpdf.kernel.pdf.PdfDocument) Paragraph(com.itextpdf.layout.element.Paragraph)

Example 99 with Paragraph

use of com.itextpdf.layout.element.Paragraph in project i7js-highlevel by itext.

the class C01E01_Text_Paragraph method createPdf.

public void createPdf(String dest) throws IOException {
    // Initialize PDF document
    PdfDocument pdf = new PdfDocument(new PdfWriter(dest));
    // Initialize document
    Document document = new Document(pdf);
    // Add content
    PdfFont font = PdfFontFactory.createFont(StandardFonts.TIMES_ROMAN);
    PdfFont bold = PdfFontFactory.createFont(StandardFonts.TIMES_BOLD);
    Text title = new Text("The Strange Case of Dr. Jekyll and Mr. Hyde").setFont(bold);
    Text author = new Text("Robert Louis Stevenson").setFont(font);
    Paragraph p = new Paragraph().add(title).add(" by ").add(author);
    document.add(p);
    // Close document
    document.close();
}
Also used : PdfWriter(com.itextpdf.kernel.pdf.PdfWriter) PdfFont(com.itextpdf.kernel.font.PdfFont) Text(com.itextpdf.layout.element.Text) PdfDocument(com.itextpdf.kernel.pdf.PdfDocument) Document(com.itextpdf.layout.Document) PdfDocument(com.itextpdf.kernel.pdf.PdfDocument) Paragraph(com.itextpdf.layout.element.Paragraph)

Example 100 with Paragraph

use of com.itextpdf.layout.element.Paragraph in project i7js-highlevel by itext.

the class C07E08_FullScreen method createPdf.

public void createPdf(String dest) throws IOException {
    PdfDocument pdf = new PdfDocument(new PdfWriter(dest));
    pdf.getCatalog().setPageMode(PdfName.FullScreen);
    PdfViewerPreferences preferences = new PdfViewerPreferences();
    preferences.setNonFullScreenPageMode(PdfViewerPreferencesConstants.USE_THUMBS);
    pdf.getCatalog().setViewerPreferences(preferences);
    Document document = new Document(pdf, PageSize.A8);
    document.add(new Paragraph("Mr. Jekyl"));
    document.add(new AreaBreak());
    document.add(new Paragraph("Mr. Hyde"));
    document.close();
}
Also used : PdfWriter(com.itextpdf.kernel.pdf.PdfWriter) PdfViewerPreferences(com.itextpdf.kernel.pdf.PdfViewerPreferences) AreaBreak(com.itextpdf.layout.element.AreaBreak) PdfDocument(com.itextpdf.kernel.pdf.PdfDocument) Document(com.itextpdf.layout.Document) PdfDocument(com.itextpdf.kernel.pdf.PdfDocument) Paragraph(com.itextpdf.layout.element.Paragraph)

Aggregations

Paragraph (com.itextpdf.layout.element.Paragraph)128 PdfDocument (com.itextpdf.kernel.pdf.PdfDocument)109 PdfWriter (com.itextpdf.kernel.pdf.PdfWriter)109 Document (com.itextpdf.layout.Document)103 PdfFont (com.itextpdf.kernel.font.PdfFont)45 HyphenationConfig (com.itextpdf.layout.hyphenation.HyphenationConfig)29 BufferedReader (java.io.BufferedReader)26 FileReader (java.io.FileReader)26 Table (com.itextpdf.layout.element.Table)22 Cell (com.itextpdf.layout.element.Cell)21 AreaBreak (com.itextpdf.layout.element.AreaBreak)20 Image (com.itextpdf.layout.element.Image)20 List (java.util.List)17 CsvTo2DList (com.itextpdf.highlevel.util.CsvTo2DList)16 Text (com.itextpdf.layout.element.Text)16 Rectangle (com.itextpdf.kernel.geom.Rectangle)15 PdfCanvas (com.itextpdf.kernel.pdf.canvas.PdfCanvas)14 Tab (com.itextpdf.layout.element.Tab)13 ArrayList (java.util.ArrayList)13 TabStop (com.itextpdf.layout.element.TabStop)12