コード例 #1
0
        private void AddAdvertisingSection(PDFDocument document, int startHorizontal, int startVertical)
        {
            if (!AdvertisingSettings.IsEnabled)
            {
                document.AddImage(ImageHelper.LoadFromResourcesAsByteArray("webcal"), 90, 21, (startHorizontal + 5), (startVertical + 30));
                return;
            }

            document.AddImage(AdvertisingSettings.RawImage ?? ImageHelper.LoadFromResourcesAsByteArray("webcal"), 90, 21, startHorizontal + 5, startVertical + 30);

            if (!string.IsNullOrEmpty(AdvertisingSettings.Message))
            {
                AbsolutePositionText(document, AdvertisingSettings.Message, (startHorizontal + 100), (startVertical + 800), 550, 62, document.GetCustomFont(AdvertisingSettings.FontSize, AdvertisingSettings.Font));
            }
        }
コード例 #2
0
        private static void TryAddSignature(PDFDocument document, UndownloadabilityDocument undownloadabilityDocument, int x, int y)
        {
            Image signatureImage = null;

            var userRepository = ContainerBootstrapper.Resolve <IRepository <User> >();
            var user           = UserManagement.GetUser(userRepository, UserManagement.LoggedInUserName);

            if (user != null && user.Image != null)
            {
                signatureImage = user.Image;
            }

            IRepository <Technician> technicianRepository = ContainerBootstrapper.Resolve <IRepository <Technician> >();
            var technicianUser = technicianRepository.FirstOrDefault(c => string.Equals(c.Name, undownloadabilityDocument.Technician));

            if (technicianUser != null && technicianUser.Image != null)
            {
                signatureImage = technicianUser.Image;
            }

            if (signatureImage != null)
            {
                Image image = ImageHelper.Scale(signatureImage, 500, 50);
                document.AddImage(ImageHelper.ToByteArray(image), image.Width, image.Height, x, y);
            }
        }
コード例 #3
0
        private static void AddImageFromResource(PDFDocument document, string resourceName, int x, int y)
        {
            var image  = ImageHelper.LoadFromResources(resourceName);
            var bitmap = image.ToBitmap();
            var scaled = ImageHelper.Scale(bitmap, 0, 35);

            document.AddImage(ImageHelper.ToByteArray(scaled), scaled.Width, scaled.Height, x, y);
        }
コード例 #4
0
        protected override void CreateLargeLabelLogos(PDFDocument document, TachographDocument tachographDocument, int startHorizontal, int startVertical)
        {
            if (WorkshopSettings.Image != null)
            {
                const float profileImageMaxHeight = 145;
                const float profileImageMaxWidth  = 545;

                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 + 20), (startVertical + 675));
            }

            //Skillray
            Image image = ImageHelper.LoadFromResources("webcal_print_logo").ToBitmap();

            document.AddImage(image.ToByteArray(), 180, 41, (startHorizontal + 350), (startVertical + 670));
        }
コード例 #5
0
        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);
        }
コード例 #6
0
        protected override void CreateLargeCertificate(PDFDocument document, TachographDocument tachographDocument, bool excludeLogos)
        {
            const int startHorizontal = 20;
            const int startVertical   = 0;

            document.DrawLine((startHorizontal), (startVertical), (startHorizontal + 555), (startVertical), TotalPageHeight);

            document.DrawLine((startHorizontal), (startVertical), (startHorizontal), (startVertical + 800), TotalPageHeight);

            document.DrawLine((startHorizontal + 555), (startVertical), (startHorizontal + 555), (startVertical + 800), TotalPageHeight);

            document.DrawLine((startHorizontal), (startVertical + 800), (startHorizontal + 555), (startVertical + 800), TotalPageHeight);

            document.DrawLine((startHorizontal), (startVertical + 290), (startHorizontal + 555), (startVertical + 290), TotalPageHeight);

            if (tachographDocument.MinorWorkDetails == null)
            {
                document.DrawLine((startHorizontal), (startVertical + 400), (startHorizontal + 555), (startVertical + 400), TotalPageHeight);
                document.DrawLine((startHorizontal), (startVertical + 600), (startHorizontal + 555), (startVertical + 600), TotalPageHeight);
            }
            else
            {
                document.DrawLine((startHorizontal), (startVertical + 420), (startHorizontal + 555), (startVertical + 420), TotalPageHeight);
                document.DrawLine((startHorizontal), (startVertical + 630), (startHorizontal + 555), (startVertical + 630), TotalPageHeight);
            }

            if (WorkshopSettings.Image != null && !excludeLogos)
            {
                var image = ImageHelper.Scale(WorkshopSettings.RawImage.ToImage(), 545, 150);
                document.AddImage(image, image.Width, image.Height, startHorizontal + 5, startVertical + 660);
            }

            AbsolutePositionText(document, Resources.TXT_TACHOGRAPH_CALIBRATION_CERTIFICATE.ToUpper(), startHorizontal + 200, startVertical + 170, 580, 100, document.GetRegularFont(true));
            document.DrawLine(startHorizontal + 200, startVertical + 188, startHorizontal + 367, startVertical + 188, TotalPageHeight);

            if (CustomerContact != null)
            {
                AbsolutePositionText(document, Resources.TXT_CUSTOMER_DETAILS.ToUpper(), startHorizontal + 5, startVertical + 200, 200, 40, document.GetRegularFont(true));
                if (CustomerContact.Name != null)
                {
                    AbsolutePositionText(document, CustomerContact.Name.ToUpper(), startHorizontal + 5, startVertical + 220, 200, 40, document.GetRegularFont(false));
                }
                if (CustomerContact.Address != null)
                {
                    AbsolutePositionText(document, CustomerContact.Address.ToUpper(), startHorizontal + 5, startVertical + 230, 200, 40, document.GetRegularFont(false));
                }
                if (CustomerContact.Town != null)
                {
                    AbsolutePositionText(document, CustomerContact.Town.ToUpper(), startHorizontal + 5, startVertical + 240, 200, 40, document.GetRegularFont(false));
                }
                if (CustomerContact.PostCode != null)
                {
                    AbsolutePositionText(document, CustomerContact.PostCode.ToUpper(), startHorizontal + 5, startVertical + 250, 200, 40, document.GetRegularFont(false));
                }
            }

            if (!string.IsNullOrEmpty(tachographDocument.InvoiceNumber))
            {
                AbsolutePositionText(document, Resources.TXT_INVOICE_NUMBER.ToUpper(), startHorizontal + 287, startVertical + 240, 400, 40, document.GetRegularFont(true));
                AbsolutePositionText(document, tachographDocument.InvoiceNumber, startHorizontal + 540, startVertical + 240, 390, 40, document.GetRegularFont(false));
            }
            if (!string.IsNullOrEmpty(tachographDocument.VehicleType))
            {
                AbsolutePositionText(document, Resources.TXT_VEHICLE_TYPE.ToUpper(), startHorizontal + 299, startVertical + 250, 400, 40, document.GetRegularFont(true));
                AbsolutePositionText(document, tachographDocument.VehicleType, startHorizontal + 490, startVertical + 250, 390, 40, document.GetRegularFont(false));
            }

            DateTime?calibrationDate = tachographDocument.CalibrationTime ?? DateTime.Today;
            string   expiryDate      = GetCalibrationTime(calibrationDate.Value.AddYears(2).AddDays(-1));

            AbsolutePositionText(document, Resources.TXT_DATE.ToUpper(), startHorizontal + 370, (startVertical + 210), 355, 40, document.GetRegularFont(true));

            AbsolutePositionText(document, GetCalibrationTime(tachographDocument.CalibrationTime).ToUpper(), (startHorizontal + 450), (startVertical + 210), 390, 40, document.GetRegularFont(false));

            if (tachographDocument.DocumentType != Resources.TXT_MINOR_WORK_DETAILS && tachographDocument.IsDigital)
            {
                AbsolutePositionText(document, Resources.TXT_EXP.ToUpper(), startHorizontal + 260, (startVertical + 220), 400, 40, document.GetRegularFont(true));
                AbsolutePositionText(document, expiryDate.ToUpper(), (startHorizontal + 450), (startVertical + 220), 390, 40, document.GetRegularFont(false));
            }

            AbsolutePositionText(document, Resources.TXT_ANALOGUE_INSPECTIONS.ToUpper(), (startHorizontal + 5), (startVertical + 300), 590, 40, document.GetRegularFont(true));

            AbsolutePositionText(document, Resources.TXT_CALIBRATION.ToUpper(), (startHorizontal + 15), (startVertical + 310), 590, 40, document.GetRegularFont(false));
            document.DrawCheckBox((startHorizontal + 5), (startVertical + 320), TotalPageHeight);
            if (tachographDocument.DocumentType == Resources.TXT_LARGE_INSTALLATION)
            {
                document.DrawCheck((startHorizontal + 5), (startVertical + 320), TotalPageHeight);
            }

            AbsolutePositionText(document, Resources.TXT_2_YEAR.ToUpper(), (startHorizontal + 15), (startVertical + 320), 590, 40, document.GetRegularFont(false));
            document.DrawCheckBox((startHorizontal + 5), (startVertical + 330), TotalPageHeight);
            if (tachographDocument.DocumentType == Resources.TXT_LARGE_TWO_YEAR_INSPECTION)
            {
                document.DrawCheck((startHorizontal + 5), (startVertical + 330), TotalPageHeight);
            }

            AbsolutePositionText(document, Resources.TXT_6_YEAR.ToUpper(), (startHorizontal + 15), (startVertical + 330), 590, 40, document.GetRegularFont(false));
            document.DrawCheckBox((startHorizontal + 5), (startVertical + 340), TotalPageHeight);
            if (tachographDocument.DocumentType == Resources.TXT_LARGE_SIX_YEAR_CALIBRATION)
            {
                document.DrawCheck((startHorizontal + 5), (startVertical + 340), TotalPageHeight);
            }

            AbsolutePositionText(document, Resources.TXT_RECALIBRATION_CERTIFICATE.ToUpper(), (startHorizontal + 15), (startVertical + 340), 590, 40, document.GetRegularFont(false));
            document.DrawCheckBox((startHorizontal + 5), (startVertical + 350), TotalPageHeight);
            if (tachographDocument.DocumentType == Resources.TXT_LARGE_RECALIBRATION)
            {
                document.DrawCheck((startHorizontal + 5), (startVertical + 350), TotalPageHeight);
            }

            AbsolutePositionText(document, Resources.TXT_MINOR_WORK.ToUpper(), (startHorizontal + 15),
                                 (startVertical + 350), 590, 40, document.GetRegularFont(false));
            document.DrawCheckBox((startHorizontal + 5), (startVertical + 360), TotalPageHeight);
            if (tachographDocument.DocumentType == Resources.TXT_LARGE_MINOR_WORK && !tachographDocument.IsDigital)
            {
                document.DrawCheck((startHorizontal + 5), (startVertical + 360), TotalPageHeight);
            }

            AbsolutePositionText(document, Resources.TXT_DIGITAL_INSPECTIONS.ToUpper(), (startHorizontal + 240), (startVertical + 300), 590, 40, document.GetRegularFont(true));

            AbsolutePositionText(document, Resources.TXT_CALIBRATION.ToUpper(), (startHorizontal + 255), (startVertical + 310), 590, 40, document.GetRegularFont(false));
            document.DrawCheckBox((startHorizontal + 240), (startVertical + 320), TotalPageHeight);
            if (tachographDocument.DocumentType == Resources.TXT_LARGE_DIGITAL_INITIAL)
            {
                document.DrawCheck((startHorizontal + 240), (startVertical + 320), TotalPageHeight);
            }

            AbsolutePositionText(document, Resources.TXT_2_YEAR.ToUpper(), (startHorizontal + 255),
                                 (startVertical + 320), 590, 40, document.GetRegularFont(false));
            document.DrawCheckBox((startHorizontal + 240), (startVertical + 330), TotalPageHeight);
            if (tachographDocument.DocumentType == Resources.TXT_LARGE_DIGITAL_TWO_YEAR)
            {
                document.DrawCheck((startHorizontal + 240), (startVertical + 330), TotalPageHeight);
            }

            AbsolutePositionText(document, Resources.TXT_MINOR_WORK.ToUpper(), (startHorizontal + 255), (startVertical + 330), 590, 40, document.GetRegularFont(false));
            document.DrawCheckBox((startHorizontal + 240), (startVertical + 340), TotalPageHeight);
            if (tachographDocument.DocumentType == Resources.TXT_LARGE_MINOR_WORK && tachographDocument.IsDigital)
            {
                document.DrawCheck((startHorizontal + 240), (startVertical + 340), TotalPageHeight);
            }

            AbsolutePositionText(document, Resources.TXT_NEW_BATTERY.ToUpper(), (startHorizontal + 255), (startVertical + 350), 590, 40, document.GetRegularFont(false));
            document.DrawCheckBox((startHorizontal + 240), (startVertical + 360), TotalPageHeight);
            if (tachographDocument.NewBattery)
            {
                document.DrawCheck((startHorizontal + 240), (startVertical + 360), TotalPageHeight);
            }

            if (tachographDocument.MinorWorkDetails != null)
            {
                AbsolutePositionText(document, Resources.TXT_MINOR_WORK_DETAILS_DETAILS.ToUpper(), (startHorizontal + 5), (startVertical + 370), 550, 72, document.GetRegularFont(true));
                AbsolutePositionText(document, tachographDocument.MinorWorkDetails.ToUpper(), (startHorizontal + 5), (startVertical + 380), 550, 72);
            }

            if (tachographDocument.MinorWorkDetails == null)
            {
                AbsolutePositionText(document, Resources.TXT_TACHOGRAPH.ToUpper(), (startHorizontal + 5), (startVertical + 410), 550, 72, document.GetRegularFont(true));
                AbsolutePositionText(document, Resources.TXT_MAKE.ToUpper(), (startHorizontal + 140), (startVertical + 430), 550, 72, document.GetRegularFont(true));
                AbsolutePositionText(document, Resources.TXT_TYPE.ToUpper(), (startHorizontal + 140), (startVertical + 440), 550, 72, document.GetRegularFont(true));
                AbsolutePositionText(document, Resources.TXT_SERIAL_NUMBER.ToUpper(), (startHorizontal + 140), (startVertical + 450), 550, 72, document.GetRegularFont(true));

                if (!string.IsNullOrEmpty(tachographDocument.TachographMake))
                {
                    AbsolutePositionText(document, tachographDocument.TachographMake.ToUpper(), (startHorizontal + 300), (startVertical + 430), 550, 72);
                }
                if (!string.IsNullOrEmpty(tachographDocument.TachographModel))
                {
                    AbsolutePositionText(document, tachographDocument.TachographModel.ToUpper(), (startHorizontal + 300), (startVertical + 440), 550, 72);
                }
                if (!string.IsNullOrEmpty(tachographDocument.SerialNumber))
                {
                    AbsolutePositionText(document, tachographDocument.SerialNumber.ToUpper(), (startHorizontal + 300), (startVertical + 450), 550, 72);
                }

                AbsolutePositionText(document, Resources.TXT_VEHICLE.ToUpper(), (startHorizontal + 5), (startVertical + 470), 550, 72, document.GetRegularFont(true));

                AbsolutePositionText(document, Resources.TXT_VRN.ToUpper(), (startHorizontal + 140), (startVertical + 490), 550, 72, document.GetRegularFont(true));
                AbsolutePositionText(document, Resources.TXT_VIN.ToUpper(), (startHorizontal + 140), (startVertical + 500), 550, 72, document.GetRegularFont(true));
                AbsolutePositionText(document, Resources.TXT_TYRE_SIZE.ToUpper(), (startHorizontal + 140), (startVertical + 510), 550, 72, document.GetRegularFont(true));
                AbsolutePositionText(document, Resources.TXT_W_FACTOR.ToUpper(), (startHorizontal + 140), (startVertical + 520), 550, 72, document.GetRegularFont(true));
                AbsolutePositionText(document, Resources.TXT_TYRE_L_FACTOR.ToUpper(), (startHorizontal + 140), (startVertical + 530), 550, 72, document.GetRegularFont(true));
                AbsolutePositionText(document, Resources.TXT_ODOMETER_READING.ToUpper(), (startHorizontal + 140), (startVertical + 540), 550, 72, document.GetRegularFont(true));
                AbsolutePositionText(document, Resources.TXT_SET_K_FACTOR.ToUpper(), (startHorizontal + 140), (startVertical + 550), 550, 72, document.GetRegularFont(true));

                AbsolutePositionText(document, $"{tachographDocument.VehicleMake} {tachographDocument.VehicleModel}".ToUpper(), (startHorizontal + 140), (startVertical + 480), 550, 72, document.GetRegularFont(true));

                AbsolutePositionText(document, tachographDocument.RegistrationNumber.ToUpper(), (startHorizontal + 300), (startVertical + 490), 550, 72);
                AbsolutePositionText(document, tachographDocument.VIN.ToUpper(), (startHorizontal + 300), (startVertical + 500), 550, 72);
                AbsolutePositionText(document, tachographDocument.TyreSize.ToUpper(), (startHorizontal + 300), (startVertical + 510), 550, 72);
                AbsolutePositionText(document, string.Format(Resources.TXT_IMP_KM, tachographDocument.WFactor).ToUpper(), (startHorizontal + 300), (startVertical + 520), 550, 72);
                AbsolutePositionText(document, string.Format(Resources.TXT_MM, tachographDocument.LFactor).ToUpper(), (startHorizontal + 300), (startVertical + 530), 550, 72);
                AbsolutePositionText(document, tachographDocument.OdometerReading.ToUpper(), (startHorizontal + 300), (startVertical + 540), 550, 72);
                AbsolutePositionText(document, string.Format(Resources.TXT_IMP_KM, tachographDocument.KFactor).ToUpper(), (startHorizontal + 300), (startVertical + 550), 550, 72);

                if (tachographDocument.MinorWorkDetails != null)
                {
                    AbsolutePositionText(document, Resources.TXT_MINOR_WORK_DETAILS_DETAILS.ToUpper(), (startHorizontal + 140), (startVertical + 570), 550, 72, document.GetRegularFont(true));
                    AbsolutePositionText(document, tachographDocument.MinorWorkDetails.ToUpper(), (startHorizontal + 140), (startVertical + 580), 550, 72);
                }

                AbsolutePositionText(document, Resources.TXT_AUTHORISED_TACHOGRAPH_CENTER, (startHorizontal + 30), (startVertical + 620), 550, 72, document.GetRegularFont(true));

                AbsolutePositionText(document, RegistrationData.CompanyName, (startHorizontal + 30), (startVertical + 650), 550, 72, document.GetRegularFont(false));

                AbsolutePositionText(document, WorkshopSettings.Address1, (startHorizontal + 30), (startVertical + 670), 550, 72, document.GetRegularFont(false));

                AbsolutePositionText(document, WorkshopSettings.Town, (startHorizontal + 30), (startVertical + 690), 550, 72, document.GetRegularFont(false));

                AbsolutePositionText(document, WorkshopSettings.PostCode, (startHorizontal + 30), (startVertical + 710), 550, 72, document.GetRegularFont(false));

                AbsolutePositionText(document, Resources.TXT_AUTHORISED_TESTERS_SIGNATURE, (startHorizontal + 300), (startVertical + 620), 700, 72, document.GetRegularFont(true));
                AbsolutePositionText(document, string.Format(Resources.TXT_SIGNATURE_TECHNICIAN, tachographDocument.Technician), (startHorizontal + 300), (startVertical + 650), 550, 20);

                TryAddSignature(document, tachographDocument, (startHorizontal + 300));

                document.DrawLine((startHorizontal + 300), (startVertical + 715), (startHorizontal + 490), (startVertical + 715), TotalPageHeight);
                AbsolutePositionText(document, string.Format(Resources.TXT_DISTRIBUTOR_SEAL, RegistrationData.SealNumber), (startHorizontal + 300), (startVertical + 710), 550, 72, document.GetXSmallFont(false));

                AddAdvertisingSection(document, startHorizontal, startVertical);
            }
            else
            {
                AbsolutePositionText(document, Resources.TXT_TACHOGRAPH.ToUpper(), (startHorizontal + 5), (startVertical + 430), 550, 72, document.GetRegularFont(true));
                AbsolutePositionText(document, Resources.TXT_MAKE.ToUpper(), (startHorizontal + 140), (startVertical + 450), 550, 72, document.GetRegularFont(true));
                AbsolutePositionText(document, Resources.TXT_TYPE.ToUpper(), (startHorizontal + 140), (startVertical + 460), 550, 72, document.GetRegularFont(true));
                AbsolutePositionText(document, Resources.TXT_SERIAL_NUMBER.ToUpper(), (startHorizontal + 140), (startVertical + 470), 550, 72, document.GetRegularFont(true));

                AbsolutePositionText(document, tachographDocument.TachographMake.ToUpper(), (startHorizontal + 300), (startVertical + 450), 550, 72);
                AbsolutePositionText(document, tachographDocument.TachographModel.ToUpper(), (startHorizontal + 300), (startVertical + 460), 550, 72);
                AbsolutePositionText(document, tachographDocument.SerialNumber.ToUpper(), (startHorizontal + 300), (startVertical + 470), 550, 72);

                AbsolutePositionText(document, Resources.TXT_VEHICLE.ToUpper(), (startHorizontal + 5), (startVertical + 490), 550, 72, document.GetRegularFont(true));

                AbsolutePositionText(document, Resources.TXT_VRN.ToUpper(), (startHorizontal + 140), (startVertical + 510), 550, 72, document.GetRegularFont(true));
                AbsolutePositionText(document, Resources.TXT_VIN.ToUpper(), (startHorizontal + 140), (startVertical + 520), 550, 72, document.GetRegularFont(true));
                AbsolutePositionText(document, Resources.TXT_TYRE_SIZE.ToUpper(), (startHorizontal + 140), (startVertical + 530), 550, 72, document.GetRegularFont(true));
                AbsolutePositionText(document, Resources.TXT_W_FACTOR.ToUpper(), (startHorizontal + 140), (startVertical + 540), 550, 72, document.GetRegularFont(true));
                AbsolutePositionText(document, Resources.TXT_TYRE_L_FACTOR.ToUpper(), (startHorizontal + 140), (startVertical + 550), 550, 72, document.GetRegularFont(true));
                AbsolutePositionText(document, Resources.TXT_ODOMETER_READING.ToUpper(), (startHorizontal + 140), (startVertical + 560), 550, 72, document.GetRegularFont(true));
                AbsolutePositionText(document, Resources.TXT_SET_K_FACTOR.ToUpper(), (startHorizontal + 140), (startVertical + 570), 550, 72, document.GetRegularFont(true));

                AbsolutePositionText(document, string.Format("{0} {1}", tachographDocument.VehicleMake, tachographDocument.VehicleModel).ToUpper(), (startHorizontal + 140), (startVertical + 500), 550, 72, document.GetRegularFont(true));

                AbsolutePositionText(document, tachographDocument.RegistrationNumber.ToUpper(), (startHorizontal + 300), (startVertical + 510), 550, 72);
                AbsolutePositionText(document, tachographDocument.VIN.ToUpper(), (startHorizontal + 300), (startVertical + 520), 550, 72);
                AbsolutePositionText(document, tachographDocument.TyreSize.ToUpper(), (startHorizontal + 300), (startVertical + 530), 550, 72);
                AbsolutePositionText(document, string.Format(Resources.TXT_IMP_KM, tachographDocument.WFactor).ToUpper(), (startHorizontal + 300), (startVertical + 540), 550, 72);
                AbsolutePositionText(document, string.Format(Resources.TXT_MM, tachographDocument.LFactor).ToUpper(), (startHorizontal + 300), (startVertical + 550), 550, 72);
                AbsolutePositionText(document, tachographDocument.OdometerReading.ToUpper(), (startHorizontal + 300), (startVertical + 560), 550, 72);
                AbsolutePositionText(document, string.Format(Resources.TXT_IMP_KM, tachographDocument.KFactor).ToUpper(), (startHorizontal + 300), (startVertical + 570), 550, 72);

                AbsolutePositionText(document, Resources.TXT_AUTHORISED_TACHOGRAPH_CENTER, (startHorizontal + 30), (startVertical + 640), 550, 72, document.GetRegularFont(true));
                if (RegistrationData.CompanyName != null)
                {
                    AbsolutePositionText(document, RegistrationData.CompanyName, (startHorizontal + 30), (startVertical + 670), 550, 72, document.GetRegularFont(false));
                }
                if (WorkshopSettings.Address1 != null)
                {
                    AbsolutePositionText(document, WorkshopSettings.Address1, (startHorizontal + 30), (startVertical + 690), 550, 72, document.GetRegularFont(false));
                }
                if (WorkshopSettings.Town != null)
                {
                    AbsolutePositionText(document, WorkshopSettings.Town, (startHorizontal + 30), (startVertical + 710), 550, 72, document.GetRegularFont(false));
                }

                if (WorkshopSettings.PostCode != null)
                {
                    AbsolutePositionText(document, WorkshopSettings.PostCode, (startHorizontal + 30), (startVertical + 730), 550, 72, document.GetRegularFont(false));
                }

                AbsolutePositionText(document, Resources.TXT_AUTHORISED_TESTERS_SIGNATURE, (startHorizontal + 300), (startVertical + 640), 700, 72, document.GetRegularFont(true));
                AbsolutePositionText(document, string.Format(Resources.TXT_SIGNATURE_TECHNICIAN, tachographDocument.Technician), (startHorizontal + 300), (startVertical + 670), 550, 20);

                TryAddSignature(document, tachographDocument, (startHorizontal + 300));

                document.DrawLine((startHorizontal + 300), (startVertical + 735), (startHorizontal + 490), (startVertical + 735), TotalPageHeight);
                AbsolutePositionText(document, string.Format(Resources.TXT_DISTRIBUTOR_SEAL, RegistrationData.SealNumber), (startHorizontal + 300), (startVertical + 730), 550, 72, document.GetXSmallFont(false));

                AddAdvertisingSection(document, startHorizontal, startVertical);
            }
        }
コード例 #7
0
ファイル: FullCertificate.cs プロジェクト: jpreecedev/WebCal
        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);
        }