Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Tue Jan 29, 2019 2:03 pm

Hello sir,

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

nilarya
 
Posts: 20
Joined: Mon Mar 19, 2018 7:23 am

Wed Jan 30, 2019 3:08 am

Hi Nilarya,

Thanks for your inquiry.
Firstly, I found your code has some thing wrong, please use following correct code:
Code: Select all
            PdfDocument document = new PdfDocument();
            document.LoadFromFile(filePath);
            int totalpage = document.Pages.Count;
            //changed this code, or change "i < totalpage " below to "i < totalpage -1" in the for loop
            Stream[] s = document.SaveToStream(0, (totalpage - 1), FileFormat.SVG);
            for (int i = 0; i < totalpage; i++)
            {
                int j = i + 1;
                using (System.IO.FileStream output = new System.IO.FileStream( "16136 " + j.ToString() +".svg", FileMode.Create))
                {
                    s[i].CopyTo(output);
                }
            }

As for the error "Function evaluation is disabled because a previous function evaluation timed out" in watch, it would occur when the function takes long time. After an initial testing with our latest Spire.PDF Pack(Hot Fix) Version:5.1.16, I could convert my sample file to SVG successfully. Did you convert your PDF to SVG sucessfully? Which code would throw that error on your side? Could you please provide your input PDF and detailed information?

Besides, we deleted your license file here since the forum is public, we suggest you secretly send your license file/key to us([email protected]) next time if you need to provide it.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Mon Feb 18, 2019 9:14 am

Hi Nilarya,

Greetings from E-iceblue.
Has your issue been resolved? Could you please give us some feedback at your convenience?

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.PDF

cron