//PDF
        public void PDF(string strTopic, string strLanguage, string strText)
        {
            string strTXTDirectory = "";
            string strPDFDirectory = "";

            CrearPDF(strTopic, strText, strLanguage);
            switch (strLanguage)
            {
            case "Español":
                if (System.IO.File.Exists(strTopic + ".txt"))
                {
                    strTXTDirectory = strTopic + ".txt";
                    strPDFDirectory = strTopic + ".pdf";
                }
                else
                {
                    throw new Exception(strTopic + ".txt no existe.");
                }
                break;

            default:
            case "English":
                if (System.IO.File.Exists(@"Listed Mnemonic Summaries\" + strTopic + ".txt"))
                {
                    strTXTDirectory = @"Listed Mnemonic Summaries\" + strTopic + ".txt";
                    strPDFDirectory = @"Listed Mnemonic Summaries\" + strTopic + ".pdf";
                }
                else
                {
                    throw new Exception(strTopic + ".txt doesn't exist.");
                }
                break;
            }

            using (iTextSharp.text.Document aDocument = new iTextSharp.text.Document())
            {
                iTextSharp.text.pdf.PdfWriter.GetInstance(aDocument, new System.IO.FileStream(strPDFDirectory, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite));
                aDocument.Open();
                aDocument.Add(new iTextSharp.text.Paragraph(ListedTextFileManager.Read(strTXTDirectory)));
            }
        }
Ejemplo n.º 2
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     ListedTextFileManager.Write(txtTopic.Text, txtCurrentConcept.Text.ToUpper() + ". " + Rewriter.Rewrite(txtOriginal.Text, strLanguage), strLanguage);
 }