Package org.pdfclown.documents

Examples of org.pdfclown.documents.Document


      catch(Exception e)
      {throw new RuntimeException(filePath + " file access error.",e);}
    }

    // 2. Modifying the document...
    Document document = file.getDocument();
    {
      // Create the action dictionary!
      PdfDictionary action = new PdfDictionary();
      // Define the action type (in this case: go-to)!
      action.put(new PdfName("S"),new PdfName("GoTo"));
      // Defining the action destination...
      {
        // Create the destination array!
        PdfArray destination = new PdfArray();
        // Define the 2nd page as the destination target!
        destination.add(document.getPages().get(1).getBaseObject());
        // Define the location of the document window on the page (fit vertically)!
        destination.add(new PdfName("FitV"));
        // Define the window's left-edge horizontal coordinate!
        destination.add(new PdfInteger(-32768));
        // Associate the destination to the action!
        action.put(new PdfName("D"),destination);
      }
      // Associate the action to the document!
      document.getBaseDataObject().put(
        new PdfName("OpenAction"),
        file.register(action) // Adds the action to the file, returning its reference.
        ); document.update(); // Updates the existing document object (fundamental to override previous content).
    }

    // (boilerplate metadata insertion -- ignore it)
    buildAccessories(document,"Primitive objects","manipulating a document at primitive object level");
View Full Code Here


    try
    {file = new File(filePath);}
    catch(Exception e)
    {throw new RuntimeException(filePath + " file access error.",e);}

    Document document = file.getDocument();

    // 2. Link extraction from the document pages.
    TextExtractor extractor = new TextExtractor();
    extractor.setAreaTolerance(2); // 2 pt tolerance on area boundary detection.
    boolean linkFound = false;
    for(Page page : document.getPages())
    {
      if(!promptNextPage(page, !linkFound))
        return false;

      Map<Rectangle2D,List<ITextString>> textStrings = null;
View Full Code Here

    try
    {file = new File(filePath);}
    catch(Exception e)
    {throw new RuntimeException(filePath + " file access error.",e);}

    Document document = file.getDocument();
    Pages pages = document.getPages();

    // 2. Page rasterization.
    int pageIndex = promptPageChoice("Select the page to render", pages.size());
    Page page = pages.get(pageIndex);
    Dimension2D imageSize = page.getSize();
View Full Code Here

    try
    {file = new File(filePath);}
    catch(Exception e)
    {throw new RuntimeException(filePath + " file access error.",e);}

    Document document = file.getDocument();

    // 2. Content removal.
    for(Page page : document.getPages())
    {
      // Get the page contents!
      Contents contents = page.getContents();
      // Remove text content from page!
      removeText(contents);
View Full Code Here

  public boolean run(
    )
  {
    // 1. PDF file instantiation.
    File file = new File();
    Document document = file.getDocument();
    // Set default page size (A4)!
    document.setPageSize(PageFormat.getSize());

    // 2. Content creation.
    Date creationDate = new Date();
    // 2.1. Template.
    FormXObject template = buildTemplate(
View Full Code Here

  public boolean run(
    )
  {
    // 1. PDF file instantiation.
    File file = new File();
    Document document = file.getDocument();

    // 2. Content creation.
    populate(document);

    // (boilerplate metadata insertion -- ignore it)
View Full Code Here

    try
    {file = new File(filePath);}
    catch(Exception e)
    {throw new RuntimeException(filePath + " file access error.",e);}

    Document document = file.getDocument();

    // 2. Text extraction from the document pages.
    TextExtractor extractor = new TextExtractor();
    for(Page page : document.getPages())
    {
      if(!promptNextPage(page, false))
        return false;

      List<ITextString> textStrings = extractor.extract(page).get(null);
View Full Code Here

    try
    {file = new File(filePath);}
    catch(Exception e)
    {throw new RuntimeException(filePath + " file access error.",e);}

    Document document = file.getDocument();

    // 2. Parsing the document...
    System.out.println("\nLooking for images...");
    for(Page page : document.getPages())
    {
      scan(
        new ContentScanner(page), // Wraps the page contents into the scanner.
        page
        );
View Full Code Here

  public boolean run(
    )
  {
    // 1. PDF file instantiation.
    File file = new File();
    Document document = file.getDocument();

    // 2. Content creation.
    populate(document);

    // (boilerplate metadata insertion -- ignore it)
View Full Code Here

  public boolean run(
    )
  {
    // 1. Instantiate a new PDF file!
    File file = new File();
    Document document = file.getDocument();

    // 2. Insert the contents into the document!
    populate(document);

    // (boilerplate metadata insertion -- ignore it)
View Full Code Here

TOP

Related Classes of org.pdfclown.documents.Document

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.