我正在使用网络服务使用 Ecrion Ultrascale 从 PDF 转换为 TIFF,一切正常,除了我刚刚注意到转换完成后输出文件(渲染文件)仍在使用中,有谁知道这是为什么正在发生,我该如何解决这个问题?
[WebMethod]
public void ConvertPDF2Tiff(string fileName, bool createFolder, string folderName)
{
string filename = Path.GetFileNameWithoutExtension(fileName);
string path = Path.GetDirectoryName(fileName);
String inFilePath = fileName;
String outFilePath;
if (createFolder)
{
outFilePath = Path.Combine(path, "temp", filename + ".tif");
}
else
{
outFilePath = Path.Combine(path, filename + ".tif");
}
Stream outStm = null;
Directory.CreateDirectory(Path.Combine(path, "temp"));
// Open the out stream
outStm = new FileStream(outFilePath, FileMode.Create);
// Initialize data source
Stream sw = File.OpenRead(inFilePath);
IDataSource input = new XmlDataSource(sw, Engine.InputFormat.PDF);
// Initialize rendering parameters
RenderingParameters p = new RenderingParameters();
p.CompressionAlgorithm = Engine.CompressionAlgorithm.LZW;
p.OutputFormat = Engine.OutputFormat.TIFF;
// Render the TIFF
Engine eng = new Engine();
eng.Render(input, outStm, p);
sw.Close();
outStm.Close();
}
提前致谢。