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 void GetCompanyDetails(PDFDocument document, PdfPTable table, int height, int colspan, Font font) { string companyName = Resources.TXT_SKILLRAY; string address = Resources.TXT_UNLICENSED; string town = Resources.TXT_DEMO; string postCode = Resources.TXT_SOFTWARE; if (RegistrationData.HasValidLicense) { companyName = WorkshopSettings.WorkshopName; address = WorkshopSettings.Address1; town = WorkshopSettings.Town; postCode = WorkshopSettings.PostCode; } document.AddSpannedCell(table, $"{companyName}\n{address} {town} {postCode}", colspan, font, height, Element.ALIGN_LEFT); //69 }
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); }
protected void GetSmallImage(PDFDocument document, PdfPTable table) { ImageHelper.SaveImageToDisk(GetWorkshopImage(), Path.Combine(ImageHelper.GetTemporaryDirectory(), "logo.png")); iTextSharp.text.Image itextSharpImage = document.GetImage(Path.Combine(ImageHelper.GetTemporaryDirectory(), "logo.png"), 205, 53); document.AddSpannedCell(table, itextSharpImage, 4, document.GetRegularFont(false), 40); }