diff --git a/client/src/app/core/ui-services/pdf-document.service.ts b/client/src/app/core/ui-services/pdf-document.service.ts index 30251e81f..7faaaa982 100644 --- a/client/src/app/core/ui-services/pdf-document.service.ts +++ b/client/src/app/core/ui-services/pdf-document.service.ts @@ -8,6 +8,19 @@ import { TranslateService } from '@ngx-translate/core'; import { ConfigService } from './config.service'; import { HttpService } from '../core-services/http.service'; +/** + * Custom PDF error class to handle errors in a safer way + */ +export class PdfError extends Error { + public __proto__: PdfError; + + public constructor(public message: string) { + super(message); + const trueProto = new.target.prototype; + this.__proto__ = trueProto; + } +} + /** * Provides the general document structure for PDF documents, such as page margins, header, footer and styles. * Also provides general purpose open and download functions. diff --git a/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.ts b/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.ts index 0086e3b42..31834e366 100644 --- a/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.ts +++ b/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.ts @@ -1315,12 +1315,7 @@ export class MotionDetailComponent extends BaseViewComponent implements OnInit, * Click handler for the pdf button */ public onDownloadPdf(): void { - // TODO: apparently statue amendments never have line numbers and are always in crMode - if (this.motion.isStatuteAmendment()) { - this.pdfExport.exportSingleMotion(this.motion, LineNumberingMode.None, ChangeRecoMode.Diff); - } else { - this.pdfExport.exportSingleMotion(this.motion, this.lnMode, this.crMode); - } + this.pdfExport.exportSingleMotion(this.motion, this.lnMode, this.crMode); } /** diff --git a/client/src/app/site/motions/modules/motion-list/components/motion-list/motion-list.component.ts b/client/src/app/site/motions/modules/motion-list/components/motion-list/motion-list.component.ts index 495600d90..0ce3fed5f 100644 --- a/client/src/app/site/motions/modules/motion-list/components/motion-list/motion-list.component.ts +++ b/client/src/app/site/motions/modules/motion-list/components/motion-list/motion-list.component.ts @@ -30,6 +30,7 @@ import { MotionMultiselectService } from 'app/site/motions/services/motion-multi import { MotionXlsxExportService } from 'app/site/motions/services/motion-xlsx-export.service'; import { LocalPermissionsService } from 'app/site/motions/services/local-permissions.service'; import { StorageService } from 'app/core/core-services/storage.service'; +import { PdfError } from 'app/core/ui-services/pdf-document.service'; /** * Interface to describe possible values and changes for @@ -251,14 +252,22 @@ export class MotionListComponent extends ListViewBaseComponent