PDF Clown CLI Samples
0.1.2

org.pdfclown.samples.cli
Class Sample

java.lang.Object
  extended by org.pdfclown.samples.cli.Sample
Direct Known Subclasses:
AcroFormCreationSample, AcroFormFillingSample, AcroFormParsingSample, ActionSample, AdvancedTextExtractionSample, AnnotationSample, AttachmentExtractionSample, BarcodeSample, BasicTextExtractionSample, BookmarksParsingSample, ComplexTypesettingSample, ContentScanningSample, GraphicsSample, HelloWorldSample, ImageExtractionSample, ImageSubstitutionSample, InlineObjectSample, LayerCreationSample, LayerParsingSample, LinkCreationSample, LinkParsingSample, NamedDestinationSample, NamesParsingSample, PageCombinationSample, PageCoordinatesSample, PageFormatSample, PageLabelSample, PageManagementSample, PageNumberingSample, PageToFormSample, PageTransitionSample, ParsingSample, PrintingSample, RenderingSample, StandardFontSample, StreamExternalizationSample, TextFrameSample, TextHighlightSample, TextInfoExtractionSample, TypesettingSample, UnicodeSample, VideoEmbeddingSample, WatermarkSample

public abstract class Sample
extends Object

Abstract sample.

Since:
0.0.8
Version:
0.1.2, 11/30/12
Author:
Stefano Chizzolini (http://www.stefanochizzolini.it)

Constructor Summary
Sample()
           
 
Method Summary
protected  String getIndentation(int level)
           
protected  String getOutputPath()
          Gets the path used to serialize output files.
protected  String getOutputPath(String fileName)
          Gets the path used to serialize output files.
protected  String getResourcePath(String resourceName)
          Gets the path to a sample resource.
 boolean isQuit()
          Gets whether the sample was exited before its completion.
protected  void prompt(String message)
          Prompts a message to the user.
protected  String promptChoice(Map<String,String> options)
          Gets the user's choice from the given options.
protected  String promptChoice(String message)
          Gets the user's choice from the given request.
protected  String promptFileChoice(String inputDescription)
           
protected  boolean promptNextPage(Page page, boolean skip)
          Prompts the user for advancing to the next page.
protected  int promptPageChoice(String inputDescription, int pageCount)
          Prompts the user for a page index to select.
protected  int promptPageChoice(String inputDescription, int startIndex, int endIndex)
          Prompts the user for a page index to select.
protected  void quit()
          Indicates that the sample was exited before its completion.
abstract  void run()
          Executes the sample.
protected  String serialize(File file)
          Serializes the given PDF Clown file object.
protected  String serialize(File file, SerializationModeEnum serializationMode)
          Serializes the given PDF Clown file object.
protected  String serialize(File file, SerializationModeEnum serializationMode, String title, String subject, String keywords)
          Serializes the given PDF Clown file object.
protected  String serialize(File file, String fileName)
          Serializes the given PDF Clown file object.
protected  String serialize(File file, String fileName, SerializationModeEnum serializationMode)
          Serializes the given PDF Clown file object.
protected  String serialize(File file, String fileName, SerializationModeEnum serializationMode, String title, String subject, String keywords)
          Serializes the given PDF Clown file object.
protected  String serialize(File file, String title, String subject, String keywords)
          Serializes the given PDF Clown file object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Sample

public Sample()
Method Detail

isQuit

public boolean isQuit()
Gets whether the sample was exited before its completion.


run

public abstract void run()
Executes the sample.


getIndentation

protected String getIndentation(int level)

getOutputPath

protected String getOutputPath()
Gets the path used to serialize output files.


getOutputPath

protected String getOutputPath(String fileName)
Gets the path used to serialize output files.

Parameters:
fileName - Relative output file path.

getResourcePath

protected String getResourcePath(String resourceName)
Gets the path to a sample resource.

Parameters:
resourceName - Relative resource path.

prompt

protected void prompt(String message)
Prompts a message to the user.

Parameters:
message - Text to show.

promptChoice

protected String promptChoice(String message)
Gets the user's choice from the given request.

Parameters:
message - Description of the request to show to the user.
Returns:
User choice.

promptChoice

protected String promptChoice(Map<String,String> options)
Gets the user's choice from the given options.

Parameters:
options - Available options to show to the user.
Returns:
Chosen option key.

promptFileChoice

protected String promptFileChoice(String inputDescription)

promptNextPage

protected boolean promptNextPage(Page page,
                                 boolean skip)
Prompts the user for advancing to the next page.

Parameters:
page - Next page.
skip - Whether the prompt has to be skipped.
Returns:
Whether to advance.

promptPageChoice

protected int promptPageChoice(String inputDescription,
                               int pageCount)
Prompts the user for a page index to select.

Parameters:
inputDescription - Message prompted to the user.
pageCount - Page count.
Returns:
Selected page index.

promptPageChoice

protected int promptPageChoice(String inputDescription,
                               int startIndex,
                               int endIndex)
Prompts the user for a page index to select.

Parameters:
inputDescription - Message prompted to the user.
startIndex - First page index, inclusive.
endIndex - Last page index, exclusive.
Returns:
Selected page index.

quit

protected void quit()
Indicates that the sample was exited before its completion.


serialize

protected String serialize(File file)
Serializes the given PDF Clown file object.

Parameters:
file - PDF file to serialize.
Returns:
Serialization path.

serialize

protected String serialize(File file,
                           SerializationModeEnum serializationMode)
Serializes the given PDF Clown file object.

Parameters:
file - PDF file to serialize.
serializationMode - Serialization mode.
Returns:
Serialization path.

serialize

protected String serialize(File file,
                           String fileName)
Serializes the given PDF Clown file object.

Parameters:
file - PDF file to serialize.
fileName - Output file name.
Returns:
Serialization path.

serialize

protected String serialize(File file,
                           String fileName,
                           SerializationModeEnum serializationMode)
Serializes the given PDF Clown file object.

Parameters:
file - PDF file to serialize.
fileName - Output file name.
serializationMode - Serialization mode.
Returns:
Serialization path.

serialize

protected String serialize(File file,
                           String title,
                           String subject,
                           String keywords)
Serializes the given PDF Clown file object.

Parameters:
file - PDF file to serialize.
title - Document title.
subject - Document subject.
keywords - Document keywords.
Returns:
Serialization path.

serialize

protected String serialize(File file,
                           SerializationModeEnum serializationMode,
                           String title,
                           String subject,
                           String keywords)
Serializes the given PDF Clown file object.

Parameters:
file - PDF file to serialize.
serializationMode - Serialization mode.
title - Document title.
subject - Document subject.
keywords - Document keywords.
Returns:
Serialization path.

serialize

protected String serialize(File file,
                           String fileName,
                           SerializationModeEnum serializationMode,
                           String title,
                           String subject,
                           String keywords)
Serializes the given PDF Clown file object.

Parameters:
file - PDF file to serialize.
fileName - Output file name.
serializationMode - Serialization mode.
title - Document title.
subject - Document subject.
keywords - Document keywords.
Returns:
Serialization path.

PDF Clown CLI Samples
0.1.2

Project home page

Copyright © 2006-2013 Stefano Chizzolini. Some Rights Reserved.
This documentation is available under the terms of the GNU Free Documentation License.