diff --git a/apps/red-ui/src/app/modules/admin/screens/watermark/watermark-screen/watermark-screen.component.ts b/apps/red-ui/src/app/modules/admin/screens/watermark/watermark-screen/watermark-screen.component.ts index f3c297204..26ab564a2 100644 --- a/apps/red-ui/src/app/modules/admin/screens/watermark/watermark-screen/watermark-screen.component.ts +++ b/apps/red-ui/src/app/modules/admin/screens/watermark/watermark-screen/watermark-screen.component.ts @@ -6,6 +6,7 @@ import { AsControl, BASE_HREF_FN, Debounce, + getConfig, getCurrentUser, getParam, IconButtonTypes, @@ -16,6 +17,7 @@ import { trackByFactory, } from '@iqser/common-ui'; import { + AppConfig, DOSSIER_TEMPLATE_ID, type IWatermark, type User, @@ -92,6 +94,7 @@ export class WatermarkScreenComponent implements OnInit { readonly #loaded$ = new BehaviorSubject(false); readonly #dossierTemplateId = getParam(DOSSIER_TEMPLATE_ID); readonly #watermarkId = Number(getParam(WATERMARK_ID)); + readonly #config = getConfig(); #watermark: Partial = {}; constructor( @@ -257,11 +260,12 @@ export class WatermarkScreenComponent implements OnInit { } async #loadDocument() { - const request = this._http.get('/assets/pdftron/blank.pdf', { + const filename = `blank-${this.#config.WATERMARK_PREVIEW_PAPER_FORMAT}.pdf`; + const request = this._http.get(`/assets/pdftron/${filename}`, { responseType: 'blob', }); const blobData = await firstValueFrom(request); - this.instance.UI.loadDocument(blobData, { filename: 'blank.pdf' }); + this.instance.UI.loadDocument(blobData, { filename }); } #disableElements() { diff --git a/apps/red-ui/src/assets/config/config.json b/apps/red-ui/src/assets/config/config.json index 59c62b3be..378c6448c 100644 --- a/apps/red-ui/src/assets/config/config.json +++ b/apps/red-ui/src/assets/config/config.json @@ -20,5 +20,6 @@ "BASE_TRANSLATIONS_DIRECTORY": "/assets/i18n/redact/", "AVAILABLE_NOTIFICATIONS_DAYS": 30, "AVAILABLE_OLD_NOTIFICATIONS_MINUTES": 60, - "NOTIFICATIONS_THRESHOLD": 1000 + "NOTIFICATIONS_THRESHOLD": 1000, + "WATERMARK_PREVIEW_PAPER_FORMAT": "a4" } diff --git a/apps/red-ui/src/assets/pdftron/blank.pdf b/apps/red-ui/src/assets/pdftron/blank-a4.pdf similarity index 100% rename from apps/red-ui/src/assets/pdftron/blank.pdf rename to apps/red-ui/src/assets/pdftron/blank-a4.pdf diff --git a/apps/red-ui/src/assets/pdftron/blank-letter.pdf b/apps/red-ui/src/assets/pdftron/blank-letter.pdf new file mode 100644 index 000000000..6d678053c --- /dev/null +++ b/apps/red-ui/src/assets/pdftron/blank-letter.pdf @@ -0,0 +1,70 @@ +%PDF-1.4 +% +1 0 obj +<> +endobj +3 0 obj +<> +endobj +4 0 obj +<> stream +x10EwN\Ԇ@dN J3RKvt+}>bɵ03qz +aՀ( >5{tXt5Apy[)ƠVatINHԉ#Xڝo6ևo_~e'74 +endstream +endobj +6 0 obj +<> stream +xN0 jG : RK8ʆ >[;@YKRXɴlNd>^uo ;Yg8N Sv]FOY7: +endstream +endobj +2 0 obj +<>>> +/MediaBox [0 0 612 792] +/Contents 4 0 R +/StructParents 0 +/Parent 7 0 R>> +endobj +5 0 obj +<>>> +/MediaBox [0 0 792 612] +/Contents 6 0 R +/StructParents 1 +/Parent 7 0 R>> +endobj +7 0 obj +<> +endobj +8 0 obj +<> +endobj +xref +0 9 +0000000000 65535 f +0000000015 00000 n +0000000719 00000 n +0000000268 00000 n +0000000305 00000 n +0000000907 00000 n +0000000514 00000 n +0000001095 00000 n +0000001156 00000 n +trailer +<> +startxref +1203 +%%EOF diff --git a/docker/red-ui/docker-entrypoint.sh b/docker/red-ui/docker-entrypoint.sh index 1f49ec007..bef8197a7 100755 --- a/docker/red-ui/docker-entrypoint.sh +++ b/docker/red-ui/docker-entrypoint.sh @@ -23,6 +23,7 @@ AVAILABLE_OLD_NOTIFICATIONS_MINUTES="${AVAILABLE_OLD_NOTIFICATIONS_MINUTES:-60}" NOTIFICATIONS_THRESHOLD="${NOTIFICATIONS_THRESHOLD:-1000}" BASE_TRANSLATIONS_DIRECTORY="${BASE_TRANSLATIONS_DIRECTORY:-/assets/i18n/redact/}" THEME="${THEME:-theme-template}" +WATERMARK_PREVIEW_PAPER_FORMAT="${WATERMARK_PREVIEW_PAPER_FORMAT:a4}" @@ -48,7 +49,8 @@ echo '{ "ANNOTATIONS_THRESHOLD":"'"$ANNOTATIONS_THRESHOLD"'", "AVAILABLE_NOTIFICATIONS_DAYS":"'"$AVAILABLE_NOTIFICATIONS_DAYS"'", "AVAILABLE_OLD_NOTIFICATIONS_MINUTES":"'"$AVAILABLE_OLD_NOTIFICATIONS_MINUTES"'", - "NOTIFICATIONS_THRESHOLD":"'"$NOTIFICATIONS_THRESHOLD"'" + "NOTIFICATIONS_THRESHOLD":"'"$NOTIFICATIONS_THRESHOLD"'", + "WATERMARK_PREVIEW_PAPER_FORMAT":"'"$WATERMARK_PREVIEW_PAPER_FORMAT"'", }' > /usr/share/nginx/html/ui/assets/config/config.json echo 'Env variables: ' diff --git a/libs/red-domain/src/lib/shared/app-config.ts b/libs/red-domain/src/lib/shared/app-config.ts index 050a999a0..5b1728a55 100644 --- a/libs/red-domain/src/lib/shared/app-config.ts +++ b/libs/red-domain/src/lib/shared/app-config.ts @@ -15,4 +15,5 @@ export interface AppConfig extends IqserAppConfig { readonly AVAILABLE_NOTIFICATIONS_DAYS: number; readonly AVAILABLE_OLD_NOTIFICATIONS_MINUTES: number; readonly NOTIFICATIONS_THRESHOLD: number; + readonly WATERMARK_PREVIEW_PAPER_FORMAT: 'a4' | 'letter'; }