cyimxtck
asked on
Cannot locate resource URI when it clearly exists
For some reason I cannot get the URI to locate a file.
Stream stream = Application.GetResourceStr eam(new Uri("D:\\MultipageDocument .pdf", UriKind.Relative)).Stream;
Here is where it bombs regardless of what I try to use; we have tried embedding into the app, use a drive letter, Relative, Absolute, nothing works. We are getting "Cannot find resource" when it is truly there.
Stream stream = Application.GetResourceStr eam(new Uri("Viewer_PDF, PDF/MultipageDocument.pdf" , UriKind.Relative)).Stream;
Any help would be greatly appreciated.
Stream stream = Application.GetResourceStr
Here is where it bombs regardless of what I try to use; we have tried embedding into the app, use a drive letter, Relative, Absolute, nothing works. We are getting "Cannot find resource" when it is truly there.
Stream stream = Application.GetResourceStr
Any help would be greatly appreciated.
Please let me know if the file's location is under your app's root directory or somewhere else in the file system?
ASKER
After hours of playing with it, I was able to get this to work:
var str = Application.GetRemoteStrea m(new Uri("pack://siteoforigin:, ,,/pdf/Mul tipageDocu ment.pdf", UriKind.Absolute));
Stream stream = str.Stream;
var rdr = stream.ReadByte();
But I cannot read the PDF file text from the stream to put it into a text file.
var str = Application.GetRemoteStrea
Stream stream = str.Stream;
var rdr = stream.ReadByte();
But I cannot read the PDF file text from the stream to put it into a text file.
You can not read PDF's text like that. PDF is a binary format you will have to use a paid or free PDF component to do that. I suggest you look at : https://itextpdf.com/. They have both, open source, community supported library as well as commercially licensed library. You can choose as per your needs. There are other paid and free solutions available as well.
ASKER
We were trying with Telerik controls in:
RadFixedDocument document = new PdfFormatProvider(stream, FormatProviderSettings.Rea dOnDemand) .Import();
iText was a company we reached out to but cannot find the open source version of their code?
Do you have any idea where to find that?
ALL we want to do is read a PDF to text.
Thanks for your help,
B
RadFixedDocument document = new PdfFormatProvider(stream, FormatProviderSettings.Rea
iText was a company we reached out to but cannot find the open source version of their code?
Do you have any idea where to find that?
ALL we want to do is read a PDF to text.
Thanks for your help,
B
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks a ton!
You are welcome :)