本文整理匯總了TypeScript中app/core/ui-services/pdf-document.service.PdfDocumentService.downloadWithBallotPaper方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript service.PdfDocumentService.downloadWithBallotPaper方法的具體用法?TypeScript service.PdfDocumentService.downloadWithBallotPaper怎麽用?TypeScript service.PdfDocumentService.downloadWithBallotPaper使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app/core/ui-services/pdf-document.service.PdfDocumentService
的用法示例。
在下文中一共展示了service.PdfDocumentService.downloadWithBallotPaper方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: printBallots
/**
* Triggers a pdf creation for this poll's ballots.
* There will be 8 ballots per page.
* Each ballot will contain:
* - the event name and logo
* - a first, bold line with a title. Defaults to the label Motion, the identifier,
* and the current number of polls for this motion (if more than one)
* - a subtitle. A second, short (two lines, 90 characters) clarification for
* the ballot. Defaults to the beginning of the motion's title
* - the options 'yes', 'no', 'abstain' translated to the client's language.
*
* @param motionPoll: The poll this ballot refers to
* @param title (optional) a different title
* @param subtitle (optional) a different subtitle
*/
public printBallots(motionPoll: MotionPoll, title?: string, subtitle?: string): void {
const motion = this.motionRepo.getViewModel(motionPoll.motion_id);
const fileName = `${this.translate.instant('Motion')} - ${motion.identifier} - ${this.translate.instant(
'ballot-paper'
)}`;
if (!title) {
title = `${this.translate.instant('Motion')} - ${motion.identifier}`;
if (motion.motion.polls.length > 1) {
title += ` (${this.translate.instant('Vote')} ${motion.motion.polls.length})`;
}
}
if (!subtitle) {
subtitle = motion.title;
}
if (subtitle.length > 90) {
subtitle = subtitle.substring(0, 90) + '...';
}
this.pdfService.downloadWithBallotPaper(this.getContent(title, subtitle), fileName, this.logo);
}