DocConverter WBE 2010

FetchLogFile

Example code is for an older version of DocConverter, newer code is available.
// Copyright (c) 2019 ActivePDF, Inc.
// ActivePDF DocConverter WBE 2010
// Example generated 07/18/19 

using System;

// Make sure to add the ActivePDF product .NET DLL(s) to your application.
// .NET DLL(s) are typically found in the products 'bin' folder.

class Examples
{
  public static void Example()
  {
    string strPath;
    
    strPath = System.AppDomain.CurrentDomain.BaseDirectory;

    // Instantiate Object
    activePDF.API.DocConverterWBE.DocConverter oDCw = new activePDF.API.DocConverterWBE.DocConverter();
    
    // Enable additional logging
    oDCw.Debug = true;
    
    // Specify the location of the DCwbe log file
    // default location = "%appdata%\activePDF\DocConverter\WBE\Logs\"
    oDCw.LogFilePath = "C:\\DCwbe.log";
    
    // Set the location for DC's temporary files
    // The user context that the code runs under must have access
    oDCw.TemporaryPath = strPath;
    
    // Timeout in seconds to wait for PDF creation
    oDCw.TimeoutSeconds = 30;
    
    // Set the format of the PDF
    // activePDF.API.DocConverterWBE.Enums.Format
    oDCw.PDFFormat = activePDF.API.DocConverterWBE.Enums.Format.PDF;
    
    // Convert to PDF using the file extension to determine whether
    // to use Word, Excel or PowerPoint to process the file
    // If the extension is not known by DC WBE use the add extension
    // methods to provide the additional extension
    IResult irSuccess = new Result(Code.Success, "ConvertToPDF");
    IResult intConvertToPDF = oDCw.ConvertToPDF(strPath + "Word.doc", strPath + "Word.pdf");
    if (intConvertToPDF.Status != irSuccess.Status)
    {
    ErrorHandler("ConvertToPDF", intConvertToPDF.Status + " - " + intConvertToPDF.Details);
    }
    
    // Retrieve the log file to a specific location
    // after the conversion attempt
    oDCw.FetchLogFile(strPath + "DCwbe.log");
    
    // Release Object
    oDCw = null;
    
    // Process Complete
    WriteResults("Done!");
  }
  
  // Error Handling
  public static void ErrorHandler(string strMethod, object rtnCode)
  {
    WriteResults(strMethod + " error:  " + rtnCode.ToString());
  }
  
  // Write output data
  public static void WriteResults(string content)
  {
    // Choose where to write out results
  
    // Debug output
    //System.Diagnostics.Debug.WriteLine("ActivePDF: * " + content);
  
    // Console
    Console.WriteLine(content);
  
    // Log file
    //using (System.IO.TextWriter writer = new System.IO.StreamWriter(System.AppDomain.CurrentDomain.BaseDirectory + "application.log", true))
    //{
    //    writer.WriteLine("[" + DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss") + "]: => " + content);
    //}
  }
}

Copyright © 2019 ActivePDF, Inc