public static void Run()
        {
            // ExStart:WithoutPreambleanddocument
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdf_Text();
            // Create a new Document Object
            Document doc = new Document();
            // Add Page in Pages Collection
            Page page = doc.Pages.Add();
            // Create a Table
            Table table = new Table();
            // Add a row into Table
            Row row = table.Rows.Add();
            // Add Cell with Latex Script to add methematical expressions/formulae
            string latexText1 = "$123456789+\\sqrt{1}+\\int_a^b f(x)dx$";
            Cell   cell       = row.Cells.Add();

            cell.Margin = new MarginInfo {
                Left = 20, Right = 20, Top = 20, Bottom = 20
            };
            // Second LatexFragment constructor bool parameter provides LaTeX paragraph indents elimination.
            LatexFragment ltext1 = new LatexFragment(latexText1, true);

            cell.Paragraphs.Add(ltext1);
            // Add table inside page
            page.Paragraphs.Add(table);
            // Save the document
            doc.Save(dataDir + "LatextScriptInPdf_out.pdf");
            // ExEnd:WithoutPreambleanddocument
        }
Beispiel #2
0
        public static void Run()
        {
            //ExStart: UseLatexScript3
            var dataDir = RunExamples.GetDataDir_AsposePdf_Text();
            var s       = @"
            \usepackage{amsmath,amsthm}
            \begin{document}
            \begin{proof} The proof is a follows: 
            \begin{align}
            (x+y)^3&=(x+y)(x+y)^2
            (x+y)(x^2+2xy+y^2)\\
            &=x^3+3x^2y+3xy^3+x^3.\qedhere
            \end{align}
            \end{proof}
            \end{document}";

            var doc  = new Document();
            var page = doc.Pages.Add();

            var latex = new LatexFragment(s);

            page.Paragraphs.Add(latex);
            doc.Save(dataDir + "Script_out.pdf");
            //ExEnd: UseLatexScript3
        }