public static void PrintRank(ref Document doc, vwCertificate certificate) { Page pg = doc.Pages[1]; TextFrame studentFrame = pg.Shapes[2].TextFrame; TextFrame schoolFrame = pg.Shapes[4].TextFrame; TextFrame stDateFrame = pg.Shapes[5].TextFrame; TextFrame rankFrame = pg.Shapes[3].TextFrame; TextFrame authFrame = pg.Shapes[6].TextFrame; studentFrame.TextRange.Text = certificate.FullName; studentFrame.AutoFitText = PbTextAutoFitType.pbTextAutoFitGrowToFit; studentFrame.AutoFitText = PbTextAutoFitType.pbTextAutoFitShrinkOnOverflow; schoolFrame.TextRange.Text = certificate.Dojo; schoolFrame.AutoFitText = PbTextAutoFitType.pbTextAutoFitGrowToFit; schoolFrame.AutoFitText = PbTextAutoFitType.pbTextAutoFitShrinkOnOverflow; stDateFrame.TextRange.Text = Convert.ToDateTime(certificate.FromDate).ToString(DateFormat); stDateFrame.AutoFitText = PbTextAutoFitType.pbTextAutoFitGrowToFit; stDateFrame.AutoFitText = PbTextAutoFitType.pbTextAutoFitShrinkOnOverflow; rankFrame.TextRange.Text = certificate.RankText; rankFrame.AutoFitText = PbTextAutoFitType.pbTextAutoFitGrowToFit; rankFrame.AutoFitText = PbTextAutoFitType.pbTextAutoFitShrinkOnOverflow; authFrame.TextRange.Text = $"{AuthenticityString}{certificate.ID}"; doc.PrintOutEx(); }
public static void PrintTenshiRank(ref Document doc, vwCertificate certificate) { NumberToEnglish num = new NumberToEnglish(); Page pg = doc.Pages[1]; TextFrame studentFrame = pg.Shapes[2].TextFrame; TextFrame stDateFrame = pg.Shapes[3].TextFrame; TextFrame rankFrame = pg.Shapes[4].TextFrame; TextFrame authFrame = pg.Shapes[5].TextFrame; studentFrame.TextRange.Text = certificate.FullName; studentFrame.AutoFitText = PbTextAutoFitType.pbTextAutoFitGrowToFit; studentFrame.AutoFitText = PbTextAutoFitType.pbTextAutoFitShrinkOnOverflow; stDateFrame.TextRange.Text = String.Format("{0:MMMM} {1}{2}", Convert.ToDateTime(certificate.FromDate), num.changeNumericToWords(Convert.ToDateTime(certificate.FromDate).Day), Convert.ToDateTime(certificate.FromDate).Year); stDateFrame.AutoFitText = PbTextAutoFitType.pbTextAutoFitGrowToFit; stDateFrame.AutoFitText = PbTextAutoFitType.pbTextAutoFitShrinkOnOverflow; rankFrame.TextRange.Text = certificate.RankText; rankFrame.AutoFitText = PbTextAutoFitType.pbTextAutoFitGrowToFit; rankFrame.AutoFitText = PbTextAutoFitType.pbTextAutoFitShrinkOnOverflow; authFrame.TextRange.Text = $"{AuthenticityString}{certificate.ID}"; doc.PrintOutEx(); }
private static async Task PrintOutCertificateAsync(_Application app, vwCertificate certificate) { if (isDebugging) { MessageBox.Show("In Printout Certificates", "debugging", MessageBoxButtons.OK); Debugger.Break(); } string fileName = DocumentDictionary.CertDictionary[certificate.CertType]; Document doc = app.Open(TemplateDirectory + fileName, true, true, PbSaveOptions.pbDoNotSaveChanges); if (certificate.CertType == CertTypes.ChiefInstructor) { certificate.InstructorType = InstructorTypes.ChiefInstructor; } if (certificate.CertType == CertTypes.Instructor) { certificate.InstructorType = InstructorTypes.Instructor; } if (certificate.CertType == CertTypes.Membership) { PrintOut.PrintMember(ref doc, certificate); } if (certificate.CertType == CertTypes.ChiefInstructor) { PrintOut.PrintInstructor(ref doc, certificate); } if (certificate.CertType == CertTypes.Instructor) { PrintOut.PrintInstructor(ref doc, certificate); } if (certificate.CertType == CertTypes.Rank) { PrintOut.PrintRank(ref doc, certificate); } if (certificate.CertType == CertTypes.SchoolCharter) { PrintOut.PrintSchool(ref doc, certificate); } if (certificate.CertType == CertTypes.TenshiInstructor) { PrintOut.PrintTenshiInstructor(ref doc, certificate); } if (certificate.CertType == CertTypes.TenshiMembership) { PrintOut.PrintTenshiMember(ref doc, certificate); } if (certificate.CertType == CertTypes.TenshiRank) { PrintOut.PrintTenshiRank(ref doc, certificate); } if (certificate.CertType == CertTypes.TenshiSchoolCharter) { PrintOut.PrintTenshiSchool(ref doc, certificate); } await CertRepository.SaveCompleteAsync(certificate.ID, certificate.BatchID); doc.Close(); Thread.Sleep(new TimeSpan(0, 0, 5)); }