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

Free Support Forum - aspose.cloud

HTML to PDF org chart converter

I have an HTML content (extensive organization chart), the exported file does not correctly reflect the organization chart as it is shown on the screen, my code is the following

public static byte[] GenerarPDF()
        {
            Aspose.Pdf.HtmlLoadOptions htmlOptions = new Aspose.Pdf.HtmlLoadOptions(basePath);
            htmlOptions.PageInfo.IsLandscape = true;
            byte[] bytesResultado;
            using (MemoryStream ms = new MemoryStream())
            {
                byte[] msLecturaHtml;
                using (StreamWriter sr = new StreamWriter(ms))
                {
                    sr.Write(HTML);
                    sr.Flush();
                    msLecturaHtml = ms.ToArray();
                }
                using (MemoryStream msLectura = new MemoryStream(msLecturaHtml))
                {
                    using (Aspose.Pdf.Document doc = new Aspose.Pdf.Document(msLectura, htmlOptions))
                    {
                        using (MemoryStream msDestino = new MemoryStream())
                        {
                            doc.Save(msDestino, Aspose.Pdf.SaveFormat.Pdf);
                            bytesResultado = msDestino.ToArray();
                        }
                    }
                }
            }
            htmlOptions = null;
            return bytesResultado;
        }

Attached HTML image and PDF
image.png (37.6 KB)

HTML
demo.7z (8.0 KB)

This topic has been moved to the related forum: https://forum.aspose.com/t/html-to-pdf-org-chart-converter/253820