Package com.lowagie.text

Examples of com.lowagie.text.Chunk


          new FileOutputStream("Chunks.pdf"));

      // step 3: we open the document
      document.open();
      // step 4:
      Chunk fox = new Chunk("quick brown fox");
      float superscript = 8.0f;
      fox.setTextRise(superscript);
      fox.setBackground(new Color(0xFF, 0xDE, 0xAD));
      Chunk jumps = new Chunk(" jumps over ");
      Chunk dog = new Chunk("the lazy dog");
      float subscript = -8.0f;
      dog.setTextRise(subscript);
      dog.setUnderline(new Color(0xFF, 0x00, 0x00), 3.0f, 0.0f, -5.0f + subscript, 0.0f, PdfContentByte.LINE_CAP_ROUND);
      document.add(fox);
      document.add(jumps);
      document.add(dog);
    } catch (DocumentException de) {
      System.err.println(de.getMessage());
View Full Code Here


                    RtfFont.STYLE_HIDDEN);
           
            Paragraph paragraph = new Paragraph("This text is ", new RtfFont("Arial", 12));
           
            // Use the RtfFonts when creating the text.
            paragraph.add(new Chunk("deleted,", doubleStrikethrough));
            paragraph.add(new Chunk(" shady,", shadow));
            paragraph.add(new Chunk(" engraved and italic", engravedItalic));
            paragraph.add(" and");
            paragraph.add(new Chunk(" you won't see this", hidden));
            paragraph.add(" nothing.");
           
            document.add(paragraph);
            document.close();
        } catch (FileNotFoundException fnfe) {
View Full Code Here

           
            document.add(new Paragraph("some books I really like:"));
            ListItem listItem;
            list = new List(true, 15);
            listItem = new ListItem("When Harlie was one", FontFactory.getFont(FontFactory.TIMES_ROMAN, 12));
            listItem.add(new Chunk(" by David Gerrold", FontFactory.getFont(FontFactory.TIMES_ROMAN, 11, LwgFont.ITALIC)));
            list.add(listItem);
            listItem = new ListItem("The World according to Garp", FontFactory.getFont(FontFactory.TIMES_ROMAN, 12));
            listItem.add(new Chunk(" by John Irving", FontFactory.getFont(FontFactory.TIMES_ROMAN, 11, LwgFont.ITALIC)));
            list.add(listItem);
            listItem = new ListItem("Decamerone", FontFactory.getFont(FontFactory.TIMES_ROMAN, 12));
            listItem.add(new Chunk(" by Giovanni Boccaccio", FontFactory.getFont(FontFactory.TIMES_ROMAN, 11, LwgFont.ITALIC)));
            list.add(listItem);
            document.add(list);
           
            Paragraph paragraph = new Paragraph("some movies I really like:");
            list = new List(false, 10);
            list.add("Wild At Heart");
            list.add("Casablanca");
            list.add("When Harry met Sally");
            list.add("True Romance");
            list.add("Le mari de la coiffeuse");
            paragraph.add(list);
            document.add(paragraph);
           
            document.add(new Paragraph("Some authors I really like:"));
            list = new List(false, 20);
            list.setListSymbol(new Chunk("\u2022", FontFactory.getFont(FontFactory.HELVETICA, 20, LwgFont.BOLD)));
            listItem = new ListItem("Isaac Asimov");
            list.add(listItem);
            List sublist;
            sublist = new List(false, true, 10);
            sublist.setListSymbol(new Chunk("", FontFactory.getFont(FontFactory.HELVETICA, 8)));
            sublist.add("The Foundation Trilogy");
            sublist.add("The Complete Robot");
            sublist.add("Caves of Steel");
            sublist.add("The Naked Sun");
            list.add(sublist);
            listItem = new ListItem("John Irving");
            list.add(listItem);
            sublist = new List(false, true, 10);
            sublist.setFirst('a');
            sublist.setListSymbol(new Chunk("", FontFactory.getFont(FontFactory.HELVETICA, 8)));
            sublist.add("The World according to Garp");
            sublist.add("Hotel New Hampshire");
            sublist.add("A prayer for Owen Meany");
            sublist.add("Widow for a year");
            list.add(sublist);
            listItem = new ListItem("Kurt Vonnegut");
            list.add(listItem);
            sublist = new List(false, true, 10);
            sublist.setListSymbol(new Chunk("", FontFactory.getFont(FontFactory.HELVETICA, 8)));
            sublist.add("Slaughterhouse 5");
            sublist.add("Welcome to the Monkey House");
            sublist.add("The great pianola");
            sublist.add("Galapagos");
            list.add(sublist);
View Full Code Here

          new FileOutputStream("OpenApplication.pdf"));
      // step 3: we open the document
      document.open();
      // step 4: we add some content
      String application = args[0] + "notepad.exe";
      Paragraph p = new Paragraph(new Chunk("Click to open "
          + application).setAction(new PdfAction(application, null,
          null, null)));
      document.add(p);
    } catch (Exception de) {
      de.printStackTrace();
View Full Code Here

            document1.add(new Annotation("blahblah", "Adding an annotation without specifying coordinates"));
            for (int i = 0; i < 3; i++) {
              document1.add(new Paragraph("blahblahblah"))
            }
            document1.newPage();
            document1.add(new Chunk("marked chunk").setLocalDestination("mark"));
           
            // document2
      document2.add(new Paragraph("Each square on this page represents an annotation."));
            PdfContentByte cb2 = writer2.getDirectContent();
            Annotation a5 = new Annotation(100f, 700f, 200f, 800f,
View Full Code Here

            cb.moveTo(document.left(), currentY);
            cb.lineTo(document.right(), currentY);
            cb.stroke();
            currentY -= 4;
            ct.setYLine(currentY);
            ct.addText(new Chunk("Author: Name of the author comes here", font10B));
            ct.setLeading(10);
            ct.go();
            currentY = ct.getYLine();
            currentY -= 15;
            float topColumn = currentY;
            for (int k = 1; k < numColumns; ++k) {
                float x = allColumns[k] - gutter / 2;
                cb.moveTo(x, topColumn);
                cb.lineTo(x, document.bottom());
            }
            cb.stroke();
            LwgImage img = LwgImage.getInstance("cover.png");
            cb.addImage(img, img.getScaledWidth(), 0, 0, img.getScaledHeight(), document.left(), currentY - img.getScaledHeight());
            currentY -= img.getScaledHeight() + 10;
            ct.setYLine(currentY);
            ct.addText(new Chunk("Key Data:", font14B));
            ct.go();
            currentY = ct.getYLine();
            currentY -= 4;
            LwgPdfPTable ptable = new LwgPdfPTable(2);
            ptable.getDefaultCell().setPaddingLeft(4);
            ptable.getDefaultCell().setPaddingTop(0);
            ptable.getDefaultCell().setPaddingBottom(4);
            ptable.add(new LwgPhrase("Imprint Name:", font9));
            ptable.add(new LwgPhrase("Prentice Hall", font9));
            ptable.add(new LwgPhrase("Series Name:", font9));
            ptable.add(new LwgPhrase("", font9));
            ptable.add(new LwgPhrase("ISBN:", font9));
            ptable.add(new LwgPhrase("Hall", font9));
            ptable.add(new LwgPhrase("UPC Code:", font9));
            ptable.add(new LwgPhrase("0789718103", font9));
            ptable.add(new LwgPhrase("EAN #", font9));
            ptable.add(new LwgPhrase("0786718103", font9));
            ptable.add(new LwgPhrase("Price:", font9));
            ptable.add(new LwgPhrase("49.99", font9));
            ptable.add(new LwgPhrase("Page Count:", font9));
            ptable.add(new LwgPhrase("500", font9));
            ptable.add(new LwgPhrase("Discount:", font9));
            ptable.add(new LwgPhrase("10%", font9));
            ptable.add(new LwgPhrase("Trim Size:", font9));
            ptable.add(new LwgPhrase("420x340", font9));
            ptable.add(new LwgPhrase("Cover:", font9));
            ptable.add(new LwgPhrase("Hard", font9));
            ptable.add(new LwgPhrase("Interior Color:", font9));
            ptable.add(new LwgPhrase("none", font9));
            ptable.add(new LwgPhrase("Media with book:", font9));
            ptable.add(new LwgPhrase("CD", font9));
            ptable.add(new LwgPhrase("Author(s):", font9));
            ptable.add(new LwgPhrase("Ben Forta", font9));
            ptable.add(new LwgPhrase("Editor:", font9));
            ptable.add(new LwgPhrase("Ben Forta", font9));
            ptable.add(new LwgPhrase("Pub Date:", font9));
            ptable.add(new LwgPhrase("06/05/1998", font9));
            ptable.setTotalWidth(columnWidth);

            currentY = ptable.writeSelectedRows(0, -1, document.left(), currentY, cb) - 20;
            for (int k = 0; k < headings.length; ++k) {
                ct.addText(new Chunk(headings[k] + "\n", font14B));
                ct.addText(new Chunk(texts[k] + "\n\n", font11));
            }

            int currentColumn = 0;
            ct.setSimpleColumn(allColumns[currentColumn], document.bottom(),
                allColumns[currentColumn] + columnWidth, currentY, 15, LwgElement.ALIGN_JUSTIFIED);
View Full Code Here

      // step 3: we add Javascript as Metadata and we open the document       
      document.open();
      // step 4: we add some content
      PdfAction action = PdfAction.javaScript("app.alert('Welcome at my site');\r", writer);
      action.next(new PdfAction("http://www.lowagie.com/iText/"));
      Paragraph p = new Paragraph(new Chunk("Click to go to Bruno's site")
          .setAction(action));
      document.add(p);
    } catch (Exception de) {
      de.printStackTrace();
    }
View Full Code Here

      // page 1
            PdfFileSpecification fs = PdfFileSpecification.fileExtern(writer, "cards.mpg");
            writer.addAnnotation(PdfAnnotation.createScreen(writer, new LwgRectangle(200f, 700f, 300f, 800f), "cards.mpg",fs,"video/mpeg",true));
      PdfAnnotation a = new PdfAnnotation(writer, 200f, 550f, 300f, 650f,
          PdfAction.javaScript("app.alert('Hello');\r", writer));
      document.add(new Chunk("click to trigger javascript").setAnnotation(a).setLocalDestination("top"));
      writer.addAnnotation(a);
      writer.addAnnotation(PdfAnnotation.createFileAttachment(writer, new LwgRectangle(100f, 650f, 150f, 700f), "This is some text", "some text".getBytes(), null, "some.txt"));
      writer.addAnnotation(PdfAnnotation.createText(writer, new LwgRectangle(200f, 400f, 300f, 500f), "Help", "This Help annotation was made with 'createText'", false, "Help"));
      writer.addAnnotation(PdfAnnotation.createText(writer, new LwgRectangle(200f, 250f, 300f, 350f), "Help", "This Comment annotation was made with 'createText'", true, "Comment"));
      cb.rectangle(200, 700, 100, 100);
View Full Code Here

          PdfDestination.XYZ, -1, 10000, 0), writer);
      writer.setOpenAction(action);
      document.add(new Paragraph("Page 1"));
      document.newPage();
      document.add(new Paragraph("Page 2"));
      document.add(new Chunk("goto page 1").setAction(PdfAction
          .gotoLocalPage(1, new PdfDestination(PdfDestination.FITH,
              500), writer)));
      document.add(Chunk.NEWLINE);
      document.add(new Chunk("goto another document").setAction(PdfAction
          .gotoRemotePage("remote.pdf", "test", false, true)));
      remote.add(new Paragraph("Some remote document"));
      remote.newPage();
      Paragraph p = new Paragraph("This paragraph contains a ");
      p.add(new Chunk("local destination").setLocalDestination("test"));
      remote.add(p);
    } catch (Exception de) {
      de.printStackTrace();
    }
View Full Code Here

      PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(
          "JavaScriptAction.pdf"));
      // step 3: we add Javascript as Metadata and we open the document       
      document.open();
      // step 4: we add some content
      Paragraph p = new Paragraph(new Chunk("Click to say Hello")
          .setAction(PdfAction.javaScript("app.alert('Hello');\r", writer)));
      document.add(p);
    } catch (Exception de) {
      de.printStackTrace();
    }
View Full Code Here

TOP

Related Classes of com.lowagie.text.Chunk

Copyright © 2018 www.massapicom. 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.