I have written a code for converting PDF files to SVG file, that was running correctly, But now I am getting error in watch :
"Function evaluation is disabled because a previous function evaluation timed out". I am using "Spire.License.dll" (Version: 1.3.7.40) and "Spire.Pdf.dll"( Version:5.1.0.2040). I am using the attached license.
my code is:
- Code: Select all
private void button1_Click(object sender, EventArgs e)
{
Class1 c1 = new Class1();
c1.pdfconverter("E:\\TimerFolder\\Nanocad.pdf");
}
public void pdfconverter(string FilenamewithPath)
{
Spire.License.LicenseProvider.SetLicenseFileName("license.elic.xml");
Spire.License.LicenseProvider.LoadLicense();
//Spire.License.LicenseProvider.SetLicenseFileName("Spire.License.xml");
//Spire.License.LicenseProvider.LoadLicense();
string filePath = FilenamewithPath;
//check if filename_S file exists in folder
// bool removeFileFlag = false;
string fileName = Path.GetFileNameWithoutExtension(filePath);//a
string extension = Path.GetExtension(filePath);//.dwg
string folderpath = Path.GetDirectoryName(filePath);//E:\\teighaSamples
string subFolder = folderpath + "\\" + fileName + "_" + extension.Replace(".", ""); //...E:\\teighaSamples\\a_dwg
string svgPath = folderpath + "\\" + fileName + "_" + extension.Replace(".", "") + "\\" + fileName + "_s"; //...E:\\teighaSamples\\a_dwg\\a_S
//string layerPath = folderpath + "\\" + fileName + "_" + extension.Replace(".", "") + "\\" + fileName + "_L"; //...E:\\teighaSamples\\a_dwg\\a_L
// string thumbPath = folderpath + "\\" + fileName + "_" + extension.Replace(".", "") + "\\" + fileName + ".png"; //...E:\\teighaSamples\\a_dwg\\a.png
//string timeStampPath = folderpath + "\\" + fileName + "_" + extension.Replace(".", "") + "\\" + fileName + "_T"; //...E:\\teighaSamples\\a_dwg\\a_T
bool folderExists = Directory.Exists(subFolder);
// String fileName = Spire.License.LicenseProvider.GetLicenseFileName();
PdfDocument document = new PdfDocument();
System.IO.Directory.CreateDirectory(svgPath);
document.LoadFromFile(filePath);
int totalpage = document.Pages.Count;
Stream[] s = document.SaveToStream(1, (totalpage - 1), FileFormat.SVG);
for (int i = 0; i < totalpage; i++)
{
int j = i + 1;
using (System.IO.FileStream output = new System.IO.FileStream(svgPath + "\\" + j.ToString(), FileMode.Create))
{
s[i].CopyTo(output);
}
}
}
Please suggest me what was wrong.
Thank you,
Kind Regards,
Nilarya Talukdar