Examples of LwgPhrase


Examples of com.lowagie.text.LwgPhrase

    public void onOpenDocument(PdfWriter writer, LwgDocument document) {
        try {
          // initialization of the header table
            headerImage = LwgImage.getInstance("logo.gif");
            table = new LwgPdfPTable(2);
            LwgPhrase p = new LwgPhrase();
            Chunk ck = new Chunk("lowagie.com\n", new LwgFont(LwgFont.TIMES_ROMAN, 16, LwgFont.BOLDITALIC, Color.blue));
            p.add(ck);
            ck = new Chunk("Ghent\nBelgium", new LwgFont(LwgFont.HELVETICA, 12, LwgFont.NORMAL, Color.darkGray));
            p.add(ck);
            table.getDefaultCell().setBackgroundColor(Color.yellow);
            table.getDefaultCell().setBorderWidth(0);
            table.add(p);
            table.getDefaultCell().setHorizontalAlignment(LwgElement.ALIGN_RIGHT);
            table.add(new LwgPhrase(new Chunk(headerImage, 0, 0)));
            // initialization of the Graphic State
            gstate = new PdfGState();
            gstate.setFillOpacity(0.3f);
            gstate.setStrokeOpacity(0.3f);
            // initialization of the template
View Full Code Here

Examples of com.lowagie.text.LwgPhrase

    *
    * @param text the text for the cell
    */
   public void add(String text)
   {
      add(new LwgPhrase(text));
   }
View Full Code Here

Examples of com.lowagie.text.LwgPhrase

            writer.setViewerPreferences(PdfWriter.PageModeUseOC);
            // step 3
            document.open();
            // step 4
            PdfContentByte cb = writer.getDirectContent();
            LwgPhrase explanation = new LwgPhrase("Layer radio group and zoom", new LwgFont(LwgFont.HELVETICA, 20, LwgFont.BOLD, Color.red));
            ColumnText.showTextAligned(cb, LwgElement.ALIGN_LEFT, explanation, 50, 650, 0);
            PdfLayer title = PdfLayer.createTitle("Layer radio group", writer);
            PdfLayer l1 = new PdfLayer("Layer 1", writer);
            PdfLayer l2 = new PdfLayer("Layer 2", writer);
            PdfLayer l3 = new PdfLayer("Layer 3", writer);
            PdfLayer l4 = new PdfLayer("Layer 4", writer);
            title.addChild(l1);
            title.addChild(l2);
            title.addChild(l3);
            l4.setZoom(2, -1);
            l4.setOnPanel(false);
            l4.setPrint("Print", true);
            l2.setOn(false);
            l3.setOn(false);
            ArrayList radio = new ArrayList();
            radio.add(l1);
            radio.add(l2);
            radio.add(l3);
            writer.addOCGRadioGroup(radio);
            LwgPhrase p1 = new LwgPhrase("Text in layer 1");
            LwgPhrase p2 = new LwgPhrase("Text in layer 2");
            LwgPhrase p3 = new LwgPhrase("Text in layer 3");
            LwgPhrase p4 = new LwgPhrase("Text in layer 4");
            cb.beginLayer(l1);
            ColumnText.showTextAligned(cb, LwgElement.ALIGN_LEFT, p1, 50, 600, 0);
            cb.endLayer();
            cb.beginLayer(l2);
            ColumnText.showTextAligned(cb, LwgElement.ALIGN_LEFT, p2, 50, 550, 0);
            cb.endLayer();
            cb.beginLayer(l3);
            ColumnText.showTextAligned(cb, LwgElement.ALIGN_LEFT, p3, 50, 500, 0);
            cb.endLayer();
            cb.beginLayer(l4);
            ColumnText.showTextAligned(cb, LwgElement.ALIGN_LEFT, p4, 50, 450, 0);
            cb.endLayer();
            ColumnText.showTextAligned(cb, LwgElement.ALIGN_LEFT, new LwgPhrase("<< Zoom here!", new LwgFont(LwgFont.COURIER, 12, LwgFont.NORMAL, Color.blue)), 150, 450, 0);
            // step 5
            document.close();
        }
        catch(Exception de) {
            de.printStackTrace();
View Full Code Here

Examples of com.lowagie.text.LwgPhrase

            document.setHeader(new RtfHeaderFooter(header));
           
            // If the footer (or header) is to be the same for all Chapters
            // then it has to be set before the document is opened and is
            // then automatically set for all Chapters.
            document.setFooter(new HeaderFooter(new LwgPhrase("This is page "), new LwgPhrase(".")));
           
            document.open();
           
            Chapter chapter1 = new Chapter("Chapter 1", 1);
            chapter1.add(new Paragraph("This document has different headers and footers " +
View Full Code Here

Examples of com.lowagie.text.LwgPhrase

          .getInstance(document, new FileOutputStream("Phrases.pdf"));

      // step 3: we open the document
      document.open();
      // step 4:
      LwgPhrase phrase1 = new LwgPhrase("(1) this is a phrase\n");
      // In this example the leading is passed as a parameter
      LwgPhrase phrase2 = new LwgPhrase(
          24,
          "(2) this is a phrase with leading 24. You can only see the difference if the line is long enough. Do you see it? There is more space between this line and the previous one.\n");
      // When a Font is passed (explicitely or embedded in a chunk),
      // the default leading = 1.5 * size of the font
      LwgPhrase phrase3 = new LwgPhrase(
          "(3) this is a phrase with a red, normal font Courier, size 20. As you can see the leading is automatically changed.\n",
          FontFactory.getFont(FontFactory.COURIER, 20, LwgFont.NORMAL,
              new Color(255, 0, 0)));
      LwgPhrase phrase4 = new LwgPhrase(new Chunk("(4) this is a phrase\n"));
      LwgPhrase phrase5 = new LwgPhrase(
          18,
          new Chunk(
              "(5) this is a phrase in Helvetica, bold, red and size 16 with a given leading of 18 points.\n",
              FontFactory.getFont(FontFactory.HELVETICA, 16,
                  LwgFont.BOLD, new Color(255, 0, 0))));
      // A Phrase can contains several chunks with different fonts
      LwgPhrase phrase6 = new LwgPhrase("(6)");
      Chunk chunk = new Chunk(" This is a font: ");
      phrase6.add(chunk);
      phrase6.add(new Chunk("Helvetica", FontFactory.getFont(
          FontFactory.HELVETICA, 12)));
      phrase6.add(chunk);
      phrase6.add(new Chunk("Times New Roman", FontFactory.getFont(
          FontFactory.TIMES_ROMAN, 12)));
      phrase6.add(chunk);
      phrase6.add(new Chunk("Courier", FontFactory.getFont(
          FontFactory.COURIER, 12)));
      phrase6.add(chunk);
      phrase6.add(new Chunk("Symbol", FontFactory.getFont(
          FontFactory.SYMBOL, 12)));
      phrase6.add(chunk);
      phrase6.add(new Chunk("ZapfDingBats", FontFactory.getFont(
          FontFactory.ZAPFDINGBATS, 12)));
      LwgPhrase phrase7 = new LwgPhrase(
          "(7) if you don't add a newline yourself, all phrases are glued to eachother!");

      document.add(phrase1);
      document.add(phrase2);
      document.add(phrase3);
View Full Code Here

Examples of com.lowagie.text.LwgPhrase

         tableBeg.setWidthPercentage(100);
         tableBeg.getDefaultCell().setHorizontalAlignment(LwgElement.ALIGN_LEFT);
         tableBeg.getDefaultCell().setVerticalAlignment(LwgElement.ALIGN_MIDDLE);


         tableBeg.add(new LwgPhrase("Contractor:", font9));
         tableBeg.add(new LwgPhrase("Job number:", font9));
         tableBeg.add(new LwgPhrase("Enclosure:", font9));

         document.add(tableBeg);


         float[] columnDefinitionSizePrj =
         {
            15f, 40f,
         };

         LwgPdfPTable tablePrj = new LwgPdfPTable(columnDefinitionSizePrj);
         tablePrj.setWidthPercentage(100);
         tablePrj.getDefaultCell().setHorizontalAlignment(LwgElement.ALIGN_LEFT);
         tablePrj.getDefaultCell().setVerticalAlignment(LwgElement.ALIGN_MIDDLE);

         tablePrj.add(new LwgPhrase("Client/name of project:", font9));
         tablePrj.add(new LwgPhrase("", font9));

         tablePrj.add(new LwgPhrase("Dynamic probing test NÂș:", font9));
         tablePrj.add(new LwgPhrase("", font9));

         tablePrj.add(new LwgPhrase("Date:", font9));
         tablePrj.add(new LwgPhrase("", font9));

         tablePrj.add(new LwgPhrase("Type of dynamic probing test:", font9));
         tablePrj.add(new LwgPhrase(strKind, font9));

         tablePrj.add(new LwgPhrase("Lost/fixed cone", font9));
         tablePrj.add(new LwgPhrase("Fixed/loose anvil", font9));



         document.add(tablePrj);

         float fltWidthDepth = 13f;
         float fltWidthBlowCount = 17f;

         float[] columnDefinitionSize =
         {
            fltWidthDepth, fltWidthBlowCount,
            fltWidthDepth, fltWidthBlowCount,
            fltWidthDepth, fltWidthBlowCount,
            fltWidthDepth, fltWidthBlowCount,
            fltWidthDepth, fltWidthBlowCount
         };

         LwgPdfPTable table = new LwgPdfPTable(columnDefinitionSize);

         table.setWidthPercentage(100);
         table.getDefaultCell().setHorizontalAlignment(LwgElement.ALIGN_CENTER);
         table.getDefaultCell().setVerticalAlignment(LwgElement.ALIGN_MIDDLE);



         String strNBlowcount = "N" + Integer.toString(intZStep);
         LwgPhrase phrDepth = new LwgPhrase("Depth (m)", font9);
         LwgPhrase phrBlowcount = new LwgPhrase(strNBlowcount, font9);
         LwgPhrase phrTorque = new LwgPhrase("Torque :", font9);


         //--
         for (int i = 0; i < 5; i++)
         {
            table.add(phrDepth);
            table.add(phrBlowcount);
         }



         int rowPack = (int) (100 / intZStep);

         for (int j = 0; j < rowPack; j++)
         {
            for (int i = 0; i < 5; i++)
            {
               double dblDepth = (double) (intZStep * (j + 1)) / 100d + (double) 2 * i;
               String strDepth = Double.toString(dblDepth);

               table.add(new LwgPhrase(strDepth, font9));
               table.add("");
            }
         }

         for (int i = 0; i < 5; i++)
         {
            table.add(phrTorque);
            table.add(new LwgPhrase("xxx Nm", font9));
         }

         for (int j = 0; j < rowPack; j++)
         {
            for (int i = 0; i < 5; i++)
            {
               double dblDepth = (double) (intZStep * (j + 1)) / 100d + (double) 2 * i + 1d;
               String strDepth = Double.toString(dblDepth);

               table.add(new LwgPhrase(strDepth, font9));
               table.add("");
            }
         }

         for (int i = 0; i < 5; i++)
         {
            table.add(phrTorque);
            table.add(new LwgPhrase("xxx Nm", font9));
         }


         document.add(table);

View Full Code Here

Examples of com.lowagie.text.LwgPhrase

      // step 3:
      writer.setViewerPreferences(PdfWriter.PageModeUseOC);
      document.open();
      // step 4:
      PdfContentByte cb = writer.getDirectContent();
      LwgPhrase explanation = new LwgPhrase("Layer grouping", new LwgFont(
          LwgFont.HELVETICA, 20, LwgFont.BOLD, Color.red));
      ColumnText.showTextAligned(cb, LwgElement.ALIGN_LEFT, explanation, 50,
          650, 0);
      PdfLayer l1 = new PdfLayer("Layer 1", writer);
      PdfLayer l2 = new PdfLayer("Layer 2", writer);
      PdfLayer l3 = new PdfLayer("Layer 3", writer);
      PdfLayerMembership m1 = new PdfLayerMembership(writer);
      m1.addMember(l2);
      m1.addMember(l3);
      LwgPhrase p1 = new LwgPhrase("Text in layer 1");
      LwgPhrase p2 = new LwgPhrase("Text in layer 2 or layer 3");
      LwgPhrase p3 = new LwgPhrase("Text in layer 3");
      cb.beginLayer(l1);
      ColumnText.showTextAligned(cb, LwgElement.ALIGN_LEFT, p1, 50, 600, 0);
      cb.endLayer();
      cb.beginLayer(m1);
      ColumnText.showTextAligned(cb, LwgElement.ALIGN_LEFT, p2, 50, 550, 0);
View Full Code Here

Examples of com.lowagie.text.LwgPhrase

            // step 4: we add some content
            FontFactory.register("c:\\windows\\fonts\\arial.ttf");
            FontFactory.register("c:\\windows\\fonts\\arialbd.ttf");
            FontFactory.register("c:\\windows\\fonts\\ariali.ttf");
            FontFactory.register("c:\\windows\\fonts\\arialbi.ttf");
            LwgPhrase myPhrase = new LwgPhrase("This is font family Arial ", FontFactory.getFont("Arial", 8));
            myPhrase.add(new LwgPhrase("italic ", FontFactory.getFont("Arial", 8, LwgFont.ITALIC)));
            myPhrase.add(new LwgPhrase("bold ", FontFactory.getFont("Arial", 8, LwgFont.BOLD)));
            myPhrase.add(new LwgPhrase("bolditalic", FontFactory.getFont("Arial", 8, LwgFont.BOLDITALIC)));
            document.add(myPhrase);
        }
        catch(DocumentException de) {
            System.err.println(de.getMessage());
        }
View Full Code Here

Examples of com.lowagie.text.LwgPhrase

            document.open();           
            // step 4:
            // get the stream content
            PdfContentByte cb = writer.getDirectContent();
            // headers
            LwgPhrase fullTitle = new LwgPhrase("Full Title", font24B);
            float currentY = document.top();
            ColumnText ct = new ColumnText(cb);
            ct.setSimpleColumn(fullTitle, document.left(), 0, document.right(), document.top(), 24, LwgElement.ALIGN_JUSTIFIED);
            ct.go();
            currentY = ct.getYLine();
            currentY -= 4;
            cb.setLineWidth(1);
            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));
View Full Code Here

Examples of com.lowagie.text.LwgPhrase

     * @param chunk the text
     */
    public void addText(Chunk chunk) {
        if (chunk == null || composite)
            return;
        addText(new LwgPhrase(chunk));
    }
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.