コード例 #1
0
        public static void Run()
        {
            // ExStart:1
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_WorkingDocuments();

            //Create pdf document
            Aspose.Pdf.Document pdf = new Aspose.Pdf.Document();
            //Bind XML and XSLT files to the document
            pdf.BindXml(dataDir + "\\Breakfast.xml", dataDir + "\\Breakfast.xslt");
            //Save the document
            pdf.Save(dataDir + "BreakfastMenu.pdf");
            // ExEnd:1
        }
コード例 #2
0
        public MemoryStream ToPDF <T>(T entity, string xslt)
        {
            MemoryStream xmlStream = entity.TransformXsltStream(xslt);

            Aspose.Pdf.Document pdfDoc = new Aspose.Pdf.Document();
            pdfDoc.BindXml(xmlStream);

            pdfDoc.Info.Author       = UserIdentity.UserName;
            pdfDoc.Info.CreationDate = DateTime.Now;
            pdfDoc.Info.Keywords     = MarkelConfiguration.ApplicationName;

            MemoryStream pdfStream = new MemoryStream();

            pdfDoc.Save(pdfStream);
            return(pdfStream);
        }
コード例 #3
0
        public static void Run()
        {
            // ExStart:HelloWorldPDFUsingXmlAndXslt
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_WorkingDocuments();

            //Create pdf document
            Aspose.Pdf.Document pdf = new Aspose.Pdf.Document();
            //Bind XML and XSLT files to the document
            try
            {
                pdf.BindXml(dataDir + "\\HelloWorld.xml", dataDir + "\\HelloWorld.xslt");
            }
            catch (System.Exception)
            {
                throw;
            }

            //Save the document
            pdf.Save(dataDir + "HelloWorldUsingXmlAndXslt.pdf");
            // ExEnd:HelloWorldPDFUsingXmlAndXslt
        }