You are viewing limited content. For full access, please sign in.

Question

Question

How to use exportelecdoc

asked on October 26, 2017

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:

0 0

Replies

replied on October 26, 2017

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"));

 

0 0
replied on October 26, 2017

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.

0 0
replied on October 26, 2017

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.

0 0
replied on October 26, 2017

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.".

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.