Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

To Add text into PDF file

$
0
0

Hi Team,

Below is the code snippet wrote to add a simple text to PDF file using Aspose.Pdf contained classes. Though the file is created in the location, there is no content(i.e) assigned text in the output pdf file.


                            Pdf m_pdf = new Pdf();
                            Section section = m_pdf.Sections.Add();
                            Aspose.Pdf.Table pdfTable = new Aspose.Pdf.Table(section);
                            Aspose.Pdf.Row pdfRow = pdfTable.Rows.Add();
                            pdfRow.Cells.Add(); 
                            Aspose.Pdf.Cell pdfCell = new Aspose.Pdf.Cell(pdfTable);

                            Text pdfText = new Text();
                            TextInfo textInfo = pdfText.TextInfo;
                            Segment segment = pdfText.Segments.Add();
                            string tempString = "some text";
                            segment.Content = tempString;
                            textInfo = segment.TextInfo;                           
                            if (pdfText != null) pdfCell.Paragraphs.Add(pdfText);
                            section.Paragraphs.Add(pdfTable);
                            MemoryStream stream = new MemoryStream();                             
                            m_pdf.Save(@"c:\temp\test.pdf");

Please correct if i am missing any thing here.


Thanks,
Divya 


Viewing all articles
Browse latest Browse all 3131

Trending Articles