Showing posts with label dotNET. Show all posts
Showing posts with label dotNET. Show all posts

Friday, 17 October 2008

Accessing Toolkit 4.0 as a reference via COM Interop in .NET

ProductVersion   
Toolkit Lite
Toolkit Std
Toolkit Pro
4.0
 
Description
 
In certain implementations, you may not be able to instantiate Toolkit in .NET using the provided APToolkitNET.dll. It is possible to access Toolkit using a COM Interop in these situations.
 
Details
 

Referencing the APToolkit 4.0 Type Library

You must add a reference to the APToolkit 4.0 Type Library to use Toolkit as a COM interop in .NET. If the reference is incorrect or missing, the resultant script will cause a missing type or namespace error. Use the following steps to a reference to the type library:

 

  1. Start Visual Studio® .NET.
  2. In the Solution Explorer, right-click Reference, and then select Add Reference.
  3. In the Add Reference dialog, click COM.
  4. On the COM tab, select the APToolkit 4.0 Type Library, and then click OK


Instantiating the Objects in C#

You can instantiate the objects via COM interop after referencing the APToolkit 4.0 Type Library in the project. The following instructions provide the necessary steps for C#:

NOTE: These instructions cover the instatiation of the Toolkit 4.0 Professional Edition objects. These objects may not be available in the Standard or Lite editions.


 

  1. Add the following line to the beginning of your .NET code:
  2.  

    using APTOOLKITLib;

     

  3. Add one of the following declarations depending on your implementation:
    •  

    • Global Scope
    •  

      public static APTOOLKITLib.APToolkitClass TK = newAPTOOLKITLib.APToolkitClass();

       

    • Local
    •  

      APTOOLKITLib.APToolkitClass TK = newAPTOOLKITLib.APToolkitClass();
  4. Instantiate the object, using the syntax that pertains to the object you are using:
  5. NOTE: The following instructions assume you are using a Local declaration

       

    • To instantiate the Toolkit object:
    •  

      // Instantiate Toolkit object.
      APTOOLKITLib.APToolkitClass TK = newAPTOOLKITLib.APToolkitClass();

       

    • To instantiate the FieldInfo object:
    •  

      long r;
      // Instantiate Toolkit object.
      APTOOLKITLib.APToolkitClass TK = newAPTOOLKITLib.APToolkitClass();
      // A valid PDF must be opened as input
      r = TK.OpenInputFile("input.pdf");
      // Instantiate FieldInfo Sub-object. 
      // Must specify name and instance of field.
      PDFFieldInfo FIO = TK.FieldInfo("fieldname", 1);

       

    • To instantiate the Text2PDF object:
    •  

      // Instantiate Text2PDF Sub-object.
      Text2PDF T2P = new Text2PDF

       

    • To instantiate the ListItems object:
    •  

      long r;
      // Instantiate Toolkit object.
      APTOOLKITLib.APToolkitClass TK = newAPTOOLKITLib.APToolkitClass();
      // A valid PDF must be opened as input
      r = TK.OpenInputFile("input.pdf");
      // Instantiate FieldInfo Sub-object. 
      // Must specify name and instance of field.
      PDFFieldInfo FIO = TK.FieldInfo("fieldname", 1);
      // Instantiate ListItems Sub-object. 
      ListItems LST = FIO.ListItems();

       

    • To instantiate the Explorer object:
    •  

      long r;
      // Instantiate Toolkit object.
      APTOOLKITLib.APToolkitClass TK = newAPTOOLKITLib.APToolkitClass();
      // A valid PDF must be opened as input
      r = TK.OpenInputFile("input.pdf");
      // Instantiate Explorer Sub-object.
      TKExplorerObject EXP = TK.Explorer();

       

    • To instantiate the Barcode object:
    •  

      // Instantiate Barcode object.
      APTKBarcodeObject BCD = new APTKBarcodeObject

       

    • To instantiate the Flash object:
    •  

      // Instantiate Flash object.
      TKFlashObject FLSH = new TKFlashObject


Additional Considerations


 

If you are using C# as the scripting language on an ASPX page, you will need to use aCodebehind property. More information can is available in the Microsoft® knowledge base article located at http://support.microsoft.com/default.aspx?scid=kb%3ben-us%3b321748.

CAUTION: The information provided by this source is not regulated or guaranteed by activePDF, and is subject to change without notice. We strongly recommend that you read all posted warnings and cautions provided by this source, prior to implementing any recommend changes.

Thursday, 21 August 2008

DocConverter Simple GUI for File Conversion

The following VB.NET example demonstrates a basic GUI implementation of activePDF DocConverter. The interface provides an easy way for the user to convert a file to PDF and specify the location for DocConverter's common setup requirements.

Required Components

NOTE: You must reference the APDocConvNET.DLL in order to run the example. Refer to KB #9 for instructions.

Click here to download this example (does not include DLL).





Figure 1.1: DocConverter Example GUI.

The GUI has these required settings:

  • File to Convert: The full path to the file to convert to PDF.
    NOTE: The corresponding DocConverter Processors must be installed for best conversion quality.
  • Folder to Place PDF: The full path for the location to place the output PDF.
  • Folder to Place Error Files: The full path where any files that are unable to convert are placed.
  • Folder to Place Original Document: The full path to store the original input file after conversion.
  • IP of DocConverter Machine: The IP address for the machine where DocConverter is installed (Defaults to 127.0.0.1).
  • Port (0 for Default): The port assigned to the Submit and CheckStatus methods (Defaults to 0 for 53540).
  • Timeout (Seconds): The timeout in seconds (Defaults to 30).