Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5984163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:20:06+00:00 2026-05-22T22:20:06+00:00

I have block of text read from a PDF document, using the ItextSharp library(method:

  • 0

I have block of text read from a PDF document, using the ItextSharp library(method: GetResultantText())

Consider the text is outlined/formatted in paragraphs:

*”Paragraph One.

Paragraph Two.
…

Paragraph n
“*

Is there a way to use the C# StringBuilder object, or perhaps an alternate approach, to store the text while retaining the fomatting?: contains carriage returns and paragraphs etc. and store the value in a varchar field in SQL Server 08.

Ultimately I intend storing the text into a varchar field and would like to retain the line feeds, carriage return [basic fomatting metadata], otherwise the extracted text is a single block of text that isn’t readabe when rendered.

I reckon invoking the toString() method on a StringBulder object removes all intermediate formatting characters in a text excecpt the terminating [newlinecharacter].

SimpleTextExtractionStrategy strategy;
            //StreamWriter writer = new StreamWriter("c:\\pdfOutput.txt");

            for (int i = 1; i <= reader.NumberOfPages; i++)
            {
                try
                {
                    strategy = parser.ProcessContent(i, new SimpleTextExtractionStrategy());
                    buffer.AppendLine(strategy.GetResultantText());
                    //writer.WriteLine(strategy.GetResultantText());
                }
                catch (IndexOutOfRangeException e) { }
            }

            pdfText = buffer.ToString();
            Console.WriteLine("* End: Text Extraction Process ...");
            return pdfText = buffer.ToString();

If I uncomment and output to a text file, the fomatting is retained.
However if I save the resulting text into and entity defined as: All i get is a single block of text:

[System.Data.Linq.Mapping.Table(Name = "ReportsText")]
    public class ReportsText
    {
        [Column (IsDbGenerated = true, AutoSync=AutoSync.OnInsert)] 
        public int ID { get; set; }

        [Column(IsPrimaryKey = true, AutoSync = AutoSync.OnInsert)]
        public String image { get; set; } 

        [Column] public String announcement { get; set; }
    }

So pdfText is inteded to be stored into the annouuncement field. Cheers.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T22:20:07+00:00Added an answer on May 22, 2026 at 10:20 pm

    I dont think that it should remove formatting and if it doing so Make use of “\r\n” after each paragraph and than store it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

text block how to do: text trimming for a given height vertical alignment Can
I have a DataTemplate that I am using for a cell in a gridview.
I often have text in columns and need to replace some things without clobbering
Ok the below problem is solved but now its creating leak for this block
I have an ordered list which uses large Georgia for the numbering and smaller
Ok, i have a fully rendered dynamic form ( i do not know the
I want to create an inline-block that will take on some unknown width and
I posted this once, but I was a bit too vague in my information,
This is probably a simple question but why in the following does the paragraph

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.