Welcome Guest Search | Active Topics | Sign In | Register

Table width gets rendered in half size EO.PDF Options
Automotive Global
Posted: Friday, June 17, 2016 2:34:34 AM
Rank: Newbie
Groups: Member

Joined: 2/24/2015
Posts: 4
Code: Visual Basic.NET
Code: HTML/ASPX


Hi, I am trying to create PDF using ASPXToPDF1.RenderAsPDF. In my HTMAL I have created

<div class="panel panel-default" id="Test" style="height: 100%; width: 100%; margin: auto; margin-top: 5px; border: none; visibility: visible">
<asp:Panel class="panel-body" runat="server" ID="Panel1" Style="border: none; width: 100%">
<table style="width: 100%">


<tr style="text-align: center; font-size: 25px; font-weight: 800">
<%If ViewState("PaymentMethodID") = "28" Or ViewState("PaymentMethodID") = "32" Then%>
<td colspan="3" class="label1">Finance Options
</td>
<%Else%>
<td colspan="3" class="label1">Cash Options
</td>
<%End If%>
</tr>
<tr>
<td style="text-align: left; font-size: 18px; width:70%">
<asp:Literal ID="ltrDateNew" runat="server" Text="Date" EnableViewState="False"></asp:Literal></td>
<td style="width:500px"></td>
<td style="font-weight: bold; font-size: 14px; width: 25%">Appendix:</td>
</tr>
<tr style="height: 5px">
<td colspan="3"></td>
</tr>
<tr>
<td align="left" style="height: 20px; font-size: 18px">
<asp:Literal ID="ltrCustomerNameNew" runat="server" Text="" EnableViewState="False"></asp:Literal></td>
<td></td>
<%If ViewState("PaymentMethodID") = "28" Or ViewState("PaymentMethodID") = "32" Then%>
<td>
<i><span style="font-weight: bold; font-size: 15px; color: limegreen">&#10003;</span>&nbsp;&nbsp; &nbsp;&nbsp;Included in option and finance repayments</i>
</td>
<%Else%>
<td><i><span style="font-weight: bold; font-size: 15px; color: limegreen">&#10003;</span>&nbsp;&nbsp; &nbsp;&nbsp;Included in option</i>
</td>
<%End If%>
</tr>
<tr style="height: 5px">
<td colspan="3"></td>
</tr>
<tr>
<td class="label1" style="font-weight: bold; display: inline">
<%-- <asp:Literal ID="ltrHeadingNew" runat="server" Text="HEADING" EnableViewState="False"></asp:Literal>--%>
<asp:Label ID="Label6" runat="server" Text="Congratulations on the purchase of your vehicle. " Font-Bold="false" Font-Size="18px"></asp:Label>
<asp:Label ID="ltrHeadingNew" runat="server" Text="&#10003;" Font-Bold="false" Font-Size="18px"></asp:Label>
</td>
<td></td>
<%If ViewState("ProdExec") = "1" Then%>
<td>
<i><span style="font-weight: bold; font-size: 15px; color: red">&#10007</span>&nbsp; &nbsp;&nbsp;Not included in option</i>
</td>
<%Else%>
<td></td>
<%End If%>
</tr>

<tr style="height: 5px">
<td colspan="3"></td>
</tr>
<tr>
<td class="label1" style="font-size: 18px">The purpose of this letter is to identify a number of product options which may be available to you for the above vehicle.
</td>
<td></td>
<%If ViewState("PaymentMethodID") = "28" Or ViewState("PaymentMethodID") = "32" Then%>
<td>
<i><span style="font-weight: bold; font-size: 15px; color: limegreen">$</span>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;Included in option but <u style="color: black; font-weight: bold">not in finance repayments</u></i>
</td>
<%Else%>
<td></td>
<%End If%>
</tr>


<tr style="display: none">
<%If ViewState("PaymentMethodID") = "28" Or ViewState("PaymentMethodID") = "32" Then%>
<td>
<u style="font-weight: bold">Loan Options</u>&nbsp;&nbsp;
<asp:Literal ID="ltrLoanTypeNew" runat="server" Text="HEADING" EnableViewState="False"></asp:Literal>
</td>
<td></td>
<td></td>
<%Else%>
<td>
<u style="font-weight: bold">Cash Options</u>&nbsp;&nbsp;

</td>
<td></td>
<td></td>
<%End If%>
</tr>


</table>
</asp:Panel>
</div>
When this table rendered as PDF the Table size gets Half of the page.... WHY???

Below is by VB code ( Landscape)

EO.Pdf.HtmlToPdf.Options.PageSize = New SizeF(EO.Pdf.PdfPageSizes.A4.Height, EO.Pdf.PdfPageSizes.A4.Width)
EO.Pdf.HtmlToPdf.Options.OutputArea = New RectangleF(0.3F, 0.3F, EO.Pdf.PdfPageSizes.A4.Height - 0.6F, EO.Pdf.PdfPageSizes.A4.Width - 0.6F)
' EO.Pdf.HtmlToPdf.Options.ZoomLevel = 0.75
EO.Pdf.HtmlToPdf.Options.VisibleElementIds = "Test"
Dim CommonClass As New CommonC
EO.Pdf.Runtime.AddLicense(CommonClass.GetEOPdfLicense())
ASPXToPDF1.RenderAsPDF(sfilename) ' sfilename =>set from another function

How to Fit the Table in Total output area of PDF???? I am using EO.TOtal 2016 version
eo_support
Posted: Friday, June 17, 2016 9:05:50 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

Please remove "height:100%" on the body element. The browser "window" size for EO.Pdf is NOT the full page size (imagine that an HTML page that results in multiple PDF pages). So you can not rely on that. To fit the PDF page, you can use a fixed pixel size. You can use this formula to find out the full pixel size of a PDF page:

height in inch * 96 / 72 / zoom level

You can add JavaScript in your HTML to make this change conditionally based on whether your page is running inside the converter or not. See here for more information on how to detect whether the page is running inside the converter:

http://www.essentialobjects.com/doc/common/eo_js.aspx

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.