Package org.pdfclown.documents.contents.composition

Examples of org.pdfclown.documents.contents.composition.BlockComposer$RowObject


    catch(Exception e)
    {throw new RuntimeException(e);}
   
    int stepCount = 5;
    int step = (int)(pageSize.getHeight()) / (stepCount + 1);
    BlockComposer blockComposer = new BlockComposer(composer);
    {
      blockComposer.begin(
        new Rectangle2D.Double(
          30,
          0,
          pageSize.getWidth()-60,
          step*.8
          ),
        AlignmentXEnum.Center,
        AlignmentYEnum.Middle
        );
      blockComposer.showText(
        "Text block line space"
        );
      blockComposer.end();
    }

    // Drawing the text blocks...
    int x = 30;
    int y = (int)(step*1.1);
    blockComposer.getLineSpace().setUnitMode(UnitModeEnum.Relative);
    for(int index = 0; index < stepCount; index++)
    {
      float relativeLineSpace = 0.5f * index;
      blockComposer.getLineSpace().setValue(relativeLineSpace);
     
      composer.setFont(
        composer.getState().getFont(),
        10
        );
      composer.showText(
        relativeLineSpace + ":",
        new Point2D.Double(x,y),
        AlignmentXEnum.Left,
        AlignmentYEnum.Middle,
        0
        );

      composer.setFont(
        composer.getState().getFont(),
        9
        );
      Rectangle2D frame = new Rectangle2D.Double(
        150,
        y-step*.4,
        350,
        step*.9
        );
      blockComposer.begin(frame,AlignmentXEnum.Left,AlignmentYEnum.Top);
      blockComposer.showText(
        "Demonstrating how to set the block line space. Line space can be expressed either as an absolute value (in user-space units) or as a relative one (as a floating-point ratio); in the latter case the base value is represented by the current font's line height (so that, for example, 2 means \"a line space that's double the line height\")."
        );
      blockComposer.end();
     
      composer.beginLocalState();
      composer.setLineWidth(0.2f);
      composer.setLineDash(5,5,5);
      composer.drawRectangle(frame);
View Full Code Here


      pages.add(page);
      Dimension2D pageSize = page.getSize();

      PrimitiveComposer composer = new PrimitiveComposer(page);
      {
        BlockComposer blockComposer = new BlockComposer(composer);
        blockComposer.setHyphenation(true);
        blockComposer.begin(
          new Rectangle2D.Double(
            Margin,
            Margin,
            (float)pageSize.getWidth() - Margin * 2,
            (float)pageSize.getHeight() - Margin * 2
            ),
          AlignmentXEnum.Left,
          AlignmentYEnum.Top
          );
        StandardType1Font bodyFont = new StandardType1Font(
          document,
          StandardType1Font.FamilyEnum.Courier,
          true,
          false
          );
        composer.setFont(bodyFont,32);
        blockComposer.showText("Barcode sample"); blockComposer.showBreak();
        composer.setFont(bodyFont,16);
        blockComposer.showText("Showing the EAN-13 Bar Code on different compositions:"); blockComposer.showBreak();
        blockComposer.showText("- page 1: on the lower right corner of the page, 100pt wide;"); blockComposer.showBreak();
        blockComposer.showText("- page 2: on the middle of the page, 1/3-page wide, 25 degree counterclockwise rotated;"); blockComposer.showBreak();
        blockComposer.showText("- page 3: filled page, 90 degree clockwise rotated."); blockComposer.showBreak();
        blockComposer.end();
      }

      // Show the barcode!
      composer.showXObject(
        barcodeXObject,
View Full Code Here

TOP

Related Classes of org.pdfclown.documents.contents.composition.BlockComposer$RowObject

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.