private void ReportBody(Verhuren verhuur) { // Table header _fontstyle = FontFactory.GetFont("Tahoma", 8f, 1); _pdfCell = new PdfPCell(new Phrase("Merk + Type", _fontstyle)); _pdfCell.HorizontalAlignment = Element.ALIGN_CENTER; _pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE; _pdfCell.BackgroundColor = BaseColor.LIGHT_GRAY; _pdfTable.AddCell(_pdfCell); _pdfCell = new PdfPCell(new Phrase("Kenteken", _fontstyle)); _pdfCell.HorizontalAlignment = Element.ALIGN_CENTER; _pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE; _pdfCell.BackgroundColor = BaseColor.LIGHT_GRAY; _pdfTable.AddCell(_pdfCell); // Table body _fontstyle = FontFactory.GetFont("Tahoma", 8f, 0); _pdfCell = new PdfPCell(new Phrase(verhuur.Voertuigen.merk.ToString() + " " + verhuur.Voertuigen.type.ToString(), _fontstyle)); _pdfCell.HorizontalAlignment = Element.ALIGN_CENTER; _pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE; _pdfCell.BackgroundColor = BaseColor.WHITE; _pdfTable.AddCell(_pdfCell); _pdfCell = new PdfPCell(new Phrase(verhuur.kenteken, _fontstyle)); _pdfCell.HorizontalAlignment = Element.ALIGN_CENTER; _pdfCell.VerticalAlignment = Element.ALIGN_MIDDLE; _pdfCell.BackgroundColor = BaseColor.WHITE; _pdfTable.AddCell(_pdfCell); _pdfTable.CompleteRow(); _fontstyle = FontFactory.GetFont("Tahoma", 8f, 1); _pdfCell = new PdfPCell(new Phrase("Wij verzoeken u vriendelijk om de gehuurde auto op tijd op te halen tussen de werktijden.", _fontstyle)); _pdfCell.Colspan = 4; _pdfCell.HorizontalAlignment = Element.ALIGN_CENTER; _pdfCell.Border = 0; _pdfCell.BackgroundColor = BaseColor.WHITE; _pdfCell.ExtraParagraphSpace = 0; _pdfTable.AddCell(_pdfCell); _pdfTable.CompleteRow(); }
public byte[] PreparePDF(Verhuren verhuur) { _document = new Document(PageSize.A4, 0f, 0f, 0f, 0f); _document.SetPageSize(PageSize.A4); _document.SetMargins(20f, 20f, 20f, 20f); _pdfTable.WidthPercentage = 100; _pdfTable.HorizontalAlignment = Element.ALIGN_CENTER; _fontstyle = FontFactory.GetFont("Tahoma", 8f, 1); PdfWriter.GetInstance(_document, _memoryStream); _document.Open(); _pdfTable.SetWidths(new float[] { 30f, 90f, 50f, 100f }); this.ReportHeader(verhuur); this.ReportBody(verhuur); _pdfTable.HeaderRows = 2; _document.Add(_pdfTable); _document.Close(); return(_memoryStream.ToArray()); }
private void ReportHeader(Verhuren verhuur) { _fontstyle = FontFactory.GetFont("Tahoma", 11f, 1); _pdfCell = new PdfPCell(new Phrase("Aan:", _fontstyle)); _pdfCell.Colspan = 3; _pdfCell.HorizontalAlignment = Element.ALIGN_LEFT; _pdfCell.Border = 0; _pdfCell.BackgroundColor = BaseColor.WHITE; _pdfCell.ExtraParagraphSpace = 0; _pdfTable.AddCell(_pdfCell); _pdfCell = new PdfPCell(new Phrase("Van:", _fontstyle)); _pdfCell.Colspan = 1; _pdfCell.HorizontalAlignment = Element.ALIGN_RIGHT; _pdfCell.Border = 0; _pdfCell.BackgroundColor = BaseColor.WHITE; _pdfCell.ExtraParagraphSpace = 0; _pdfTable.AddCell(_pdfCell); _pdfTable.CompleteRow(); _fontstyle = FontFactory.GetFont("Tahoma", 11f, 0); _pdfCell = new PdfPCell(new Phrase(verhuur.Klanten.voornaam + " " + verhuur.Klanten.tussenvoegsel + " " + verhuur.Klanten.achternaam, _fontstyle)); _pdfCell.Colspan = 3; _pdfCell.HorizontalAlignment = Element.ALIGN_LEFT; _pdfCell.Border = 0; _pdfCell.BackgroundColor = BaseColor.WHITE; _pdfCell.ExtraParagraphSpace = 0; _pdfTable.AddCell(_pdfCell); _pdfCell = new PdfPCell(new Phrase("Autoverhuur Jansen", _fontstyle)); _pdfCell.Colspan = 1; _pdfCell.HorizontalAlignment = Element.ALIGN_RIGHT; _pdfCell.Border = 0; _pdfCell.BackgroundColor = BaseColor.WHITE; _pdfCell.ExtraParagraphSpace = 0; _pdfTable.AddCell(_pdfCell); _pdfTable.CompleteRow(); _pdfCell = new PdfPCell(new Phrase(verhuur.Klanten.adres, _fontstyle)); _pdfCell.Colspan = 3; _pdfCell.HorizontalAlignment = Element.ALIGN_LEFT; _pdfCell.Border = 0; _pdfCell.BackgroundColor = BaseColor.WHITE; _pdfCell.ExtraParagraphSpace = 0; _pdfTable.AddCell(_pdfCell); _pdfCell = new PdfPCell(new Phrase("Patatlaan 21", _fontstyle)); _pdfCell.Colspan = 1; _pdfCell.HorizontalAlignment = Element.ALIGN_RIGHT; _pdfCell.Border = 0; _pdfCell.BackgroundColor = BaseColor.WHITE; _pdfCell.ExtraParagraphSpace = 0; _pdfTable.AddCell(_pdfCell); _pdfTable.CompleteRow(); _pdfCell = new PdfPCell(new Phrase(verhuur.Klanten.postcode + " " + verhuur.Klanten.woonplaats, _fontstyle)); _pdfCell.Colspan = 3; _pdfCell.HorizontalAlignment = Element.ALIGN_LEFT; _pdfCell.Border = 0; _pdfCell.BackgroundColor = BaseColor.WHITE; _pdfCell.ExtraParagraphSpace = 0; _pdfTable.AddCell(_pdfCell); _pdfCell = new PdfPCell(new Phrase("2490BS Den Haag", _fontstyle)); _pdfCell.Colspan = 1; _pdfCell.HorizontalAlignment = Element.ALIGN_RIGHT; _pdfCell.Border = 0; _pdfCell.BackgroundColor = BaseColor.WHITE; _pdfCell.ExtraParagraphSpace = 0; _pdfTable.AddCell(_pdfCell); _pdfTable.CompleteRow(); _pdfCell = new PdfPCell(new Phrase("Tel. 021 1234567", _fontstyle)); _pdfCell.Colspan = 4; _pdfCell.HorizontalAlignment = Element.ALIGN_RIGHT; _pdfCell.Border = 0; _pdfCell.BackgroundColor = BaseColor.WHITE; _pdfCell.ExtraParagraphSpace = 0; _pdfTable.AddCell(_pdfCell); _pdfTable.CompleteRow(); _pdfCell = new PdfPCell(new Phrase("Web: www.lhhamming-001-site2.etempurl.com", _fontstyle)); _pdfCell.Colspan = 4; _pdfCell.HorizontalAlignment = Element.ALIGN_RIGHT; _pdfCell.Border = 0; _pdfCell.BackgroundColor = BaseColor.WHITE; _pdfCell.ExtraParagraphSpace = 0; _pdfTable.AddCell(_pdfCell); _pdfTable.CompleteRow(); _pdfCell = new PdfPCell(new Phrase("Mail: [email protected]", _fontstyle)); _pdfCell.Colspan = 4; _pdfCell.HorizontalAlignment = Element.ALIGN_RIGHT; _pdfCell.Border = 0; _pdfCell.BackgroundColor = BaseColor.WHITE; _pdfCell.ExtraParagraphSpace = 0; _pdfTable.AddCell(_pdfCell); _pdfTable.CompleteRow(); _pdfCell = new PdfPCell(new Phrase("\n", _fontstyle)); _pdfCell.Colspan = 4; _pdfCell.HorizontalAlignment = Element.ALIGN_RIGHT; _pdfCell.Border = 0; _pdfCell.BackgroundColor = BaseColor.WHITE; _pdfCell.ExtraParagraphSpace = 0; _pdfTable.AddCell(_pdfCell); _pdfTable.CompleteRow(); _pdfCell = new PdfPCell(new Phrase("\n", _fontstyle)); _pdfCell.Colspan = 4; _pdfCell.HorizontalAlignment = Element.ALIGN_RIGHT; _pdfCell.Border = 0; _pdfCell.BackgroundColor = BaseColor.WHITE; _pdfCell.ExtraParagraphSpace = 0; _pdfTable.AddCell(_pdfCell); _pdfTable.CompleteRow(); _pdfCell = new PdfPCell(new Phrase("\n", _fontstyle)); _pdfCell.Colspan = 4; _pdfCell.HorizontalAlignment = Element.ALIGN_RIGHT; _pdfCell.Border = 0; _pdfCell.BackgroundColor = BaseColor.WHITE; _pdfCell.ExtraParagraphSpace = 0; _pdfTable.AddCell(_pdfCell); _pdfTable.CompleteRow(); _fontstyle = FontFactory.GetFont("Tahoma", 11f, 1); _pdfCell = new PdfPCell(new Phrase("Factuurgegevens", _fontstyle)); _pdfCell.Colspan = 4; _pdfCell.HorizontalAlignment = Element.ALIGN_LEFT; _pdfCell.Border = 0; _pdfCell.BackgroundColor = BaseColor.WHITE; _pdfCell.ExtraParagraphSpace = 0; _pdfTable.AddCell(_pdfCell); _pdfTable.CompleteRow(); _fontstyle = FontFactory.GetFont("Tahoma", 11f, 0); _pdfCell = new PdfPCell(new Phrase("Factuurnummer: " + verhuur.VerhuurId, _fontstyle)); _pdfCell.Colspan = 4; _pdfCell.HorizontalAlignment = Element.ALIGN_LEFT; _pdfCell.Border = 0; _pdfCell.BackgroundColor = BaseColor.WHITE; _pdfCell.ExtraParagraphSpace = 0; _pdfTable.AddCell(_pdfCell); _pdfTable.CompleteRow(); _pdfCell = new PdfPCell(new Phrase("Begindatum verhuur: " + verhuur.beginDatum.ToString().Remove(verhuur.beginDatum.ToString().Length - 9), _fontstyle)); _pdfCell.Colspan = 4; _pdfCell.HorizontalAlignment = Element.ALIGN_LEFT; _pdfCell.Border = 0; _pdfCell.BackgroundColor = BaseColor.WHITE; _pdfCell.ExtraParagraphSpace = 0; _pdfTable.AddCell(_pdfCell); _pdfTable.CompleteRow(); _pdfCell = new PdfPCell(new Phrase("Eindddatum verhuur: " + verhuur.eindDatum.ToString().Remove(verhuur.eindDatum.ToString().Length - 9), _fontstyle)); _pdfCell.Colspan = 4; _pdfCell.HorizontalAlignment = Element.ALIGN_LEFT; _pdfCell.Border = 0; _pdfCell.BackgroundColor = BaseColor.WHITE; _pdfCell.ExtraParagraphSpace = 0; _pdfTable.AddCell(_pdfCell); _pdfTable.CompleteRow(); _pdfCell = new PdfPCell(new Phrase("\n")); _pdfCell.Colspan = 4; _pdfCell.HorizontalAlignment = Element.ALIGN_LEFT; _pdfCell.Border = 0; _pdfCell.BackgroundColor = BaseColor.WHITE; _pdfCell.ExtraParagraphSpace = 0; _pdfTable.AddCell(_pdfCell); _pdfTable.CompleteRow(); _pdfCell = new PdfPCell(new Phrase("\n")); _pdfCell.Colspan = 4; _pdfCell.HorizontalAlignment = Element.ALIGN_LEFT; _pdfCell.Border = 0; _pdfCell.BackgroundColor = BaseColor.WHITE; _pdfCell.ExtraParagraphSpace = 0; _pdfTable.AddCell(_pdfCell); _pdfTable.CompleteRow(); _pdfCell = new PdfPCell(new Phrase("\n", _fontstyle)); _pdfCell.Colspan = 4; _pdfCell.HorizontalAlignment = Element.ALIGN_RIGHT; _pdfCell.Border = 0; _pdfCell.BackgroundColor = BaseColor.WHITE; _pdfCell.ExtraParagraphSpace = 0; _pdfTable.AddCell(_pdfCell); _pdfTable.CompleteRow(); _pdfCell = new PdfPCell(new Phrase("\n", _fontstyle)); _pdfCell.Colspan = 4; _pdfCell.HorizontalAlignment = Element.ALIGN_RIGHT; _pdfCell.Border = 0; _pdfCell.BackgroundColor = BaseColor.WHITE; _pdfCell.ExtraParagraphSpace = 0; _pdfTable.AddCell(_pdfCell); _pdfTable.CompleteRow(); _pdfCell = new PdfPCell(new Phrase("\n", _fontstyle)); _pdfCell.Colspan = 4; _pdfCell.HorizontalAlignment = Element.ALIGN_RIGHT; _pdfCell.Border = 0; _pdfCell.BackgroundColor = BaseColor.WHITE; _pdfCell.ExtraParagraphSpace = 0; _pdfTable.AddCell(_pdfCell); _pdfTable.CompleteRow(); }