use of com.itextpdf.kernel.pdf.PdfWriter in project i7js-highlevel by itext.
the class C03E12_MaryReillyV5 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: ");
document.add(p);
Image img = new Image(ImageDataFactory.create(MARY));
img.setFixedPosition(320, 750, UnitValue.createPointValue(50));
document.add(img);
document.close();
}
use of com.itextpdf.kernel.pdf.PdfWriter in project i7js-highlevel by itext.
the class C03E14_MaryReillyV7 method manipulatePdf.
public void manipulatePdf(String src, String dest) throws IOException {
PdfReader reader = new PdfReader(src);
PdfWriter writer = new PdfWriter(dest);
PdfDocument pdfDoc = new PdfDocument(reader, writer);
Document document = new Document(pdfDoc);
Image img = new Image(ImageDataFactory.create(MARY));
img.setFixedPosition(1, 350, 750, UnitValue.createPointValue(50));
document.add(img);
document.close();
}
use of com.itextpdf.kernel.pdf.PdfWriter in project i7js-highlevel by itext.
the class C03E16_MaryReillyV9 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));
p.add(img);
document.add(p);
document.close();
}
use of com.itextpdf.kernel.pdf.PdfWriter in project i7js-highlevel by itext.
the class C04E02_DivExample2 method createPdf.
public void createPdf(String dest) throws IOException {
PdfDocument pdf = new PdfDocument(new PdfWriter(dest));
Document document = new Document(pdf);
List<List<String>> resultSet = CsvTo2DList.convert(SRC, "|");
resultSet.remove(0);
for (List<String> record : resultSet) {
Div div = new Div().setKeepTogether(true).setBorderLeft(new SolidBorder(2)).setPaddingLeft(3).setMarginBottom(10);
String url = String.format("http://www.imdb.com/title/tt%s", record.get(0));
Link movie = new Link(record.get(2), PdfAction.createURI(url));
div.add(new Paragraph(movie.setFontSize(14))).add(new Paragraph(String.format("Directed by %s (%s, %s)", record.get(3), record.get(4), record.get(1))));
File file = new File(String.format("src/main/resources/img/%s.jpg", record.get(0)));
if (file.exists()) {
Image img = new Image(ImageDataFactory.create(file.getPath()));
img.scaleToFit(10000, 120);
div.add(img);
}
document.add(div);
}
document.close();
}
use of com.itextpdf.kernel.pdf.PdfWriter in project i7js-highlevel by itext.
the class C05E02_ColumnWidths3 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);
Table table = new Table(UnitValue.createPercentArray(new float[] { 2, 1, 1 }));
table.setWidth(450);
table.setHorizontalAlignment(HorizontalAlignment.CENTER);
table.addCell(new Cell(1, 3).add(new Paragraph("Cell with colspan 3")));
table.addCell(new Cell(2, 1).add(new Paragraph("Cell with rowspan 2")));
table.addCell("row 1; cell 1");
table.addCell("row 1; cell 2");
table.addCell("row 2; cell 1");
table.addCell("row 2; cell 2");
document.add(table);
document.close();
}
Aggregations