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

Conversion from HTML to PDF is failing

$
0
0
Hi,

I am using Aspose.pdf to convert HTML to PDF. For some HTML files it is failing to convert. I am attaching one of them including its CSS and IMAGES. 

Could you please let me know where is the issue?

The version of the Aspose.pdf is given below
Runtime Version v4.0.30319
Version 7.8.0.0

Following is the code used for the conversion

private void GeneratePDF()
        {
            try
            {
                Aspose.Pdf.License license = new Aspose.Pdf.License();
                license.SetLicense("Aspose.Total.lic");

                string pdfPath = @"D:\Aspose Data\loudbookID.pdf";
      
                Aspose.Pdf.Generator.Pdf pdf = new Aspose.Pdf.Generator.Pdf();
                Aspose.Pdf.Generator.Section section;
                StreamReader r;
                Aspose.Pdf.Generator.Text text2;
                section = pdf.Sections.Add();
                r = File.OpenText(@"D:\Aspose Data\OEBPS\Text\AC1119_L1S02_v3_hidden_10-8.html");
                text2 = new Aspose.Pdf.Generator.Text(section, r.ReadToEnd());
                text2.IsHtmlTagSupported = true;
                section.Paragraphs.Add(text2);

                pdf.HtmlInfo.ImgUrl = @"D:\Aspose Data\OEBPS\Text";

                pdf.Save(pdfPath);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Conversion Error" + ex.Message + "\r\n" + ex.StackTrace);
            }
        }

Thanks,
Bibeka

Viewing all articles
Browse latest Browse all 3131

Trending Articles