bhagawatshinde 11 Posting Whiz

Hi guys i have generated PDF file from docx(.rtf also) You need to install bullzip printer and word.
Prerequsities - you have to add reference Bullzip.PdfWriter.
here is code snippest

internal static byte[] PrintToPdf(string appFolder, string tempDocxFileName)
        {
            try
            {
                string tempFolder = appFolder + @"\temp";
                string tempDocxFilePath = tempFolder + @"\" + tempDocxFileName;
                PdfSettings pdfSettings = new PdfSettings();
                pdfSettings.PrinterName = System.Configuration.ConfigurationManager.AppSettings["Bullzip PDF Printer"];
                string settingsFile = pdfSettings.GetSettingsFilePath(PdfSettingsFileType.Settings);
                pdfSettings.LoadSettings(appFolder + @"\App_Data\printerSettings.ini");
                pdfSettings.SetValue("Output", tempFolder + @"\<docname>.pdf");
                pdfSettings.WriteSettings(settingsFile);
                PdfUtil.PrintFile(tempDocxFilePath, pdfSettings.PrinterName);
                string tempPdfFilePath = tempFolder + @"\Microsoft Word - " + tempDocxFileName + ".pdf";
                bool fileCreated = false;
                while (!fileCreated)
                {
                    fileCreated = PdfUtil.WaitForFile(tempPdfFilePath, 1000);
                }
                byte[] pdfBytes = File.ReadAllBytes(tempPdfFilePath);
                File.Delete(tempDocxFilePath);
                File.Delete(tempPdfFilePath);
                return pdfBytes;                                               
            }
            catch (Exception ex)
            {
                return null;
            }
        }

        private void button6_Click(object sender, EventArgs e)
        {
            PrintToPdf("F:\\Bhagawat.s\\TestB", "1020000101777777180712.rtf");
        }