Code Samples - Document Converter Pro

Example 1: How to convert a file (submitFile method) - C# Copy 

Add a reference in your Visual Studio project to docConverter library.
To do this:
        a. On the Project menu, click Add Reference;
        b. On the COM tab, locate docConverter Library and then click Select;
        c. Click OK in the Add References dialog box to accept your selections.
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
  string fileToConvert = @"c:\users\public\test.doc";

  Neevia.docConverter DC = new Neevia.docConverter();

  DC.setParameter("DocumentOutputFormat", "PDF");
  DC.setParameter("DocumentOutputFolder", @"c:\users\public\");
  DC.setParameter("PDFAutoRotatePage", "All");

  int rv = DC.submitFile(fileToConvert, "");

  if (rv != 0) {
    MessageBox.Show(" *** SubmitFile error **** ");
  } else {
    rv = 2;
    while (rv == 2)
    {
      rv = DC.checkStatus(fileToConvert, "");
      Application.DoEvents();
      DC.doSleep(1000);
    }

    if (rv == 0) {
      MessageBox.Show("Converted successfully");
    } else {
      MessageBox.Show("Error converting");
    }
  }