private PdfPCell GenerateProviderInformationWidget(PrintableProviderDto provider) { var providerCellTable = new PdfPTable(2) { WidthPercentage = 100 }; var providerImageCell = new PdfPCell() { Border = 0 }; var profileImage = GetImageOrDefault(provider); if (profileImage != null) { var image = Image.GetInstance(profileImage); image.ScaleAbsoluteWidth(100); providerImageCell.AddElement(image); providerCellTable.AddCell(providerImageCell); } else { providerCellTable.AddCell(new PdfPCell() { Border = 0 }); } var providerDetailsTable = new PdfPTable(1) { WidthPercentage = 100 }; providerDetailsTable.AddCell(new PdfPCell(new Anchor(provider.Name, fonts["detailh1"]) { Name = provider.Name }) { Border = 0 }); providerDetailsTable.AddCell(new PdfPCell(new Paragraph(provider.SpecialitiesDescription, fonts["detailh2"])) { Border = 0 }); providerDetailsTable.AddCell(new PdfPCell(new Paragraph(provider.PrimaryLocation, fonts["detail"])) { Border = 0 }); providerDetailsTable.AddCell(new PdfPCell(new Paragraph(provider.Address, fonts["detail"])) { Border = 0 }); providerDetailsTable.AddCell(new PdfPCell(new Paragraph(provider.Phone, fonts["detail"])) { Border = 0 }); var providerDetailsCell = new PdfPCell(providerDetailsTable); providerDetailsCell.Border = 0; providerCellTable.AddCell(providerDetailsCell); var cell = new PdfPCell(providerCellTable) { Border = 0 }; cell.PaddingBottom += 10; return cell; }
private byte[] GetImageOrDefault(PrintableProviderDto provider) { if (string.IsNullOrEmpty(provider.ImageUrl)) { var useDefaultImage = _viewSettings.GetBoolSettingValue("UseDefaultImage", false); if (useDefaultImage) { if (_defaultImage == null) { var client = new WebClient(); client.Dispose(); _defaultImage = client.DownloadData(_view.DefaultProviderImageUrl); } return _defaultImage; } else return null; } else { var client = new WebClient(); client.Dispose(); return client.DownloadData(provider.ImageUrl); } }
private PdfPCell GenerateProviderIndexLink(PrintableProviderDto provider) { Anchor click = new Anchor(provider.Name, fonts["h4_link"]); click.Reference = "#" + provider.Name; Paragraph p1 = new Paragraph(); p1.Add(click); var cell = new PdfPCell(p1); cell.Border = 0; cell.PaddingBottom += 5; return cell; }