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 8: Convert a WordPerfect document into PDF 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 Corel WordPerfect.
To do this:
  • On the Project menu, click Add Reference.
  • On the COM tab, locate Corel WordPerfect and then click Select.
  • Click OK in the Add References dialog box to accept your selections.
private void button1_Click(object sender, EventArgs e)
{

   string docToConvert = @"c:\test.wpd";

   WordPerfect.PerfectScript objWordPerfect = new WordPerfect.PerfectScript();
   objWordPerfect.AppMaximize();
   objWordPerfect.Backup(0);
   objWordPerfect.BackupOriginalDoc(0);
   objWordPerfect.PerfectExpert(0);

   object RN = System.Reflection.Missing.Value;
   objWordPerfect.FileOpen(docToConvert,
   WordPerfect._FileOpen_Format_enum.WordPerfect_CompoundFile_FileOpen_Format);

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

   DPSDK.DocumentOutputFormat = "PDF";
   DPSDK.DocumentOutputFolder = @"c:\";
   DPSDK.DocumentOutputName = "demoWP";

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

   objWordPerfect.PrintTo(docToConvert, "docuPrinter", "", "");

   objWordPerfect.CloseNoSave(0);
   objWordPerfect.ExitWordPerfect();
   objWordPerfect = null;

   int RVal = DPSDK.Create(100);            
   DPSDK = null;

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

}



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