HtmlConvFileToFile

This program converts an input file to an output file using Java API calls in HTML Export, and a template file. See Explore Conversion Options with the Sample Programs for more information on template files.

This program demonstrates the following functions:

  • Extracts file format information (document type, format, and version) if it is available in the source document.

  • Extracts metadata if it is available in the source document. Although the program extracts all the metadata in the document, it displays only the first element of metadata.

  • Displays a list of the files that are automatically generated during the conversion.

  • Configures the PDF reader used in the conversion. See Convert PDF Files.

    The basic PDF reader (pdfsr) is used by default in the sample program. To specify that the graphic-based PDF reader is to be used to convert PDF documents, remove the comment from the following line in the HtmlConvFileToFile.java file:

    objHtmlExport.setConfigOption(new ConfigOption(HtmlExport.CFG_SETHIFIPDF, 1, null));
  • Specifies the directory in which temporary files created during conversion processes are stored. To specify the temporary directory, remove the comment from the following line in the HtmlConvFileToFile.java file:

    objHtmlExport.setConfigOption(new ConfigOption(Export.CFG_SETTEMPDIRECTORY, 0, "C:\\tmp"));
  • Extracts elements from a source XML file based on the extraction settings in the kvxconfig.ini file. See Convert XML Files.

Run HtmlConvFileToFile on Windows

To run HtmlConvFileToFile on Windows

  1. In the file HtmlConvFileToFile.bat, set the following variables.

    INSTALL_DIR The absolute path of the KeyView Export SDK installation directory.
    PLATFORM The platform name.
  2. In HtmlSampleConfig.txt, specify the following values, one on each line.

    Line Value
    1

    The path to the template file to use in the conversion.

    You can use the template files in the directory install\htmlexport\programs\ini, where install is the Export SDK installation directory.

    2 The path to the Export SDK bin directory.
    3 (Optional) If you are processing XML files you can specify the location of the kvxconfig.ini file that contains extraction settings. This is in the bin directory.
  3. Run the program. For the Java version of the program, run the batch file in the install\javaapi\sample directory. Type the following:

    HtmlConvFileToFile inputfile outputfile

    where:

    inputfile is the path of the source file.

    outputfile is the path and file name of the generated HTML file.

Run HtmlConvFileToFile on UNIX

To run HtmlConvFileToFile on UNIX

  1. In the file HtmlConvFileToFile.csh, set the following variables.

    INSTALL_DIR The absolute path of the KeyView Export SDK installation directory.
    PLATFORM The platform name.
  2. In HtmlSampleConfig.txt, specify the following values, one on each line.

    Line Value
    1

    The path to the template file to use in the conversion.

    You can use the template files in the directory install\htmlexport\programs\ini, where install is the Export SDK installation directory.

    2 The path to the Export SDK bin directory.
    3 (Optional) If you are processing XML files you can specify the location of the kvxconfig.ini file that contains extraction settings. This is in the bin directory.
  3. Run the program:

    ./HtmlConvFileToFile.csh inputfile outputfile

    where:

    inputfile is the path of the source file.

    outputfile is the path and file name of the generated HTML file.