We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Copy content into paragraph object

I have PDF file. I want to copy the content of PDF file into Paragraph object. How can i do that?

Hi Aneesh,

Could you please elaborate which paragraph you’re referring to? Also, why and how would you like to copy the contents to a paragraph object? Please share your thoughts in detail, so we could understand your requirement and help you out.


I have a requirement where I have muiltiple files (*.doc, *.xls, *.pdf). I have to merge those files to single PDf doc and create Table of content for it. I used the following code.

Pdf pdf = new Pdf();

pdf.IsBookmarked = true;

pdf.BookMarkLevel = 2;

ListSection TOCSection = new ListSection(pdf);

TOCSection.ListType = ListType.TableOfContents;

Text SText = new Text("Table Of Content");

TOCSection.Title = SText;

TOCSection.Title.TextInfo.Alignment = AlignmentType.Center;

TOCSection.Title.TextInfo.FontSize = 20;


Aspose.Pdf.Section Chapter;

for (int i = 0; i < 1; i++)


Chapter = pdf.Sections.Add();

Heading Chapter_heading = new Heading(pdf,Chapter,1);

Chapter_heading.HeadingType = HeadingType.Arab;

Segment Chapter_segment = new Segment(Chapter_heading);


Chapter_segment.Content = string.Format("Sample Chapter {0}", i);

Chapter_heading.IsInList = true;

Chapter_heading.IsAutoSequence = true;


Text Sample_Text = new Text("Sample text for Chapter");




Above code is working fine, instead of text entered in Sample_Text. I require contents from files.

How can I do that?

Hi Aneesh,

Aspose.Pdf.Kit allows you to concatenate multiple PDF files, however it doesn’t allow you to create a table of contents. Maybe you could convert different files to PDF and another one containing the table of contents and then merge all of those files.

Or, you could extract text from the existing PDF files using Aspose.Pdf.Kit and then insert the text to the above code snippet. However, I’m sorry to share that the extracted text is not formatted; it is extracted as raw text, so we won’t be able to add it as is.

Please share whether the above suggestions help in your scenario?

We’re sorry for the inconvenience.