# HtmlConvFileToFile

This program converts an input file to an output file using Java API calls in HTML Export, and a template file. See Set Conversion Options by Using the Template Files for more information on template files. The program is available in C# (`HtmlConvFileToFile.cs)` for .NET and Java (`HtmlConvFileToFile.java`).

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 to Raster Images.

  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"));

  On Windows systems, there is a 64 K size limit to the temporary directory. After the limit is reached, you must either create a new directory or delete the contents of the existing directory; otherwise, you might receive an error message.

- 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. For the Java version of the program, set `INSTALL_DIR` to the Export SDK installation directory in the `HtmlConvFileToFile.bat` file.

2. In the first line of the `HtmlSampleConfig_nt.txt` file, specify the path to the template file used in the conversion. You can use the template files in the `install\htmlexport\programs\ini` directory, where `install` is the path name of the Export installation directory. If you are processing XML files, specify the location of the `kvxconfig.ini` file. This is in the `bin` directory.

3. In the second line of the `HtmlSampleConfig_nt.txt` file, specify the path to the `Export SDK\bin` directory.

4. Copy `HtmlSampleConfig_nt.txt` to `HtmlSampleConfig.txt`.

5. For the Java version of the program, run the batch file in the `install\javaapi\sample` directory. Type the following:

       HtmlConvFileToFile inputfileoutputfile

   For the .NET version of the program, compile the program in Visual Studio and run the program from the Export `bin` directory:

       HtmlConvFileToFile.exe inputfileoutputfile

   where:

   `inputfile` is the path and file name 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 `HtmlConvFileToFile.csh` file, set `MKENV` to the platform on which you are running, either `_hpux11`, `_ilnx21`,`_rs6k43`, or `_ssol26`.

2. In the `HtmlConvFileToFile.csh` file, set `INSTALL_DIR` to the Export installation directory.

3. In the first line of the `HtmlSampleConfig_unix.txt` file, specify the path to the template file used in the conversion. You can use the template files in the `install/htmlexpt/programs/unix/ini`, where `install` is the path name of the Export installation directory. If you are processing XML files, specify the location of the `kvxconfig.ini` file. This is stored in the `bin` directory.

4. In the second line of the `HtmlSampleConfig_unix.txt` file, specify the path to the `ExportSDK/bin` directory.

   If you have copied the `HtmlSampleConfig_unix.txt` and C shell file from a Windows system or edited the files on a Windows system, remove the carriage returns from these files. You can use a utility such as the ColdFusion function `stripcr()` (`http://www.macromedia.com`) to do this. This step is not required if the files are taken from the UNIX installation.

5. Copy `HtmlSampleConfig_unix.txt` to `HtmlSampleConfig.txt`.

6. Run the C shell file in the `install``/javaapi/sample` directory. Type the following:

       ./HtmlConvFileToFile.csh inputfileoutputfile

   where:

   `inputfile` is the path and file name of the source file.

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

   If a path is not specified, the HTML file is output to the current directory.

© Copyright 2006-2019 Micro Focus or one of its affiliates | Send documentation feedback Close Send documentation feedback To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a mail client, and then send this email to swpdl.idoldocsfeedback@microfocus.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_FT_HTML5_bannerTitle.htm