Neevia Technology Sites:   www.neevia.com  |  docuPub.com  |  www.neeviaPDF.com
:: Home :: Products :: Technical Support :: About Us :: Contact Us
Technical support > Neevia docuPrinter SDK code samples
Example 3: Convert a MS Word document into PDF (docuPrinter Word Macro) from C#  Print Example 

1) Add a reference in your Visual Studio project to docuPrinter library.
To do this:
  • On the Project menu, click Add Reference;
  • On the COM tab, locate docuPrinter Library and then click Select;
  • Click OK in the Add References dialog box to accept your selections.
2) Add a reference in your project to Microsoft Word.
To do this:
  • On the Project menu, click Add Reference.
  • On the COM tab, locate Microsoft Word and then click Select.
  • Click OK in the Add References dialog box to accept your selections.
private void button1_Click(object sender, EventArgs e)
{

   object fileToConvert = @"c:\test.doc";

   docuPrinter.SDK DPSDK = new docuPrinter.SDK();

   DPSDK.DocumentOutputFormat = "PDF";
   DPSDK.DocumentOutputName = "demoDOC";
   DPSDK.DocumentOutputFolder = @"c:\";
   DPSDK.PDFAutoRotatePage = "All";

   DPSDK.HideSaveAsWindow = true;
   DPSDK.DefaultAction = 1;
   DPSDK.ApplySettings();

   docuPrinter.WordMacro DPWORD = new docuPrinter.WordMacro();
   DPWORD.CHBookmarks = true;
   DPWORD.CInternetLink = true;
   DPWORD.CCrosRef = true;
   DPWORD.CCrosDoc = true;
   DPWORD.LinkFootEnd = true;
   DPWORD.CWordTextBox = true;
   DPWORD.CDocInfo = true;
   DPWORD.CBookNameDest = true;
   DPWORD.CComNotes = true;
   int RVal = DPWORD.ConvertDocument( fileToConvert );

   DPWORD = null;
   DPSDK = null;

   if (RVal != 0) {
      MessageBox.Show("Error while converting the document!!!");
   } else {
      MessageBox.Show("Done converting !!!");
   }

}



Copyright © 1999-2016 Neevia Technology. All Rights Reserved. Home | Products | Technical Support | About Us | Contact Us