Upon attempting to us exportelecdoc to export a PDF with no LF pages, I get the following error: "Could not find a part of the path" 'PATH'
Current code as follows:
Upon attempting to us exportelecdoc to export a PDF with no LF pages, I get the following error: "Could not find a part of the path" 'PATH'
Current code as follows:
ExportElecDoc expects the folder to already exist. Try this:
string outputDir = Path.Combine(@"E:\Workflow Data", CaseNumber); Directory.CreateDirectory(outputDir); exp.ExportElecDoc(doc, Path.Combine(outputDir, PDFName + ".pdf"));
I've already created that directory in a previous step and can export pdf's from pages to it without issue. It's only the exportelecdoc function that throws this error.
Another way is to export the edoc directly from the DocumentInfo object (what ExportElecDoc does internally):
string contentType; using (LaserficheReadStream stream = doc.ReadEdoc(out contentType)) using (FileStream file = File.Create(Path.Combine(outputDir, PDFName + ".pdf"))) { stream.CopyTo(file); }
If that still doesn't work, you can use Process Monitor to see if there is some kind of permissions problem or an invalid path being accessed.
Also, you shouldn't call File.OpenWrite before calling ExportElecDoc because ExportElecDoc creates the file. When I do the same thing in my sample code it causes an ExportElecDoc to fail with "The process cannot access the file 'XXXX' because it is being used by another process.".