Package org.pdfclown.files

Examples of org.pdfclown.files.File


  @Override
  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


  @Override
  public boolean run(
    )
  {
    // 1. Opening the PDF file...
    File file;
    {
      String filePath = promptPdfFileChoice("Please select a PDF file");

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

    // 2. Stamp the document!
    stamp(document);

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

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

    // 2. Set the document properties and resources!
    initialize(document);

    // 3. Insert the contents into the document!
View Full Code Here

    )
  {
    String filePath = promptPdfFileChoice("Please select a PDF file");

    // 1. Open the PDF file!
    File file;
    try
    {file = new File(filePath);}
    catch(Exception e)
    {throw new RuntimeException(filePath + " file access error.",e);}

    Document document = file.getDocument();

    // 2. Get the bookmarks collection!
    Bookmarks bookmarks = document.getBookmarks();
    if(bookmarks == null)
    {System.out.println("\nNo bookmark available (Outline dictionary not found).");}
View Full Code Here

  @Override
  public boolean run(
    )
  {
    // 1. Creating the document...
    File file = new File();
    Document document = file.getDocument();

    // 2. Applying links...
    buildLinks(document);

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

  @Override
  public boolean run(
    )
  {
    // 1. Opening the PDF file...
    File file;
    {
      String filePath = promptPdfFileChoice("Please select a PDF file");

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

    // 2. Replace the images!
    replaceImages(document);

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

  @Override
  public boolean run(
    )
  {
    // 1. Instantiate the form source file!
    File formFile;
    {
      String filePath = promptPdfFileChoice("Please select a PDF file to use as form");

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

    // 2. Instantiate a new PDF file!
    File file = new File();
    Document document = file.getDocument();

    // 3. Convert the first page of the source file into a form inside the new document!
    XObject form = formFile.getDocument().getPages().get(0).toXObject(document);

    // 4. Insert the contents into the new document!
View Full Code Here

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

    // 2. Populate the document!
    populate(document);

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

{
  @Override
  public boolean run(
    )
  {
    File file;
    {
      String filePath = promptPdfFileChoice("Please select a PDF file");

      // 1. Open the PDF file!
      try
      {file = new File(filePath);}
      catch(Exception e)
      {throw new RuntimeException(filePath + " file access error.",e);}
    }

    Document document = file.getDocument();

    // 2. Content tweaking.
    for(Page page : document.getPages())
    {
      // Get the page contents!
View Full Code Here

      (due to copy propagations to the whole page-tree which this page belongs to).
      TODO: 'Annots' entry must be finely treated to include any non-circular reference.
    */
    // TODO:IMPL deal with inheritable attributes!!!

    File contextFile = context.getFile();
    PdfDictionary clone = new PdfDictionary(getBaseDataObject().size());
    for(Map.Entry<PdfName,PdfDirectObject> entry : getBaseDataObject().entrySet())
    {
      PdfName key = entry.getKey();
      // Is the entry unwanted?
      if(key.equals(PdfName.Parent)
        || key.equals(PdfName.Annots))
        continue;

      // Insert the clone of the entry into the clone of the page dictionary!
      clone.put(
        key,
        (PdfDirectObject)entry.getValue().clone(contextFile)
        );
    }
    return new Page(contextFile.getIndirectObjects().add(clone).getReference());
  }
View Full Code Here

TOP

Related Classes of org.pdfclown.files.File

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.