Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

PDF to HTML Conversion throwing error

$
0
0
Hi,

I've downloaded the .Net samples I was able to build PDF to HTML sample. But when I run it it throws an exception :

"An unhandled exception of type 'System.InvalidCastException' occurred in Aspose.Pdf.dll
Additional information: Unable to cast object of type 'System.Byte[]' to type 'System.String'."

below is the code in Program.cs. The pdfDocument.Save works without the SaveFormat parameter. But anytime I specify SaveFormat e.g Html or Doc etc it throws the same error.

            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");

            //open the source PDF document
            Document pdfDocument = new Document(dataDir + "input.pdf");

            // save the file into MS document format
            pdfDocument.Save(dataDir + "output.html", SaveFormat.Html);

Viewing all articles
Browse latest Browse all 3131

Trending Articles