Exemple #1
0
        public void Verify_RTF_To_PDF_File_CanBeCreated()
        {
            Verify_PDF_To_RTF_File_CanBeCreated(); // Create a sample .rtf file first

            var rtfFilePath = Path.Combine(TestUtils.GetOutputFolder(), $"{nameof(Verify_PDF_To_RTF_File_CanBeCreated)}.rtf");
            var inputStream = new FileStream(rtfFilePath, FileMode.Open, FileAccess.Read, FileShare.Read);

            var pdfFilePath  = TestUtils.GetOutputFileName();
            var outputStream = new FileStream(pdfFilePath, FileMode.Create);

            var document = new Document();

            PdfWriter.GetInstance(document, outputStream);

            document.Open();

            var parser = new RtfParser(null);

            parser.ConvertRtfDocument(inputStream, document);

            document.Close();
            outputStream.Dispose();
            inputStream.Dispose();
        }