Package org.pdfclown.documents

Examples of org.pdfclown.documents.Page


    System.out.println(destination.getClass().getSimpleName() + " " + destination.getBaseObject());
    System.out.print("    Page ");
    Object pageRef = destination.getPageRef();
    if(pageRef instanceof Page)
    {
      Page refPage = (Page)pageRef;
      System.out.println((refPage.getIndex()+1) + " [ID: " + refPage.getBaseObject() + "]");
    }
    else
    {System.out.println(((Integer)pageRef+1));}
  }
View Full Code Here


  @SuppressWarnings("unchecked")
  private void populate(
    Document document
    )
  {
    Page page = new Page(document);
    document.getPages().add(page);

    PrimitiveComposer composer = new PrimitiveComposer(page);
    StandardType1Font font = new StandardType1Font(
      document,
View Full Code Here

    Document document,
    XObject form
    )
  {
    // 1. Add a page to the document!
    Page page = new Page(document); // Instantiates the page inside the document context.
    document.getPages().add(page); // Puts the page in the pages collection.

    // 2. Create a content composer for the content stream!
    PrimitiveComposer composer = new PrimitiveComposer(page);

    // 3. Inserting contents...
    Dimension2D pageSize = page.getSize();
    // 3.1. Showing the form on the page...
    {
      // Form 1.
      composer.showXObject(
        form,
View Full Code Here

    {
      for(PageFormat.OrientationEnum pageOrientation
        : EnumSet.allOf(PageFormat.OrientationEnum.class))
      {
        // Add a page to the document!
        Page page = new Page(document); // Instantiates the page inside the document context.
        pages.add(page); // Puts the page in the pages collection.

        // Set the page size!
        page.setSize(
          PageFormat.getSize(
            pageFormat,
            pageOrientation
            )
          );

        // Drawing the text label on the page...
        Dimension2D pageSize = page.getSize();
        PrimitiveComposer composer = new PrimitiveComposer(page);
        composer.setFont(bodyFont,32);
        composer.showText(
          pageFormat + " (" + pageOrientation + ")"// Text.
          new Point2D.Double(
View Full Code Here

  private void buildLinks(
    Document document
    )
  {
    Pages pages = document.getPages();
    Page page = new Page(document);
    pages.add(page);

    StandardType1Font font = null;
    try
    {
      font = new StandardType1Font(
        document,
        StandardType1Font.FamilyEnum.Courier,
        true,
        false
        );
    }
    catch(Exception e)
    {}

    PrimitiveComposer composer = new PrimitiveComposer(page);
    BlockComposer blockComposer = new BlockComposer(composer);

    /*
      2.1. Goto-URI link.
    */
    {
      blockComposer.begin(new Rectangle2D.Double(30,100,200,50),AlignmentXEnum.Left,AlignmentYEnum.Middle);
      composer.setFont(font,12);
      blockComposer.showText("Goto-URI link");
      composer.setFont(font,8);
      blockComposer.showText("\nIt allows you to navigate to a network resource.");
      composer.setFont(font,5);
      blockComposer.showText("\n\nClick on the box to go to the project's SourceForge.net repository.");
      blockComposer.end();

      try
      {
        /*
          NOTE: This statement instructs the PDF viewer to navigate to the given URI when the link is clicked.
        */
        Link link = new Link(
          page,
          new Rectangle(240,100,100,50),
          new GoToURI(
            document,
            new URI("http://www.sourceforge.net/projects/clown")
            )
          );
        link.setBorder(
          new Border(
            document,
            3,
            Border.StyleEnum.Beveled,
            null
            )
          );
      }
      catch(Exception exception)
      {throw new RuntimeException(exception);}
    }

    /*
      2.2. Embedded-goto link.
    */
    {
      // Get the path of the PDF file to attach!
      String filePath = promptPdfFileChoice("Please select a PDF file to attach");

      /*
        NOTE: These statements instruct PDF Clown to attach a PDF file to the current document.
        This is necessary in order to test the embedded-goto functionality,
        as you can see in the following link creation (see below).
      */
      int fileAttachmentPageIndex = page.getIndex();
      String fileAttachmentName = "attachedSamplePDF";
      String fileName = new java.io.File(filePath).getName();
      FileAttachment attachment = new FileAttachment(
        page,
        new Rectangle(0, -20, 10, 10),
View Full Code Here

  private void buildCurvesPage(
    Document document
    )
  {
    // 1. Add the page to the document!
    Page page = new Page(document); // Instantiates the page inside the document context.
    document.getPages().add(page); // Puts the page in the pages collection.

    Dimension2D pageSize = page.getSize();

    // 2. Create a content composer for the page!
    PrimitiveComposer composer = new PrimitiveComposer(page);

    // 3. Drawing the page contents...
View Full Code Here

  private void buildMiscellaneousPage(
    Document document
    )
  {
    // 1. Add the page to the document!
    Page page = new Page(document); // Instantiates the page inside the document context.
    document.getPages().add(page); // Puts the page in the pages collection.

    Dimension2D pageSize = page.getSize();

    // 2. Create a content composer for the page!
    PrimitiveComposer composer = new PrimitiveComposer(page);

    // 3. Drawing the page contents...
View Full Code Here

  private void buildSimpleTextPage(
    Document document
    )
  {
    // 1. Add the page to the document!
    Page page = new Page(document); // Instantiates the page inside the document context.
    document.getPages().add(page); // Puts the page in the pages collection.

    Dimension2D pageSize = page.getSize();

    // 2. Create a content composer for the page!
    PrimitiveComposer composer = new PrimitiveComposer(page);
    // 3. Inserting contents...
    // Set the font to use!
View Full Code Here

  private void buildTextBlockPage(
    Document document
    )
  {
    // 1. Add the page to the document!
    Page page = new Page(document); // Instantiates the page inside the document context.
    document.getPages().add(page); // Puts the page in the pages collection.

    Dimension2D pageSize = page.getSize();

    // 2. Create a content composer for the page!
    PrimitiveComposer composer = new PrimitiveComposer(page);

    // 3. Drawing the page contents...
View Full Code Here

  private void buildTextBlockPage2(
    Document document
    )
  {
    // 1. Add the page to the document!
    Page page = new Page(document); // Instantiates the page inside the document context.
    document.getPages().add(page); // Puts the page in the pages collection.

    Dimension2D pageSize = page.getSize();

    // 2. Create a content composer for the page!
    PrimitiveComposer composer = new PrimitiveComposer(page);

    // 3. Drawing the page contents...
View Full Code Here

TOP

Related Classes of org.pdfclown.documents.Page

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.