Exemple #1
0
        ///<Summary>
        /// ConvertMDToPdf to convert MD to Pdf
        ///</Summary>

        public Response ConvertMarkownToPdf(string fileName, string folderName, string outputType)
        {
            return(ProcessTask(fileName, folderName, ".pdf", false, "", false,
                               delegate(string inFilePath, string outPath, string zipOutFolder)
            {
                Aspose.Pdf.MdLoadOptions options = new Aspose.Pdf.MdLoadOptions();
                Aspose.Pdf.Document document = new Aspose.Pdf.Document(inFilePath, options);
                if (outputType != "pdf")
                {
                    if (outputType == "pdf/a-1b")
                    {
                        document.Convert(new MemoryStream(), Pdf.PdfFormat.PDF_A_1B, Pdf.ConvertErrorAction.Delete);
                    }
                    if (outputType == "pdf/a-3b")
                    {
                        document.Convert(new MemoryStream(), Pdf.PdfFormat.PDF_A_2B, Pdf.ConvertErrorAction.Delete);
                    }
                    if (outputType == "pdf/a-2u")
                    {
                        document.Convert(new MemoryStream(), Pdf.PdfFormat.PDF_A_2U, Pdf.ConvertErrorAction.Delete);
                    }
                    if (outputType == "pdf/a-3u")
                    {
                        document.Convert(new MemoryStream(), Pdf.PdfFormat.PDF_A_3U, Pdf.ConvertErrorAction.Delete);
                    }
                }
                document.Save(outPath);
            }));
        }
        public static void Run()
        {
            // ExStart:CreatePDFA1WithAsposePdf
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_WorkingDocuments();

            Aspose.Pdf.Document pdf1 = new Aspose.Pdf.Document();
            // Add a page into the pdf document
            pdf1.Pages.Add().Paragraphs.Add(new TextFragment("Hello World!"));
            MemoryStream ms = new MemoryStream();

            // Save the document
            pdf1.Save(ms);
            pdf1.Convert(new MemoryStream(), PdfFormat.PDF_A_1A, ConvertErrorAction.Delete);
            pdf1.Save(dataDir + "CreatePdfA1_out.pdf");
            // ExEnd:CreatePDFA1WithAsposePdf
        }