protected override void CreateSmallLabel(PDFDocument document, TachographDocument tachographDocument) { var table = new PdfPTable(4); table.TotalWidth = 136; table.SetWidths(new float[] { 58, 10, 10, 58 }); GetSmallImage(document, table); document.AddSpannedCell(table, Resources.TXT_TACHOGRAPH_AND_M1N1_INSPECTION_PLATE, 4, document.GetSmallerFont(), 29); document.AddSpannedCell(table, string.Format(Resources.TXT_W_FACTOR_IMP_KM, tachographDocument.WFactor), 2, document.GetXSmallFont(false), 15); document.AddSpannedCell(table, string.Format(Resources.TXT_K_FACTOR_IMP_KM, tachographDocument.KFactor), 2, document.GetXSmallFont(false), 15); document.AddSpannedCell(table, string.Format(Resources.TXT_L_FACTOR_MM, tachographDocument.LFactor), 1, document.GetXSmallFont(false), 15, 58); document.AddSpannedCell(table, string.Format(Resources.TXT_VIN_SMALL_LABEL, tachographDocument.VIN), 3, document.GetXXSmallFont(), 16, 68); document.AddSpannedCell(table, string.Format(Resources.TXT_TYRE_SIZE_SMALL_LABEL, tachographDocument.TyreSize), 4, document.GetSmallFont(false), 17, Element.ALIGN_LEFT); document.AddSpannedCell(table, string.Format(Resources.TXT_SERIAL_NUMBER_SMALL_LABEL, tachographDocument.SerialNumber), 4, document.GetSmallFont(false), 17, Element.ALIGN_LEFT); document.AddSpannedCell(table, string.Format(Resources.TXT_M1N1_SERIAL_SMALL_LABEL, tachographDocument.TachographAdapterSerialNumber), 4, document.GetSmallFont(false), 18, Element.ALIGN_LEFT); document.AddSpannedCell(table, string.Format(Resources.TXT_LOCATION_SMALL_LABEL, tachographDocument.TachographAdapterLocation), 4, document.GetSmallFont(false), 16, Element.ALIGN_LEFT); document.AddSpannedCell(table, string.Format(Resources.TXT_COLOR_SMALL_LABEL, tachographDocument.TachographCableColor), 4, document.GetSmallFont(false), 16, Element.ALIGN_LEFT); GetCompanyDetails(document, table, 69, 3, document.GetSmallerFont()); document.AddSpannedCell(table, Resources.TXT_SMALL_LABEL_DATE + GetCalibrationTime(tachographDocument.CalibrationTime), 1, document.GetRegularFont(false)); document.AddSpannedCell(table, GetLicenseNumberParagraph(document, false), 4, 16, Element.ALIGN_LEFT); table.WriteSelectedRows(0, -1, document.Document.LeftMargin + 2, document.Height - 103, document.ContentByte); }
public static void Create(PDFDocument document, UndownloadabilityDocument undownloadabilityDocument) { var settingsRepository = ContainerBootstrapper.Resolve <ISettingsRepository <WorkshopSettings> >(); WorkshopSettings settings = settingsRepository.GetWorkshopSettings(); var rawData = ImageHelper.LoadFromResourcesAsByteArray("UndownloadHeader"); document.AddImage(rawData, 390, 290, 59, document.Height - 350); AbsolutePositionText(document, settings.WorkshopName, 61, 710, 500, 50, document.GetLargeFont(true), Element.ALIGN_LEFT); AbsolutePositionText(document, settings.Address1, 61, 680, 500, 50, document.GetRegularFont(false), Element.ALIGN_LEFT); AbsolutePositionText(document, $"{settings.Town} {settings.PostCode}", 61, 645, 500, 50, document.GetRegularFont(false), Element.ALIGN_LEFT); AbsolutePositionText(document, undownloadabilityDocument.TachographMake, 61, 585, 500, 50, document.GetRegularFont(false), Element.ALIGN_LEFT); AbsolutePositionText(document, undownloadabilityDocument.TachographModel, 61, 548, 500, 50, document.GetRegularFont(false), Element.ALIGN_LEFT); AbsolutePositionText(document, undownloadabilityDocument.SerialNumber, 61, 510, 500, 50, document.GetRegularFont(false), Element.ALIGN_LEFT); string line1 = GetLine1Text(undownloadabilityDocument.TachographMake, undownloadabilityDocument.TachographModel, undownloadabilityDocument.SerialNumber, undownloadabilityDocument.RegistrationNumber); AbsolutePositionText(document, line1, 61, 450, 550, 50, document.GetLargerFont(false), Element.ALIGN_LEFT); string line2 = GetLine2Text(); AbsolutePositionText(document, line2, 61, 405, 550, 50, document.GetLargerFont(false), Element.ALIGN_LEFT); string line3 = GetLine3Text(); AbsolutePositionText(document, line3, 61, 375, 550, 100, document.GetLargerFont(false), Element.ALIGN_LEFT); string line4 = GetLine4Text(); AbsolutePositionText(document, line4, 61, 310, 550, 100, document.GetLargerFont(false), Element.ALIGN_LEFT); document.DrawLine(50, 219, 545, 219); document.DrawLine(50, 147, 545, 147); document.DrawLine(125, 172, 238, 172); document.DrawLine(322, 172, 484, 172); if (undownloadabilityDocument.InspectionDate != null) { AbsolutePositionText(document, undownloadabilityDocument.InspectionDate.Value.ToString("dd.MM.yyyy"), 125, 195, 200, 20, document.GetSmallerFont(), Element.ALIGN_LEFT); } AbsolutePositionText(document, Resources.TXT_DATE, 125, 175, 200, 20, document.GetSmallerFont(), Element.ALIGN_LEFT); TryAddSignature(document, undownloadabilityDocument, 310, 158); AbsolutePositionText(document, string.Format(Resources.TXT_UNDOWNLOADABILITY_SIGNATURE, undownloadabilityDocument.Technician), 322, 175, 522, 20, document.GetSmallerFont(), Element.ALIGN_LEFT); }
protected override void CreateSmallLabel(PDFDocument document, TachographDocument tachographDocument) { var table = new PdfPTable(4) { TotalWidth = 136 }; table.SetWidths(new float[] { 58, 10, 20, 48 }); GetSmallImage(document, table); document.AddSpannedCell(table, TrimDocumentType(tachographDocument.DocumentType), 4, document.GetSmallerFont(), 21); document.AddSpannedCell(table, string.Format(Resources.TXT_SMALL_W_FACTOR, tachographDocument.WFactor), 2, document.GetXSmallFont(false), 20); document.AddSpannedCell(table, string.Format(Resources.TXT_SMALL_K_FACTOR, tachographDocument.KFactor), 2, document.GetXSmallFont(false), 20); document.AddSpannedCell(table, string.Format(Resources.TXT_SMALL_L_FACTOR, tachographDocument.LFactor, Resources.TXT_MM), 4, document.GetRegularFont(false), 20, 58); document.AddSpannedCell(table, string.Format(Resources.TXT_SMALL_TYRE_SIZE, tachographDocument.TyreSize), 4, document.GetSmallerFont(), 20, Element.ALIGN_LEFT); document.AddSpannedCell(table, string.Format(Resources.TXT_SMALL_VIN, tachographDocument.VIN), 4, document.GetSmallerFont(), 20, 68); document.AddSpannedCell(table, string.Format(Resources.TXT_SMALL_SERIAL_NUMBER, tachographDocument.SerialNumber), 4, document.GetSmallerFont(), 20, Element.ALIGN_LEFT); GetCompanyDetails(document, table, 85, 3, document.GetRegularFont(false)); document.AddSpannedCell(table, string.Format(Resources.TXT_SMALL_DATE, GetCalibrationTime(tachographDocument.CalibrationTime)), 1, document.GetSmallFont(false)); document.AddSpannedCell(table, GetLicenseNumberParagraph(document, false), 4, 20, Element.ALIGN_LEFT); table.WriteSelectedRows(0, -1, document.Document.LeftMargin + 2, document.Height - 103, document.ContentByte); }
protected override void CreateMediumLabel(PDFDocument document, TachographDocument tachographDocument) { var table = new PdfPTable(4) { TotalWidth = 266 }; table.SetWidths(new float[] { 108, 54, 54, 108 }); GetWorkshopImage(document, table); document.AddSpannedCell(table, TrimDocumentType(tachographDocument.DocumentType), 2, document.GetSmallerFont(), 29); document.AddSpannedCell(table, string.Format(Resources.TXT_MEDIUM_W_FACTOR, tachographDocument.WFactor), 1, document.GetXSmallFont(false), 16); document.AddSpannedCell(table, string.Format(Resources.TXT_MEDIUM_K_FACTOR, tachographDocument.KFactor), 2, document.GetXSmallFont(false), 16); document.AddSpannedCell(table, string.Format(Resources.TXT_MEDIUM_L_FACTOR, tachographDocument.LFactor, Resources.TXT_MM), 1, document.GetXSmallFont(false), 16); document.AddSpannedCell(table, string.Format(Resources.TXT_MEDIUM_VIN, tachographDocument.VIN), 2, document.GetSmallFont(false), 16, 68); document.AddSpannedCell(table, string.Format(Resources.TXT_MEDIUM_TYRE_SIZE, tachographDocument.TyreSize), 2, document.GetSmallFont(false), 17, Element.ALIGN_LEFT); document.AddSpannedCell(table, string.Format(Resources.TXT_MEDIUM_SERIAL_NUMBER, tachographDocument.SerialNumber), 2, document.GetSmallFont(false), 17, Element.ALIGN_LEFT); document.AddSpannedCell(table, string.Format(Resources.TXT_MEDIUM_DATE, GetCalibrationTime(tachographDocument.CalibrationTime)), 2, document.GetRegularFont(false)); GetCompanyDetails(document, table, 45, 4, document.GetRegularFont(false)); document.AddSpannedCell(table, GetLicenseNumberParagraph(document, true), 4, 12, Element.ALIGN_LEFT); table.WriteSelectedRows(0, -1, document.Document.LeftMargin + 193, document.Height - 103, document.ContentByte); }
protected override void CreateLargeLabel(PDFDocument document, TachographDocument tachographDocument, int startHorizontal, int startVertical) { AbsolutePositionText(document, Resources.TXT_TACHOGRAPH_RECORD_SHEET, (startHorizontal + 32), (startVertical + 0), 580, 100, document.GetXLargeFont(false), Element.ALIGN_CENTER); AbsolutePositionText(document, TrimDocumentType(tachographDocument.DocumentType), (startHorizontal + 32), (startVertical + 30), 580, 100, document.GetRegularFont(false)); //Outlining DrawLargeLabelRectangle(document, startHorizontal, startVertical); document.DrawLine((startHorizontal + 50), (startVertical + 146), (startHorizontal + 545), (startVertical + 146), TotalPageHeight); document.DrawLine((startHorizontal + 50), (startVertical + 234), (startHorizontal + 545), (startVertical + 234), TotalPageHeight); document.DrawLine((startHorizontal + 150), (startVertical + 334), (startHorizontal + 298), (startVertical + 334), TotalPageHeight); document.DrawLine((startHorizontal + 347), (startVertical + 334), (startHorizontal + 494), (startVertical + 334), TotalPageHeight); AbsolutePositionText(document, Resources.TXT_TACHOGRAPH, (startHorizontal + 50), (startVertical + 93), 150, 100); AbsolutePositionText(document, Resources.TXT_VEHICLE, (startHorizontal + 50), (startVertical + 175), 150, 100); AbsolutePositionText(document, Resources.TXT_TECHNICIAN, (startHorizontal + 50), (startVertical + 270), 150, 20); AbsolutePositionText(document, Resources.TXT_DATE, (startHorizontal + 150), (startVertical + 328), 200, 40); TryAddSignature(document, tachographDocument, (startHorizontal + 330)); AbsolutePositionText(document, string.Format(Resources.TXT_SIGNATURE_TECHNICIAN_LARGE, tachographDocument.Technician), (startHorizontal + 347), (startVertical + 328), 550, 40); //Tachograph AbsolutePositionText(document, Resources.TXT_MAKE, (startHorizontal + 150), (startVertical + 60), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, Resources.TXT_TYPE, (startHorizontal + 347), (startVertical + 60), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, tachographDocument.TachographMake, (startHorizontal + 150), (startVertical + 72), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, tachographDocument.TachographModel, (startHorizontal + 347), (startVertical + 72), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, Resources.TXT_ODOMETER_READING, (startHorizontal + 150), (startVertical + 86), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, Resources.TXT_SERIAL_NUMBER, (startHorizontal + 347), (startVertical + 86), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, tachographDocument.OdometerReading, (startHorizontal + 150), (startVertical + 98), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, tachographDocument.SerialNumber, (startHorizontal + 347), (startVertical + 98), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, Resources.TXT_SET_K_FACTOR, (startHorizontal + 150), (startVertical + 112), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, tachographDocument.KFactor, (startHorizontal + 150), (startVertical + 124), 550, 72, document.GetRegularFont(false)); if (tachographDocument.DocumentType == Resources.TXT_MINOR_WORK_DETAILS) { const int workDetailsHeight = 19; document.ContentByte.SetColorStroke(new BaseColor(Color.Black)); document.ContentByte.Rectangle((startHorizontal + 20), (TotalPageHeight - (startVertical + 44 + workDetailsHeight)), 555, workDetailsHeight); document.ContentByte.Stroke(); AbsolutePositionText(document, Resources.TXT_WORK_CARRIED_OUT, (startHorizontal + 50), (startVertical + 40), 150, 100, document.GetSmallerFont()); AbsolutePositionText(document, tachographDocument.MinorWorkDetails, (startHorizontal + 150), (startVertical + 40), 450, 100, document.GetSmallerFont()); } //Vehicle AbsolutePositionText(document, Resources.TXT_MAKE_AND_MODEL, (startHorizontal + 150), (startVertical + 144), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, Resources.TXT_VRN, (startHorizontal + 347), (startVertical + 144), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, string.Format("{0} {1}", tachographDocument.VehicleMake, tachographDocument.VehicleModel), (startHorizontal + 150), (startVertical + 156), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, tachographDocument.RegistrationNumber, (startHorizontal + 347), (startVertical + 156), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, Resources.TXT_VIN, (startHorizontal + 150), (startVertical + 170), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, Resources.TXT_TYRE_SIZE, (startHorizontal + 347), (startVertical + 170), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, tachographDocument.VIN, (startHorizontal + 150), (startVertical + 182), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, tachographDocument.TyreSize, (startHorizontal + 347), (startVertical + 182), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, Resources.TXT_W_FACTOR, (startHorizontal + 150), (startVertical + 196), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, Resources.TXT_TYRE_L_FACTOR, (startHorizontal + 347), (startVertical + 196), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, string.Format(Resources.TXT_IMP_KM_VEHICLE, tachographDocument.WFactor), (startHorizontal + 150), (startVertical + 208), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, tachographDocument.LFactor + Resources.TXT_MM, (startHorizontal + 347), (startVertical + 208), 550, 72, document.GetRegularFont(false)); //Technician AbsolutePositionText(document, RegistrationData.CompanyName, (startHorizontal + 150), (startVertical + 234), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, WorkshopSettings.Address1, (startHorizontal + 150), (startVertical + 258), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, string.Format("{0} {1}", WorkshopSettings.Town, WorkshopSettings.PostCode), (startHorizontal + 150), (startVertical + 272), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, string.Format(Resources.TXT_MINIMAL_LICENSE_NUMBER, RegistrationData.SealNumber), (startHorizontal + 347), (startVertical + 234), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, GetCalibrationTime(tachographDocument.CalibrationTime), (startHorizontal + 150), (startVertical + 314), 250, 40, document.GetRegularFont(false)); }
public static void Create(PDFDocument document, LetterForDecommissioningDocument letterForDecommissioningDocument) { var settingsRepository = ContainerBootstrapper.Resolve <ISettingsRepository <WorkshopSettings> >(); WorkshopSettings settings = settingsRepository.GetWorkshopSettings(); var repository = ContainerBootstrapper.Resolve <IRepository <CustomerContact> >(); var customerContact = repository.FirstOrDefault(contact => string.Equals(letterForDecommissioningDocument.CustomerContact, contact.Name, StringComparison.CurrentCultureIgnoreCase)); if (customerContact != null) { AbsolutePositionText(document, customerContact.Name, 61, 740, 500, 50, document.GetLargeFont(true), Element.ALIGN_LEFT); AbsolutePositionText(document, customerContact.Address, 61, 720, 500, 50, document.GetLargerFont(false), Element.ALIGN_LEFT); AbsolutePositionText(document, $"{customerContact.Town}, {customerContact.PostCode}", 61, 705, 500, 50, document.GetLargerFont(false), Element.ALIGN_LEFT); } if (letterForDecommissioningDocument.InspectionDate != null) { AbsolutePositionText(document, letterForDecommissioningDocument.InspectionDate.Value.ToString("dd.MM.yyyy"), 61, 660, 200, 20, document.GetLargerFont(false), Element.ALIGN_LEFT); } string line1 = GetParagraph1Text(letterForDecommissioningDocument.TachographMake, letterForDecommissioningDocument.TachographModel, letterForDecommissioningDocument.SerialNumber, letterForDecommissioningDocument.RegistrationNumber); AbsolutePositionText(document, line1, 61, 620, 550, 50, document.GetLargerFont(false), Element.ALIGN_LEFT); string line2 = GetParagraph2Text(); AbsolutePositionText(document, line2, 61, 575, 550, 50, document.GetLargerFont(false), Element.ALIGN_LEFT); string line3 = GetParagraph3Text(); AbsolutePositionText(document, line3, 61, 518, 550, 100, document.GetLargerFont(false), Element.ALIGN_LEFT); string line4 = GetParagraph4Text(); AbsolutePositionText(document, line4, 61, 455, 550, 100, document.GetLargerFont(false), Element.ALIGN_LEFT); string regardsText = GetRegardsText(letterForDecommissioningDocument.Technician); AbsolutePositionText(document, regardsText, 61, 395, 550, 100, document.GetLargerFont(false), Element.ALIGN_LEFT); AbsolutePositionText(document, Resources.TXT_SIGNATURE, 61, 350, 550, 100, document.GetSmallerFont(), Element.ALIGN_LEFT); document.DrawLine(110, 320, 350, 320); TryAddSignature(document, letterForDecommissioningDocument, 140, 310); AbsolutePositionText(document, settings.WorkshopName, 61, 200, 500, 100, document.GetLargerFont(false), Element.ALIGN_LEFT); string address1 = $"{settings.Address1}, {settings.Address2}"; AbsolutePositionText(document, address1, 61, 185, 500, 100, document.GetLargerFont(false), Element.ALIGN_LEFT); string address2 = $"{settings.Town}, {settings.PostCode}"; AbsolutePositionText(document, address2, 61, 170, 500, 100, document.GetLargerFont(false), Element.ALIGN_LEFT); }