Click here to Skip to main content
15,900,816 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I had Developed the project .in this i want to print the collection in reverse Format

For example "Ramesh" is string But reverse Printing "hsemaR".in this same way i want to

print the collection in reverse Format.

My code:

C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.IO;
using System.Text;
using iTextSharp.text;
using iTextSharp.text.pdf;
using iTextSharp.text.pdf.parser;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace test
{
    public partial class Form1 : Form
    {
        string filename;
        string path;
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.CheckFileExists = true;
            openFileDialog.AddExtension = true;
            openFileDialog.Filter = "PDF files (*.pdf)|*.pdf";
            DialogResult result = openFileDialog.ShowDialog();
            if (result == DialogResult.OK)
            {
                //data1 = openFileDialog.FileNames.Select(x => new FileInfo(x)).ToArray();
                filename = Path.GetFileName(openFileDialog.FileName);
                path = Path.GetDirectoryName(openFileDialog.FileName);
                textBox1.Text = path + "\\" + filename;

            }
        }
        public static string ExtractTextFromPdf(string filename)
        {
            using (PdfReader r = new PdfReader(filename))
            {
                StringBuilder text = new StringBuilder();

                for (int i = 1; i <= r.NumberOfPages; i++)
                {
                    text.Append(PdfTextExtractor.GetTextFromPage(r, i));
                }

                string first = text.ToString();
                return first;
            }
        }

      private void button3_Click(object sender, EventArgs e)
      {
          string s=  Form1.ExtractTextFromPdf(textBox1.Text);
      }
    }
}



button3 is print button

string s contain pdf file data.

i want to print the Pdf file data in reverse string format in richtextbox



please help me

thank u
Posted
Comments
Herman<T>.Instance 27-Aug-15 10:57am    
I have seen in another question that you are using the given solution. Please accept the solution

1 solution

Look at this[^]

SQL
string reverseValue = new string(s.Select((c, index) => new { c, index })
                                         .OrderByDescending(x => x.index)
                                         .Select(x => x.c)
                                         .ToArray());
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900