Examples of LwgPdfPTable


Examples of com.lowagie.text.pdf.LwgPdfPTable

      // step 3: we open the document
      document.open();
      // step 4: we add some content
      Paragraph p = new Paragraph(new Chunk("Click to print")
          .setAction(new PdfAction(PdfAction.PRINTDIALOG)));
      LwgPdfPTable table = new LwgPdfPTable(4);
      table.getDefaultCell().setHorizontalAlignment(LwgElement.ALIGN_CENTER);
      table.add(new LwgPhrase(new Chunk("First Page")
          .setAction(new PdfAction(PdfAction.FIRSTPAGE))));
      table.add(new LwgPhrase(new Chunk("Prev Page")
          .setAction(new PdfAction(PdfAction.PREVPAGE))));
      table.add(new LwgPhrase(new Chunk("Next Page")
          .setAction(new PdfAction(PdfAction.NEXTPAGE))));
      table.add(new LwgPhrase(new Chunk("Last Page")
          .setAction(new PdfAction(PdfAction.LASTPAGE))));
      for (int k = 1; k <= 10; ++k) {
        document.add(new Paragraph("This is page " + k));
        document.add(Chunk.NEWLINE);
        document.add(table);
View Full Code Here

Examples of com.lowagie.text.pdf.LwgPdfPTable

            template.setHeight(size + 2);
            template.sanityCheck();
            LwgImage img = LwgImage.getInstance(template);
            img.setRotationDegrees(90);
            Chunk ck = new Chunk(img, 0, 0);
            LwgPdfPTable table = new LwgPdfPTable(3);
            table.setWidthPercentage(100);
            table.getDefaultCell().setHorizontalAlignment(LwgElement.ALIGN_CENTER);
            table.getDefaultCell().setVerticalAlignment(LwgElement.ALIGN_MIDDLE);
            LwgPdfPCell cell = new LwgPdfPCell(img);
            cell.setPadding(4);
            cell.setBackgroundColor(new Color(0, 0, 255));
            cell.setHorizontalAlignment(LwgElement.ALIGN_CENTER);
            table.add("I see a template on my right");
            table.add(cell);
            table.add("I see a template on my left");
            table.add(cell);
            table.add("I see a template everywhere");
            table.add(cell);
            table.add("I see a template on my right");
            table.add(cell);
            table.add("I see a template on my left");
           
            Paragraph p1 = new Paragraph("This is a template ");
            p1.add(ck);
            p1.add(" just here.");
            p1.setLeading(img.getScaledHeight() * 1.1f);
 
View Full Code Here

Examples of com.lowagie.text.pdf.LwgPdfPTable

            document.open();
            // step 4: we create a table and add it to the document
            LwgImage img = LwgImage.getInstance("pngnow.png");
            img.scalePercent(70);
            Chunk ck = new Chunk(img, 0, -5);
            LwgPdfPTable table = new LwgPdfPTable(3);
            LwgPdfPCell cell = new LwgPdfPCell();
            cell.addElement(new Chunk(img, 5, -5));
            cell.setBackgroundColor(new Color(0xC0, 0xC0, 0xC0));
            cell.setHorizontalAlignment(LwgElement.ALIGN_CENTER);
            table.add("I see an image\non my right");
            table.add(cell);
            table.add("I see an image\non my left");
            table.add(cell);
            table.add("I see images\neverywhere");
            table.add(cell);
            table.add("I see an image\non my right");
            table.add(cell);
            table.add("I see an image\non my left");
           
            LwgPhrase p1 = new LwgPhrase("This is an image ");
            p1.add(ck);
            p1.add(" just here.");
            document.add(p1);
View Full Code Here

Examples of com.lowagie.text.pdf.LwgPdfPTable

        PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("ean128.pdf"));
        // step 3
        document.open();
        // step 4
        PdfContentByte cb = writer.getDirectContent();
            LwgPdfPTable pageTot = new LwgPdfPTable(1);
            pageTot.getDefaultCell().setPadding(0f);
            pageTot.getDefaultCell().setBorder(LwgRectangle.NO_BORDER);
            pageTot.getDefaultCell().setHorizontalAlignment(LwgElement.ALIGN_LEFT);
            pageTot.setWidthPercentage(100f);
            //Data for the barcode : it is composed of 3 blocks whith AI 402, 90 and 421
            // The blocks whith the type 402 and 90 are of variable size so you must put a FNC1
            // to delimitate the block
            String code402 = "24132399420058289"+Barcode128.FNC1;
            String code90 = "3700000050"+Barcode128.FNC1;
            String code421 = "422356";
            String data = code402 + code90 + code421;
           
            LwgPdfPTable cell = new LwgPdfPTable(1);
            cell.getDefaultCell().setBorder(LwgRectangle.NO_BORDER);
            cell.getDefaultCell().setPadding(0f);
           
            LwgPdfPCell info = new LwgPdfPCell(new LwgPhrase("Barcode EAN 128"));
            info.setBorder(LwgRectangle.NO_BORDER);
            pageTot.add(info);
           
            Barcode128 shipBarCode = new Barcode128();
            shipBarCode.setX(0.75f);
            shipBarCode.setN(1.5f);
            shipBarCode.setChecksumText(true);
            shipBarCode.setGenerateChecksum(true);
            shipBarCode.setSize(10f);
            shipBarCode.setTextAlignment(LwgElement.ALIGN_CENTER);
            shipBarCode.setBaseline(10f);
            shipBarCode.setCode(data);
            shipBarCode.setBarHeight(50f);
           
            LwgImage imgShipBarCode = shipBarCode.createImageWithBarcode(cb, Color.black, Color.blue);
            LwgPdfPCell shipment = new LwgPdfPCell(new LwgPhrase(
            new Chunk(imgShipBarCode, 0, 0)));
            shipment.setFixedHeight(shipBarCode.getBarcodeSize().getHeight() + 16f);
            shipment.setPaddingTop(5f);
            shipment.setPaddingBottom(10f);
            shipment.setBorder(LwgRectangle.BOX);
            shipment.setVerticalAlignment(LwgElement.ALIGN_TOP);
            shipment.setHorizontalAlignment(LwgElement.ALIGN_CENTER);
            cell.add(shipment);
           
            pageTot.add(cell);
           
           
            document.add(pageTot);
View Full Code Here

Examples of com.lowagie.text.pdf.LwgPdfPTable

            Paragraph p = new Paragraph("Ghent University", font);
            p.setAlignment(LwgElement.ALIGN_CENTER);
            document.add(p);
            PdfContentByte cb = writer.getDirectContent();
            LwgFont f = FontFactory.getFont(FontFactory.HELVETICA, 8);
            LwgPdfPTable outertable = new LwgPdfPTable(3);
            outertable.setTotalWidth(200);
            outertable.getDefaultCell().setBorder(LwgRectangle.NO_BORDER);
            float[] outer = { 60, 25, 15 };
            outertable.setWidths(outer);
            LwgPdfPTable innertable = new LwgPdfPTable(2);
            float[] inner = {35, 65};
            innertable.setWidths(inner);
            innertable.add(new Paragraph("name:", f));
            innertable.add(new Paragraph("Bruno Lowagie", f));
            innertable.add(new Paragraph("date of birth:", f));
            innertable.add(new Paragraph("June 10th, 1970", f));
            innertable.add(new Paragraph("Study Program:", f));
            innertable.add(new Paragraph("master in civil engineering", f));
            innertable.add(new Paragraph("option:", f));
            innertable.add(new Paragraph("architecture", f));
            outertable.add(innertable);
      outertable.getDefaultCell().setBackgroundColor(new Color(0xFF, 0xDE, 0xAD));
      outertable.add(LwgImage.getInstance("bruno.jpg"));
            BarcodeEAN codeEAN = new BarcodeEAN();
            codeEAN.setCodeType(Barcode.EAN13);
View Full Code Here

Examples of com.lowagie.text.pdf.LwgPdfPTable

            codeSUPP.setCodeType(Barcode.SUPP5);
            codeSUPP.setCode("54995");
            codeSUPP.setBaseline(-2);
            BarcodeEANSUPP eanSupp = new BarcodeEANSUPP(codeEAN, codeSUPP);
            LwgImage imageEANSUPP = eanSupp.createImageWithBarcode(cb, null, Color.blue);
            LwgPdfPTable table = new LwgPdfPTable(2);
            table.setWidthPercentage(100);
            table.getDefaultCell().setBorder(LwgRectangle.NO_BORDER);
            table.getDefaultCell().setHorizontalAlignment(LwgElement.ALIGN_CENTER);
            table.getDefaultCell().setVerticalAlignment(LwgElement.ALIGN_MIDDLE);
            table.getDefaultCell().setFixedHeight(70);
            table.add("CODE 39");
            table.add(new LwgPhrase(new Chunk(image39, 0, 0)));
            table.add("CODE 39 EXTENDED");
            table.add(new LwgPhrase(new Chunk(image39ext, 0, 0)));
            table.add("CODE 128");
            table.add(new LwgPhrase(new Chunk(image128, 0, 0)));
            table.add("CODE EAN");
            table.add(new LwgPhrase(new Chunk(imageEAN, 0, 0)));
            table.add("CODE EAN\nWITH\nSUPPLEMENTAL 5");
            table.add(new LwgPhrase(new Chunk(imageEANSUPP, 0, 0)));
            table.add("CODE INTERLEAVED");
            table.add(new LwgPhrase(new Chunk(image25, 0, 0)));
            table.add("CODE POSTNET");
            table.add(new LwgPhrase(new Chunk(imagePost, 0, 0)));
            table.add("CODE PLANET");
            table.add(new LwgPhrase(new Chunk(imagePlanet, 0, 0)));
            document.add(table);
        }
        catch (Exception de) {
            de.printStackTrace();
        }
View Full Code Here

Examples of com.lowagie.text.pdf.LwgPdfPTable

            LwgFont font = FontFactory.getFont(FontFactory.HELVETICA, 14, LwgFont.BOLD, Color.BLUE);
            Paragraph p = new Paragraph("Ghent University", font);
            p.setAlignment(LwgElement.ALIGN_CENTER);
            document.add(p);
            LwgFont f = FontFactory.getFont(FontFactory.HELVETICA, 8);
            LwgPdfPTable outertable = new LwgPdfPTable(3);
            outertable.setTotalWidth(200);
            outertable.getDefaultCell().setBorder(LwgRectangle.NO_BORDER);
            float[] outer = { 60, 25, 15 };
            outertable.setWidths(outer);
            LwgPdfPTable innertable = new LwgPdfPTable(2);
            float[] inner = {35, 65};
            innertable.setWidths(inner);
            LwgPdfPCell cell;
            TextField text;
            innertable.add(new Paragraph("name:", f));
            cell = new LwgPdfPCell();
            text = new TextField(writer, new LwgRectangle(0, 0), "name");
            text.setOptions(TextField.MULTILINE);
            text.setFontSize(8);
            PdfFormField name = text.getTextField();
            cell.setCellEvent(new StudentCardForm(name));
            innertable.add(cell);
            innertable.add(new Paragraph("date of birth:", f));
            cell = new LwgPdfPCell();
            text = new TextField(writer, new LwgRectangle(0, 0), "birthday");
            text.setOptions(TextField.MULTILINE);
            text.setFontSize(8);
            PdfFormField birthdate = text.getTextField();
            cell.setCellEvent(new StudentCardForm(birthdate));
            innertable.add(cell);
            innertable.add(new Paragraph("Study Program:", f));
            cell = new LwgPdfPCell();
            text = new TextField(writer, new LwgRectangle(0, 0), "studyprogram");
            text.setOptions(TextField.MULTILINE);
            text.setFontSize(8);
            PdfFormField studyprogram = text.getTextField();
            studyprogram.setFieldName("studyprogram");
            cell.setCellEvent(new StudentCardForm(studyprogram));
            innertable.add(cell);
            innertable.add(new Paragraph("option:", f));
            cell = new LwgPdfPCell();
            text = new TextField(writer, new LwgRectangle(0, 0), "option");
            text.setOptions(TextField.MULTILINE);
            text.setFontSize(8);
            PdfFormField option = text.getTextField();
            option.setFieldName("option");
            cell.setCellEvent(new StudentCardForm(option));
            innertable.add(cell);
            outertable.add(innertable);
            cell = new LwgPdfPCell();
      cell.setBackgroundColor(new Color(0xFF, 0xDE, 0xAD));
            PdfFormField picture = PdfFormField.createPushButton(writer);
            picture.setFieldName("picture");
View Full Code Here

Examples of com.lowagie.text.pdf.LwgPdfPTable

      PdfWriter writer = PdfWriter.getInstance(document,
          new FileOutputStream("SimpleRegistrationForm.pdf"));
      // step 3
      document.open();
      // step 4
      LwgPdfPTable table = new LwgPdfPTable(2);
      LwgPdfPCell cell;
      table.getDefaultCell().setPadding(5f);

      table.add("Your name:");
      cell = new LwgPdfPCell();
      cell.setCellEvent(new SimpleRegistrationForm(writer, "name"));
      table.add(cell);

      table.add("Your home address:");
      cell = new LwgPdfPCell();
      cell.setCellEvent(new SimpleRegistrationForm(writer, "address"));
      table.add(cell);

      table.add("Postal code:");
      cell = new LwgPdfPCell();
      cell
          .setCellEvent(new SimpleRegistrationForm(writer,
              "postal_code"));
      table.add(cell);

      table.add("Your email address:");
      cell = new LwgPdfPCell();
      cell.setCellEvent(new SimpleRegistrationForm(writer, "email"));
      table.add(cell);

      document.add(table);

    } catch (DocumentException de) {
      System.err.println(de.getMessage());
View Full Code Here

Examples of com.lowagie.text.pdf.LwgPdfPTable

            PdfWriter writer = PdfWriter.getInstance(document,
                    new GfrFileOutputStream("com.lowagie.examples.objects.tables.pdfptable.TableEvents1.pdf"));
            // step3
            document.open();
            // step4
            LwgPdfPTable table = new LwgPdfPTable(4);
            table.getDefaultCell().setBorder(LwgRectangle.NO_BORDER);
            for (int k = 0; k < 24; ++k) {
                if (k != 0)
                    table.add(String.valueOf(k));
                else
                    table.add("This is an URL");
            }
            TableEvents1 event = new TableEvents1();
            table.setTableEvent(event);
           
            // add the table with document add
            document.add(table);
            // add the table at an absolute position
            table.setTotalWidth(300);
            table.writeSelectedRows(0, -1, 100, 600, writer.getDirectContent());
           
            document.newPage();
           
            table = new LwgPdfPTable(4);
            float fontSize = 12;
            BaseFont bf = BaseFont.createFont("Helvetica", "winansi", false);
            table.getDefaultCell().setPaddingTop(bf.getFontDescriptor(BaseFont.ASCENT, fontSize) - fontSize + 2);
            table.getDefaultCell().setBorder(LwgRectangle.NO_BORDER);
            for (int k = 0; k < 500 * 4; ++k) {
                if (k == 0)
                    table.add(new LwgPhrase("This is an URL", new LwgFont(bf, fontSize)));
                else
                    table.add(new LwgPhrase(String.valueOf(k), new LwgFont(bf, fontSize)));
            }
            table.setTableEvent(event);
            table.setHeaderRows(3);
            document.add(table);
        }
        catch (Exception de) {
            de.printStackTrace();
        }
View Full Code Here

Examples of com.lowagie.text.pdf.LwgPdfPTable

      PdfWriter.getInstance(document,
                 new GfrFileOutputStream("com.lowagie.examples.objects.tables.pdfptable.FloatingBoxes.pdf"));
      // step 3
      document.open();
      // step 4
      LwgPdfPTable table = new LwgPdfPTable(2);
      table.setTableEvent(floatingBoxes);
      table.getDefaultCell().setBorder(LwgRectangle.NO_BORDER);
      table.getDefaultCell().setCellEvent(floatingBoxes);
      table.getDefaultCell().setPadding(5f);
      table.add("value");
      table.add("name");
      table.add(new Paragraph("dog"));
      table.add(new Paragraph("cat"));
      table.add(new Paragraph("bird"));
      table.add(new Paragraph("horse"));
      document.add(table);

    } catch (DocumentException de) {
      System.err.println(de.getMessage());
    } catch (IOException ioe) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.