We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Error - System.IO.IOException - No file descriptors available error when converting PDF to HTML

When I try to convert files from PDF to HTML. in some of the files I’m getting this error

Error log
System.IO.IOException: No file descriptors available
at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter)
at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode)
at System.IO.FileStream…ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at . ? ()
at ? ?. ? ()
at . ? ()
at ? .? ? ( , , )
at ? .? ? ( , )

PDF to HTML Conversion Script

   private Boolean generateHTMLFromPDFAspose(String output, MemoryStream docStream)
        {
            Console.WriteLine("PDF --->");
            Aspose.Pdf.Text.FontRepository.Sources.Add(new Aspose.Pdf.Text.FolderFontSource(Path.GetFullPath(Directory.GetCurrentDirectory() + "//fonts//")));
            Aspose.Pdf.License license = new Aspose.Pdf.License();
            license.SetLicense(Path.GetFullPath(Directory.GetCurrentDirectory() + "//license//Aspose.Total.lic"));

            Aspose.Pdf.Document doc = new Aspose.Pdf.Document(docStream);
            Console.WriteLine("Save Options ---------->");
            Aspose.Pdf.HtmlSaveOptions newOptions = new Aspose.Pdf.HtmlSaveOptions();

            newOptions.FixedLayout = true;
            newOptions.SplitIntoPages = false;

            newOptions.FontSavingMode = Aspose.Pdf.HtmlSaveOptions.FontSavingModes.SaveInAllFormats;
            newOptions.RasterImagesSavingMode = Aspose.Pdf.HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground;
            newOptions.PartsEmbeddingMode = Aspose.Pdf.HtmlSaveOptions.PartsEmbeddingModes.EmbedAllIntoHtml;
            newOptions.DefaultFontName = "Comic Sans MS";

            // This is just optimization for IE and can be omitted

            newOptions.LettersPositioningMethod = Aspose.Pdf.HtmlSaveOptions.LettersPositioningMethods.UseEmUnitsAndCompensationOfRoundingErrorsInCss;
            newOptions.FontEncodingStrategy = Aspose.Pdf.HtmlSaveOptions.FontEncodingRules.DecreaseToUnicodePriorityLevel;
            newOptions.CustomProgressHandler = new Aspose.Pdf.UnifiedSaveOptions.ConversionProgressEventHandler(ShowProgressOnConsole);


            doc.Save(output, newOptions);
            Console.WriteLine("Done conversion ------------>");
            return true;
        }

Same error getting for more than 30-40 doucments.

I’m using ASPOSE total 18.8.0 [Licensed one]. Kindly help me on this :slight_smile:

@pravnviji,

Thanks for contacting support.

Can you please share source file so that we may further investigate to help you out.