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

Free Support Forum - aspose.com

Trying to convert an angular page but getting error

Hi,

Unable to cast object of type ‘#=z6jSZAhbtx4Jj2PYiuio3nV28yolCg2kxqhgyQ4jcStaj’ to type ‘#=zf_XiHEHclcw5E9yIqNDNzwZterZIMwlUw_Dkc7p8u7sp’." is the error i am getting. Not that discriptive :wink:

Im trying to convert: test.zip (170.9 KB)

But i get the error: Unable to cast object of type ‘#=z6jSZAhbtx4Jj2PYiuio3nV28yolCg2kxqhgyQ4jcStaj’ to type ‘#=zf_XiHEHclcw5E9yIqNDNzwZterZIMwlUw_Dkc7p8u7sp’."

What am i missing here?

I used the exact same html on https://selectpdf.com/ and their Convert html code online tool. It is working as expected.

@lasseh79

Would you kindly share sample code snippet that you have used for conversion. We will test the scenario in our environment and address it accordingly.

This was just from the online tool as i tried to describe earlier…

But here is some code that i used that has the same error:

public byte[] ToPdfAsposePdf(string html)
        {
            byte[] pdfBytes = new byte[] { };
            double dpi = 72.00;
MemoryStream stream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(html));
            HtmlLoadOptions options = new HtmlLoadOptions(BaseUrl);
            Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(stream, options);
            pdfDocument.EmbedStandardFonts = true;

            using (var pdfStream = new MemoryStream())
            {
                pdfDocument.Save(pdfStream, SaveFormat.Pdf);
                pdfBytes = pdfStream.ToArray();
            }

            return pdfBytes;
}

@lasseh79

We were able to notice the issue in our environment while testing the scenario with Aspose.PDF for .NET 19.12. Hence, we have logged this under the ticket ID PDFNET-47469 in our issue tracking system. We will further look into details of it and keep you posted with the status of its rectification. Please be patient and spare us little time.

We are sorry for the inconvenience.