Package org.pdfclown.files

Examples of org.pdfclown.files.File


    java.io.File file
    )
  {
    // Open the PDF file!
    try
    {this.file = new File(file.getAbsolutePath());}
    catch(FileFormatException e)
    {throw new RuntimeException(file.getAbsolutePath() + " file has a bad file format.",e);}
    catch(Exception e)
    {throw new RuntimeException(file.getAbsolutePath() + " file access error.",e);}
View Full Code Here


      e.printStackTrace();
      return;
    }

    // 2. Building the document...
    File file = null;
    try
    {
      // Instantiate a new PDF document!
      file = new File();
      Document document = file.getDocument();

      buildPdf_page(
        document,
        imageFileFormField,
        comment
        );

      buildPdf_metadata(document);
    }
    catch(Exception e)
    {
      System.err.println("An exception happened while building the sample: " + e.getMessage());
      e.printStackTrace();
      return;
    }

    // 3. Serializing the document...
    try
    {
      file.save(
        new org.pdfclown.bytes.OutputStream(
          response.getOutputStream()
          ),
        SerializationModeEnum.Standard
        );
View Full Code Here

  public boolean run()
  {
    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. Named objects extraction.
    Names names = document.getNames();
    if(names == null)
    {System.out.println("No names dictionary.");}
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);}
    }

    // 2. Iterating through the indirect object collection...
    int index = 0;
    for(PdfIndirectObject indirectObject : file.getIndirectObjects())
    {
      // Get the data object associated to the indirect object!
      PdfDataObject dataObject = indirectObject.getDataObject();
      // Is this data object a stream?
      if(dataObject instanceof PdfStream)
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);}

    // 2. Print the document!
    Renderer renderer = new Renderer();
    boolean silent = false;
    try
    {
      if(renderer.print(file.getDocument(), silent))
      {System.out.println("Print fulfilled.");}
      else
      {System.out.println("Print discarded.");}
    }
    catch(PrinterException e)
View Full Code Here

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

  @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. Applying actions...
    // 2.1. Local go-to.
    {
      DocumentActions documentActions = document.getActions();
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();
    Pages pages = document.getPages();

    // 2. Page rasterization.
    int pageIndex = promptPageChoice("Select the page to render", pages.size());
    Page page = pages.get(pageIndex);
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);}
    }

    // 2. Iterating through the indirect objects to discover existing unicode mapping (ToUnicode) streams to edit...
    /*
      NOTE: For the sake of simplicity, I assume that all font objects
      tipically reside in distinct indirect objects.
    */
    for(PdfIndirectObject indirectObject : file.getIndirectObjects())
    {
      /*
        NOTE: In order to get the unicode mapping stream we have to get
        its corresponding font object, which is a dictionary.
      */
 
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.