Neevia Technology Sites:   www.neevia.com  |  docuPub.com  |  www.neeviaPDF.com
:: Home :: Products :: Technical Support :: About Us :: Contact Us
Technical support > Neevia docCreator code samples
Example 6: Convert a WordPerfect document into PDF from C#  Print Example 

1) Add a reference in your project to docCreator library.
To do this:
      a. On the Project menu, click Add Reference.
      b. On the COM tab, locate docCreator Library and then click Select.
      c. 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:
      a. On the Project menu, click Add Reference.
      b. On the COM tab, locate Corel WordPerfect and then click Select.
      c. Click OK in the Add References dialog box to accept your selections.
   string docToConvert = @"d:\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);

   Neevia.docCreator DC = new Neevia.docCreator();
   DC.doSleep(100);

   DC.setParameter("DocumentOutputFormat", "PDF");
   DC.setParameter("DocumentOutputName", "testWP_CSHARP");
   DC.setParameter("DocumentOutputFolder", @"d:\");
   DC.setParameter("PDFAutoRotatePage", "All");

   int RVal = DC.startPrinting();
   if (RVal != 0) { MessageBox.Show("Error while creating the virtual printer!!!"); }
   objWordPerfect.PrintTo(docToConvert, DC.newPrinterName(), "", "");

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

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

   RVal = DC.stopPrinting();
   if (RVal != 0) { MessageBox.Show("Error while deleting the virtual printer!!!"); }

   DC = null;

   if (RVal == 0) { MessageBox.Show("Done!!!"); }



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