Closed ajitparida closed 10 years ago
The fromHTML plugin is kinda limited, take a look at #270 for a "workaround".
I'm using 'html2pdf', in browser pdf seems working, but when I open pdf using Acrobat Reader DC (version 2015.023.20070), I'm getting this error: 'An error exists on this page. Acrobat may not display the page correctly'. Below is Javascript code: `function DownloadPDF() { var panel = document.getElementById("<%=pnlContents.ClientID %>") var pdf = new jsPDF('l', 'pt', 'letter'); var html = '
html2pdf(html, pdf, function (pdf) {
pdf.save();
});
return false;
}; `
Below is html of #grPrintItems:
`
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" HorizontalAlign="Center" BorderColor="#000000" BorderStyle="Solid" BorderWidth="1" />
<RowStyle HorizontalAlign="Center" BorderColor="#000000" BorderStyle="Solid" BorderWidth="1" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" BorderColor="#000000" BorderStyle="Solid" BorderWidth="1" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" HorizontalAlign="Center" BorderColor="#000000" BorderStyle="Solid" BorderWidth="1" />
<HeaderStyle BackColor="White" Font-Bold="True" ForeColor="Black" HorizontalAlign="Center" BorderColor="#000000" BorderStyle="Solid" BorderWidth="1" />
<EditRowStyle BackColor="#2461BF" HorizontalAlign="Center" BorderColor="#000000" BorderStyle="Solid" BorderWidth="1" />
<AlternatingRowStyle BackColor="White" HorizontalAlign="Center" BorderColor="#000000" BorderStyle="Solid" BorderWidth="1" />
</asp:GridView>`
Thanks in advance..
I figured out what was happening for me. I was using the following code to generate:
pdf.html($(".BuildBox")[0], {
callback: function (pdf) {
var iframe = document.createElement('iframe');
iframe.setAttribute('style', 'position:absolute;top:0;right:0;height:100%; width:700px');
document.body.appendChild(iframe);
iframe.src = pdf.output('datauristring');
}
});
The issue was that the $(".BuildBox")[0]
container wasn't large enough to hold all the text when the width got changed. When the text overflowed the container, while it would show up fine in the browser, Acrobat wouldn't be able to handle it.
i am working with jspdf to convert HTML to pdf by fromHTML method of jspdf library. facing some issues :: 1) hr tag
not supported 2) i want two column view , so i used two 50% width div - (not working) 3) i want to use line divider , so i used div with top border - (not working)
4) text-decoration: underline - (not working)
is there any way to resolve these issues ??
code : http://jsfiddle.net/ajitparida/2pbzS/ thanks.