I have a byte [], that I know it's a PDF, what I need to do now, it's to convert it to PDF format, so I can read it and check some lines inside of it?
How can I do this? I have access to DevExpress frameworks if its help.
Thanks
CodePudding user response:
I guess you're using PdfViewer control.
This control has a method LoadDocument
and one of the overloads accepts stream a parameter.
So you can create a MemoryStream from the array and load this stream into your PdfViewer.
var ms = new MemoryStream(mybytearray);
pdfViewer1.LoadDocument(ms);
UPDATE:
You should use PdfDocumentProcessor.
This class has a method LoadDocument
and one of the overloads accepts stream as a parameter.
So you can create a MemoryStream from the array and load this stream into your PdfDocumentProcessor.
var ms = new MemoryStream(mybytearray);
pdfDocumentProcessor1.LoadDocument(ms);
Then you can access the content of the document. For example you can use GetText method.