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); }
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); }
protected override void CreateLargeLabel(PDFDocument document, TachographDocument tachographDocument, int startHorizontal, int startVertical) { AbsolutePositionText(document, Resources.TXT_CERTIFICATION_INSPECTION_SEALING_TACHOGRAPH_M1N1, (startHorizontal + 32), (startVertical + 0), 580, 100, document.GetXLargeFont(false), Element.ALIGN_CENTER); //Outlining DrawLargeLabelRectangle(document, startHorizontal, startVertical); document.DrawLine((startHorizontal + 50), (startVertical + 106), (startHorizontal + 545), (startVertical + 106), TotalPageHeight); document.DrawLine((startHorizontal + 50), (startVertical + 192), (startHorizontal + 545), (startVertical + 192), TotalPageHeight); document.DrawLine((startHorizontal + 50), (startVertical + 247), (startHorizontal + 545), (startVertical + 247), TotalPageHeight); document.DrawLine((startHorizontal + 150), (startVertical + 344), (startHorizontal + 298), (startVertical + 344), TotalPageHeight); document.DrawLine((startHorizontal + 347), (startVertical + 344), (startHorizontal + 494), (startVertical + 344), TotalPageHeight); AbsolutePositionText(document, Resources.TXT_TACHOGRAPH, (startHorizontal + 50), (startVertical + 52), 150, 20); AbsolutePositionText(document, Resources.TXT_VEHICLE, (startHorizontal + 50), (startVertical + 137), 150, 20); AbsolutePositionText(document, Resources.TXT_M1N1_ADAPTER, (startHorizontal + 50), (startVertical + 208), 150, 20); AbsolutePositionText(document, Resources.TXT_TECHNICIAN, (startHorizontal + 50), (startVertical + 270), 150, 20); AbsolutePositionText(document, Resources.TXT_DATE, (startHorizontal + 150), (startVertical + 340), 200, 20); TryAddSignature(document, tachographDocument, (startHorizontal + 330)); AbsolutePositionText(document, string.Format(Resources.TXT_SIGNATURE_TECHNICIAN, tachographDocument.Technician), (startHorizontal + 347), (startVertical + 340), 550, 20); //Tachograph AbsolutePositionText(document, Resources.TXT_MAKE, (startHorizontal + 150), (startVertical + 20), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, Resources.TXT_TYPE, (startHorizontal + 347), (startVertical + 20), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, tachographDocument.TachographMake, (startHorizontal + 150), (startVertical + 32), 550, 72, document.GetLargerFont(false)); AbsolutePositionText(document, tachographDocument.TachographModel, (startHorizontal + 347), (startVertical + 32), 550, 72, document.GetLargerFont(false)); AbsolutePositionText(document, Resources.TXT_ODOMETER_READING, (startHorizontal + 150), (startVertical + 46), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, Resources.TXT_SERIAL_NUMBER, (startHorizontal + 347), (startVertical + 46), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, tachographDocument.OdometerReading, (startHorizontal + 150), (startVertical + 58), 550, 72, document.GetLargerFont(false)); AbsolutePositionText(document, tachographDocument.SerialNumber, (startHorizontal + 347), (startVertical + 58), 550, 72, document.GetLargerFont(false)); AbsolutePositionText(document, Resources.TXT_SET_K_FACTOR, (startHorizontal + 150), (startVertical + 72), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, tachographDocument.KFactor, (startHorizontal + 150), (startVertical + 84), 550, 72, document.GetLargerFont(false)); //Vehicle AbsolutePositionText(document, Resources.TXT_MAKE_AND_MODEL, (startHorizontal + 150), (startVertical + 104), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, Resources.TXT_VRN, (startHorizontal + 347), (startVertical + 104), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, string.Format("{0} {1}", tachographDocument.VehicleMake, tachographDocument.VehicleModel), (startHorizontal + 150), (startVertical + 116), 550, 72, document.GetLargerFont(false)); AbsolutePositionText(document, tachographDocument.RegistrationNumber, (startHorizontal + 347), (startVertical + 116), 550, 72, document.GetLargerFont(false)); AbsolutePositionText(document, Resources.TXT_VIN, (startHorizontal + 150), (startVertical + 130), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, Resources.TXT_TYRE_SIZE, (startHorizontal + 347), (startVertical + 130), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, tachographDocument.VIN, (startHorizontal + 150), (startVertical + 142), 550, 72, document.GetLargerFont(false)); AbsolutePositionText(document, tachographDocument.TyreSize, (startHorizontal + 347), (startVertical + 142), 550, 72, document.GetLargerFont(false)); AbsolutePositionText(document, Resources.TXT_W_FACTOR, (startHorizontal + 150), (startVertical + 156), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, Resources.TXT_TYRE_L_FACTOR, (startHorizontal + 347), (startVertical + 156), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, string.Format(Resources.TXT_IMP_KM, tachographDocument.WFactor), (startHorizontal + 150), (startVertical + 168), 550, 72, document.GetLargerFont(false)); AbsolutePositionText(document, string.Format(Resources.TXT_MM, tachographDocument.LFactor), (startHorizontal + 347), (startVertical + 168), 550, 72, document.GetLargerFont(false)); //M1N1 Adapter AbsolutePositionText(document, Resources.TXT_M1N1_SERIAL_NUMBER, (startHorizontal + 150), (startVertical + 188), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, Resources.TXT_COLOR, (startHorizontal + 347), (startVertical + 188), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, tachographDocument.TachographAdapterSerialNumber, (startHorizontal + 150), (startVertical + 200), 550, 72, document.GetLargerFont(false)); AbsolutePositionText(document, tachographDocument.TachographCableColor, (startHorizontal + 347), (startVertical + 200), 550, 72, document.GetLargerFont(false)); AbsolutePositionText(document, Resources.TXT_LOCATION, (startHorizontal + 150), (startVertical + 214), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, tachographDocument.TachographAdapterLocation, (startHorizontal + 150), (startVertical + 226), 550, 72, document.GetLargerFont(false)); //Technician AbsolutePositionText(document, RegistrationData.CompanyName, (startHorizontal + 150), (startVertical + 246), 550, 72, document.GetLargerFont(false)); AbsolutePositionText(document, WorkshopSettings.Address1, (startHorizontal + 150), (startVertical + 270), 550, 72, document.GetLargerFont(false)); AbsolutePositionText(document, string.Format("{0} {1}", WorkshopSettings.Town, WorkshopSettings.PostCode), (startHorizontal + 150), (startVertical + 284), 550, 72, document.GetLargerFont(false)); AbsolutePositionText(document, string.Format(Resources.TXT_DISTRIBUTOR_SEAL, RegistrationData.SealNumber), (startHorizontal + 347), (startVertical + 246), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, GetCalibrationTime(tachographDocument.CalibrationTime), (startHorizontal + 150), (startVertical + 324), 250, 40, document.GetLargerFont(false)); }
protected override void CreateLargeCertificate(PDFDocument document, TachographDocument tachographDocument, bool excludeLogos) { const int startHorizontal = 0; const int startVertical = 0; document.DrawLine((startHorizontal), (startVertical), (startHorizontal + 545), (startVertical), TotalPageHeight); document.DrawLine((startHorizontal), (startVertical), (startHorizontal), (startVertical + 790), TotalPageHeight); document.DrawLine((startHorizontal + 545), (startVertical), (startHorizontal + 545), (startVertical + 790), TotalPageHeight); document.DrawLine((startHorizontal), (startVertical + 790), (startHorizontal + 545), (startVertical + 790), TotalPageHeight); document.DrawLine((startHorizontal), (startVertical + 290), (startHorizontal + 545), (startVertical + 290), TotalPageHeight); document.DrawLine((startHorizontal), (startVertical + 400), (startHorizontal + 545), (startVertical + 400), TotalPageHeight); document.DrawLine((startHorizontal), (startVertical + 600), (startHorizontal + 545), (startVertical + 600), TotalPageHeight); if (WorkshopSettings.Image != null && !excludeLogos) { const float profileImageMaxHeight = 150; const float profileImageMaxWidth = 200; float widthScale = profileImageMaxWidth / WorkshopSettings.Image.Width; float heightScale = profileImageMaxHeight / WorkshopSettings.Image.Height; float scale = Math.Min(widthScale, heightScale); float newWidth = WorkshopSettings.Image.Width * scale; float newHeight = WorkshopSettings.Image.Height * scale; document.AddImage(WorkshopSettings.RawImage, newWidth, newHeight, (startHorizontal + 5), startVertical + 5); } AbsolutePositionText(document, Resources.TXT_TACHOGRAPH_CALIBRATION_CERTIFICATE, (startHorizontal + 32), (startVertical + 0), 580, 100, document.GetXLargeFont(false), Element.ALIGN_CENTER); AbsolutePositionText(document, Resources.TXT_DATE, (startHorizontal + 355), (startVertical + 200), 200, 40); AbsolutePositionText(document, GetCalibrationTime(tachographDocument.CalibrationTime), (startHorizontal + 400), (startVertical + 200), 200, 40); DateTime?calibrationDate = tachographDocument.CalibrationTime; if (calibrationDate == null) { calibrationDate = DateTime.Today; } string expiryDate = Resources.TXT_EXPIRY + (GetCalibrationTime(calibrationDate.Value.AddYears(2).AddDays(-1))); if (tachographDocument.DocumentType != Resources.TXT_MINOR_WORK_DETAILS) { AbsolutePositionText(document, expiryDate, (startHorizontal + 355), (startVertical + 200), 580, 100); } AbsolutePositionText(document, Resources.TXT_ANALOGUE_INSPECTIONS, (startHorizontal + 320), (startVertical + 5), 200, 40); AbsolutePositionText(document, Resources.TXT_DIGITAL_INSPECTIONS, (startHorizontal + 320), (startVertical + 240), 200, 40); AbsolutePositionText(document, Resources.TXT_MAKE, (startHorizontal + 150), (startVertical + 20), 550, 72, document.GetRegularFont(true)); AbsolutePositionText(document, Resources.TXT_TYPE, (startHorizontal + 347), (startVertical + 20), 550, 72, document.GetRegularFont(true)); AbsolutePositionText(document, Resources.TXT_SERIAL_NUMBER, (startHorizontal + 347), (startVertical + 46), 550, 72, document.GetRegularFont(true)); AbsolutePositionText(document, tachographDocument.TachographMake, (startHorizontal + 150), (startVertical + 32), 550, 72); AbsolutePositionText(document, tachographDocument.TachographModel, (startHorizontal + 347), (startVertical + 32), 550, 72); AbsolutePositionText(document, tachographDocument.SerialNumber, (startHorizontal + 347), (startVertical + 58), 550, 72); AbsolutePositionText(document, Resources.TXT_VEHICLE, (startHorizontal + 5), (startVertical + 104), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, Resources.TXT_VRN, (startHorizontal + 170), (startVertical + 510), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, Resources.TXT_VIN, (startHorizontal + 170), (startVertical + 520), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, Resources.TXT_TYRE_SIZE, (startHorizontal + 170), (startVertical + 530), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, Resources.TXT_W_FACTOR, (startHorizontal + 170), (startVertical + 540), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, Resources.TXT_TYRE_L_FACTOR, (startHorizontal + 170), (startVertical + 550), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, Resources.TXT_ODOMETER_READING, (startHorizontal + 170), (startVertical + 560), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, Resources.TXT_SET_K_FACTOR, (startHorizontal + 170), (startVertical + 72), 570, 72, document.GetRegularFont(false)); AbsolutePositionText(document, $"{tachographDocument.VehicleMake} {tachographDocument.VehicleModel}", (startHorizontal + 170), (startVertical + 500), 550, 72, document.GetLargerFont(false)); AbsolutePositionText(document, tachographDocument.RegistrationNumber, (startHorizontal + 240), (startVertical + 510), 550, 72); AbsolutePositionText(document, tachographDocument.VIN, (startHorizontal + 240), (startVertical + 520), 550, 72); AbsolutePositionText(document, tachographDocument.TyreSize, (startHorizontal + 240), (startVertical + 530), 550, 72); AbsolutePositionText(document, string.Format(Resources.TXT_IMP_KM, tachographDocument.WFactor), (startHorizontal + 240), (startVertical + 540), 550, 72); AbsolutePositionText(document, string.Format(Resources.TXT_MM, tachographDocument.LFactor), (startHorizontal + 240), (startVertical + 550), 550, 72); AbsolutePositionText(document, tachographDocument.OdometerReading, (startHorizontal + 240), (startVertical + 560), 550, 72); AbsolutePositionText(document, tachographDocument.KFactor, (startHorizontal + 240), (startVertical + 570), 550, 72); AbsolutePositionText(document, Resources.TXT_AUTHORISED_TACHOGRAPH_CENTER, (startHorizontal + 30), (startVertical + 650), 550, 72, document.GetLargerFont(false)); AbsolutePositionText(document, RegistrationData.CompanyName, (startHorizontal + 30), (startVertical + 670), 550, 72, document.GetLargerFont(false)); AbsolutePositionText(document, WorkshopSettings.Address1, (startHorizontal + 30), (startVertical + 700), 550, 72, document.GetLargerFont(false)); AbsolutePositionText(document, $"{WorkshopSettings.Town} {WorkshopSettings.PostCode}", (startHorizontal + 30), (startVertical + 730), 550, 72, document.GetLargerFont(false)); AbsolutePositionText(document, string.Format(Resources.TXT_DISTRIBUTOR_SEAL, RegistrationData.SealNumber), (startHorizontal + 30), (startVertical + 760), 550, 72, document.GetRegularFont(false)); AbsolutePositionText(document, Resources.TXT_AUTHORISED_TESTERS_SIGNATURE, (startHorizontal + 350), (startVertical + 246), 550, 72, document.GetLargerFont(false)); TryAddSignature(document, tachographDocument, (startHorizontal + 350)); AbsolutePositionText(document, string.Format(Resources.TXT_SIGNATURE_TECHNICIAN, tachographDocument.Technician), (startHorizontal + 350), (startVertical + 340), 550, 20); Image logoImage = Image.GetInstance(ImageHelper.CopyResourceToFileSystem("skillray_small")); logoImage.SetAbsolutePosition(50, 790); }