use of com.itextpdf.layout.borders.SolidBorder in project i7js-highlevel by itext.
the class ListProperties 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);
PdfFont font = PdfFontFactory.createFont(StandardFonts.TIMES_ROMAN);
Style style = new Style();
style.setBackgroundColor(ColorConstants.YELLOW).setTextAlignment(TextAlignment.CENTER);
document.add(createNewList().addStyle(style).setWidth(300).setHorizontalAlignment(HorizontalAlignment.CENTER).setDestination("Top"));
document.add(createNewList().setRotationAngle(Math.PI / 18).setFont(font).setFontSize(8).setFontColor(ColorConstants.RED));
document.add(createNewList().setHyphenation(new HyphenationConfig("en", "uk", 3, 3)).setBorder(new SolidBorder(0.5f)).setKeepWithNext(true));
document.add(createNewList().setKeepTogether(true).setHeight(200));
document.add(createNewList().setWidth(UnitValue.createPercentValue(50)));
document.add(createNewList().setRelativePosition(10, 10, 50, 10));
document.add(createNewList());
document.add(new AreaBreak());
document.add(createNewList().setFixedPosition(100, 400, 350).setAction(PdfAction.createGoTo("Top")));
document.add(createNewList().setBackgroundColor(ColorConstants.YELLOW).setMarginBottom(10));
document.add(createNewList().setBackgroundColor(ColorConstants.LIGHT_GRAY).setPaddingLeft(20).setPaddingRight(50));
document.add(createNewList().setBackgroundColor(ColorConstants.YELLOW));
document.add(createNewList().setBackgroundColor(ColorConstants.LIGHT_GRAY));
document.add(createNewList().setBackgroundColor(ColorConstants.YELLOW));
document.add(createNewList().setBackgroundColor(ColorConstants.LIGHT_GRAY).setMargin(50).setPadding(30));
document.add(createNewList().setBackgroundColor(ColorConstants.YELLOW));
document.add(createNewList().setBackgroundColor(ColorConstants.LIGHT_GRAY));
document.close();
}
use of com.itextpdf.layout.borders.SolidBorder in project i7js-highlevel by itext.
the class ParagraphProperties 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 p;
PdfFont font = PdfFontFactory.createFont(StandardFonts.TIMES_ROMAN);
Style style = new Style();
style.setBackgroundColor(ColorConstants.YELLOW);
p = getNewParagraphInstance().addStyle(style).setBorder(new SolidBorder(0.5f)).setDestination("Top");
document.add(p);
p = getNewParagraphInstance();
p.setBackgroundColor(ColorConstants.GRAY).setWidth(150).setHorizontalAlignment(HorizontalAlignment.CENTER).setTextAlignment(TextAlignment.CENTER);
document.add(p);
document.add(getNewParagraphInstance().setRotationAngle(Math.PI / 18));
document.add(getNewParagraphInstance().setWidth(150).setHyphenation(new HyphenationConfig("en", "uk", 3, 3)));
document.add(getNewParagraphInstance().setHeight(120).setVerticalAlignment(VerticalAlignment.BOTTOM).setBackgroundColor(ColorConstants.YELLOW).setRelativePosition(10, 10, 50, 10));
document.add(getNewParagraphInstance().setWidth(UnitValue.createPercentValue(80)).setFont(font).setFontSize(8).setFontColor(ColorConstants.RED));
document.add(new AreaBreak());
document.add(getNewParagraphInstance().setFixedPosition(100, 400, 350).setAction(PdfAction.createGoTo("Top")));
document.add(new AreaBreak());
document.add(getNewParagraphInstance().setBackgroundColor(ColorConstants.YELLOW).setMarginBottom(10));
document.add(getNewParagraphInstance().setBackgroundColor(ColorConstants.LIGHT_GRAY).setPaddingLeft(20).setPaddingRight(50));
document.add(getNewParagraphInstance().setBackgroundColor(ColorConstants.YELLOW));
document.add(getNewParagraphInstance().setBackgroundColor(ColorConstants.LIGHT_GRAY));
document.add(getNewParagraphInstance().setBackgroundColor(ColorConstants.YELLOW));
document.add(getNewParagraphInstance().setBackgroundColor(ColorConstants.LIGHT_GRAY).setMargin(50).setPadding(30));
document.add(getNewParagraphInstance().setBackgroundColor(ColorConstants.YELLOW));
document.add(getNewParagraphInstance().setBackgroundColor(ColorConstants.LIGHT_GRAY));
document.close();
}
use of com.itextpdf.layout.borders.SolidBorder in project i7js-highlevel by itext.
the class DivProperties 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);
Style style = new Style();
style.setBackgroundColor(ColorConstants.YELLOW).setBorder(new SolidBorder(0.5f));
document.add(createNewDiv().addStyle(style).setWidth(350).setHorizontalAlignment(HorizontalAlignment.CENTER).setTextAlignment(TextAlignment.CENTER).setDestination("Top"));
PdfFont font = PdfFontFactory.createFont(StandardFonts.TIMES_ROMAN);
document.add(createNewDiv().setRotationAngle(Math.PI / 18).setFont(font).setFontSize(8).setFontColor(ColorConstants.RED));
document.add(createNewDiv().setWidth(350).setHyphenation(new HyphenationConfig("en", "uk", 3, 3)).setKeepWithNext(true));
document.add(createNewDiv().setWidth(UnitValue.createPercentValue(70)).setKeepTogether(true));
document.add(createNewDiv().setHeight(350).setBackgroundColor(ColorConstants.YELLOW).setAction(PdfAction.createGoTo("Top")).setRelativePosition(10, 10, 50, 10));
document.add(new AreaBreak());
document.add(createNewDiv().setFixedPosition(100, 400, 350));
document.add(new AreaBreak());
document.add(createNewDiv().setBackgroundColor(ColorConstants.YELLOW).setMarginBottom(10));
document.add(createNewDiv().setBackgroundColor(ColorConstants.LIGHT_GRAY).setPaddingLeft(20).setPaddingRight(50));
document.add(createNewDiv().setBackgroundColor(ColorConstants.YELLOW));
document.add(createNewDiv().setBackgroundColor(ColorConstants.LIGHT_GRAY));
document.add(createNewDiv().setBackgroundColor(ColorConstants.YELLOW));
document.add(createNewDiv().setBackgroundColor(ColorConstants.LIGHT_GRAY).setMargin(50).setPadding(30));
document.add(createNewDiv().setBackgroundColor(ColorConstants.YELLOW));
document.add(createNewDiv().setBackgroundColor(ColorConstants.LIGHT_GRAY));
document.close();
}
use of com.itextpdf.layout.borders.SolidBorder in project i7js-highlevel by itext.
the class ListSeparatorProperties 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);
Style style = new Style();
style.setBackgroundColor(ColorConstants.YELLOW);
document.add(createNewSeparator().addStyle(style).setDestination("Top"));
document.add(new Paragraph("test"));
document.add(createNewSeparator().setWidth(300).setHorizontalAlignment(HorizontalAlignment.CENTER));
document.add(createNewSeparator().setMargin(10).setVerticalAlignment(VerticalAlignment.BOTTOM).setBorder(new SolidBorder(0.5f)));
document.add(createNewSeparator().setMargin(10).setWidth(300));
document.add(createNewSeparator().setMargin(10).setRelativePosition(10, 10, 50, 10));
document.add(createNewSeparator().setMargin(10).setWidth(UnitValue.createPercentValue(50)));
document.add(createNewSeparator().setMargin(10).setWidth(50).setAction(PdfAction.createGoTo("Top")));
document.add(createNewSeparator().setFixedPosition(100, 200, 350));
document.add(new AreaBreak());
document.add(createNewSeparator().setBackgroundColor(ColorConstants.YELLOW).setMarginBottom(10));
document.add(createNewSeparator().setBackgroundColor(ColorConstants.LIGHT_GRAY).setPaddingLeft(20).setPaddingRight(50));
document.add(createNewSeparator().setBackgroundColor(ColorConstants.YELLOW));
document.add(createNewSeparator().setBackgroundColor(ColorConstants.LIGHT_GRAY).setMarginBottom(50));
document.add(createNewSeparator().setBackgroundColor(ColorConstants.YELLOW));
document.add(createNewSeparator().setBackgroundColor(ColorConstants.LIGHT_GRAY).setMargin(50).setPadding(30));
document.add(createNewSeparator().setBackgroundColor(ColorConstants.YELLOW));
document.add(createNewSeparator().setBackgroundColor(ColorConstants.LIGHT_GRAY));
document.close();
}
use of com.itextpdf.layout.borders.SolidBorder in project i7js-highlevel by itext.
the class C03E18_ImageTypes method createPdf.
public void createPdf(String dest) throws IOException {
PdfDocument pdf = new PdfDocument(new PdfWriter(dest));
Document document = new Document(pdf);
// raw
byte[] data = new byte[256 * 3];
for (int i = 0; i < 256; i++) {
data[i * 3] = (byte) (255 - i);
data[i * 3 + 1] = (byte) (255 - i);
data[i * 3 + 2] = (byte) i;
}
ImageData raw = ImageDataFactory.create(256, 1, 3, 8, data, null);
Image img = new Image(raw);
img.scaleAbsolute(256, 10);
document.add(img);
// JPEG2000
Image img1 = new Image(ImageDataFactory.create(TEST1));
document.add(img1);
document.add(new AreaBreak());
// BMP
Image img2 = new Image(ImageDataFactory.create(TEST2));
img2.setMarginBottom(10);
document.add(img2);
// PNG
Image img3 = new Image(ImageDataFactory.create(TEST3));
img3.setMarginBottom(10);
document.add(img3);
// Transparent PNG
Image img4 = new Image(ImageDataFactory.create(TEST4));
img4.setBorderLeft(new SolidBorder(6));
document.add(img4);
// GIF
Image img5 = new Image(ImageDataFactory.create(TEST5));
img5.setBackgroundColor(ColorConstants.LIGHT_GRAY);
document.add(img5);
// AWT
java.awt.Image awtImage = Toolkit.getDefaultToolkit().createImage(TEST5);
Image awt = new Image(ImageDataFactory.create(awtImage, java.awt.Color.yellow));
awt.setMarginTop(10);
document.add(awt);
// JBIG2
Image img6 = new Image(ImageDataFactory.create(TEST6));
document.add(img6);
// TIFF
Image img7 = new Image(ImageDataFactory.create(TEST7));
document.add(img7);
document.close();
}
Aggregations