Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert pdf files to text #15

Closed
dholakiyaankit opened this issue Jan 6, 2016 · 0 comments
Closed

Convert pdf files to text #15

dholakiyaankit opened this issue Jan 6, 2016 · 0 comments

Comments

@dholakiyaankit
Copy link

Is there any way that I can convert this pdf files to txt?
or
Can i write the
using (GhostscriptProcessor processor = new GhostscriptProcessor())
{

                List<string> switches = new List<string>();
                switches.Add("-empty");
                switches.Add("-dQUIET");
                switches.Add("-dSAFER");
                switches.Add("-dBATCH");
                switches.Add("-dNOPAUSE");
                switches.Add("-dNOPROMPT");
                switches.Add("-sDEVICE=pdfwrite");
                switches.Add("-o" + outputPipeHandle);
                switches.Add("-q");
                switches.Add("-f");
                switches.Add(inputFile);

                try
                {
                    processor.StartProcessing(switches.ToArray(), null);

                    byte[] rawDocumentData = gsPipedOutput.Data;

Can I write this by to txt file?

I tried many things like this

var random = new Random();
string tempFileName = random.Next(1,122121212).ToString();
File.WriteAllBytes(@"C:\PrinterPlusPlus\Temp" + tempFileName + ".pdf", rawDocumentData);
// File.WriteAllBytes(@"C:\PrinterPlusPlus\Temp" + tempFileName + ".txt", rawDocumentData.ToArray());
File.WriteAllText(@"C:\PrinterPlusPlus\Temp" + tempFileName + ".txt", result);

                    processor.StartProcessing(CreateTestArgs(@"C:\\PrinterPlusPlus\\Temp\\" + tempFileName + ".pdf", @"C:\\PrinterPlusPlus\\Temp\\" + random.Next(1, 122121212).ToString() + ".pdf"),null);

none of them are working. can you please guide me?

@jhabjan jhabjan closed this as completed Dec 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants