Greetings again,
Each time I am looking sample code, I always come here first because your code is so accurate and always works on first try.
I got the following XMLWorker class from this awesome forum.
Made some minor changes to suit our need and since then, it works so beautifully.
The issue we are having currently is we would like to put our organization's logo at top of the generated PDF.
The changes I made on the VB side of the code below is not displaying the logo.
I would greatly appreciate your superior talent in helping with this issue.
As always, thank you in advance
<div class="table-responsive">
<span style="font-weight: bold; font-size: 16pt;">Please verify your report before submitting:</span>
<br />
<br />
<%--BEGIN: This part is streamed into PDF and sent as attachment to email on the fly--%>
<div id="EmailCopy">
<span style="font-weight: bold; font-size: 18px; color: #000000;">Name, title, email address, and Badge ID of employee filing this report</span>
<table style="width: 100%" class="table">
<tr>
<td style="margin-left: 20px;"><span style="font-weight: bold; font-size: 12px;">Employee Name:</span>
<asp:Label ID="lblEmpName" runat="server" /></td>
<td><span style="font-weight: bold; font-size: 12px;">Title:</span>
<asp:Label ID="lblPreviewTitle" runat="server" /></td>
<td><span style="font-weight: bold; font-size: 12px;">Email:</span>
<asp:Label ID="lblPreviewEmail" runat="server" /></td>
<td><span style="font-weight: bold; font-size: 12px;">Employee ID:</span>
<asp:Label ID="lblPreviewEmpID" runat="server" /></td>
</tr>
</table>
<hr />
<span style="font-weight: bold; font-size: 18px; color: #000000;">1. Name and address of sources of income for services of $1,000.00 or more of Reporter (excluding income received from DeKalb County):</span>
<table style="width: 100%" class="table">
<tr>
<td>
<asp:Label ID="lblPreviewSourceName" Style="font-size: 12px; text-align: left;" runat="server" /></td>
</tr>
</table>
<br />
<span style="font-weight: bold; font-size: 18px; color: #000000;">2. Name and address of sources of income for services of $1,000.00 more of Spouse:</span>
<table style="width: 100%" class="table">
<tr>
<td>
<asp:Label ID="lblPreviewSpouseName" Style="font-size: 12px; text-align: left;" runat="server" /></td>
</tr>
</table>
<br />
<span style="font-weight: bold; font-size: 18px; color: #000000;">8. Name and address of each creditor to whom the Reporter and Spouse was indebted for a period of 90 consecutive days or more in an amount of $7,500.00 or more, except for retail installment debt, any debt secured by real property or vehicles, credit card debt, medical expense debt, student loan debt, debt for child support or alimony, or tax debt:</span>
<table style="width: 100%" class="table">
<tr>
<td>
<asp:Label ID="lblPreviewCreditorName" Style="font-size: 12px; text-align: left;" runat="server" /></td>
</tr>
</table>
</div>
<%--END: This part is streamed into PDF and sent as attachment to email on the fly--%>
<script type="text/javascript">
$(function () {
$("[id*=btnSave]").click(function () {
$("[id*=hfcopydHtml]").val($("#EmailCopy").html());
});
});
</script>
Dim fileName As String = lblEmpName.Text & DateTime.Now.Ticks & ".pdf"
Dim filePath As String = Server.MapPath(String.Format("~/PDF/{0}", fileName))
Dim tmpPath = "C:\inetpub\wwwroot\Tester" & System.DateTime.Now.ToString("yyyy") - 1 & "\images\PReceipt.png"
Dim uri = New System.Uri(tmpPath)
Dim convertedURI = uri.AbsoluteUri
Using stream As New FileStream(filePath, FileMode.Create)
Dim sr As New StringReader(Request.Form(hfcopydHtml.UniqueID))
Dim pdfDoc As iTextSharp.text.Document = New iTextSharp.text.Document(iTextSharp.text.PageSize.A4, 10.0F, 10.0F, 10.0F, 0F)
Dim writer As PdfWriter = PdfWriter.GetInstance(pdfDoc, stream)
pdfDoc.Open()
XMLWorkerHelper.GetInstance().ParseXHtml(writer, pdfDoc, sr)
pdfDoc.Close()
stream.Close()
End Using