@@ -6,8 +6,6 @@ import { PDFDocument } from "pdf-lib"
66import { countries } from " country-list-json"
77import SignaturePad from " signature_pad"
88
9- // Dynamic / Async component import (Vue 3 style)
10- // const CustomComponent = defineAsyncComponent(() => import("./CustomComponent.vue"))
119
1210defineOptions ({
1311 name: " PdfForm" ,
@@ -241,7 +239,6 @@ const updateAgreementFormCache = (key, fields) => {
241239 if (! localStorage .agreementFields ) {
242240 localStorage .agreementFields = {}
243241 }
244- console .log (' is this updated' , key, fields);
245242 if (key && fields) {
246243 localStorage .setItem (key, JSON .stringify (fields))
247244 }
@@ -292,11 +289,18 @@ const submit = () => {
292289 console .log (
293290 ` Page ${ pageNum} (${ page .getWidth ()} x ${ page .getHeight ()} ) - insert image ${ key} .png (${ pngDims .width } x ${ pngDims .height } ) at position ${ xpos} x ${ ypos} ` ,
294291 )
292+
293+ const targetWidth = 300 ;
294+ const targetHeight = 30 ;
295+ const scaleX = targetWidth / pngImage .width ;
296+ const scaleY = targetHeight / pngImage .height ;
297+ const scale = Math .min (scaleX, scaleY);
298+
295299 page .drawImage (pngImage, {
296300 x: xpos,
297301 y: ypos,
298- width: pngDims .width ,
299- height: pngDims .height ,
302+ width: pngImage .width * scale ,
303+ height: pngImage .height * scale ,
300304 })
301305 })
302306 })
@@ -484,6 +488,8 @@ onMounted(() => {
484488 :ref =" item.key"
485489 autocomplete =" ignore-field"
486490 :items =" item.options"
491+ item-title =" text"
492+ item-value =" value"
487493 :required =" isFieldRequired(item.required)"
488494 :clearable =" isBoolTrue(item.clearable)"
489495 clear-icon =" "
@@ -524,22 +530,21 @@ onMounted(() => {
524530 persistent
525531 width =" 290px"
526532 >
527- <template v-slot : activator =" { on , attrs } " >
533+ <template # activator =" { props } " >
528534 <v-text-field
529535 v-model =" formData[item.key]"
530536 class =" mt-1 mb-2"
531- :placeholder =" item.placeholder ? item.placeholder : ''"
537+ :placeholder =" item.placeholder || ''"
532538 persistent-placeholder
533539 variant =" outlined"
534540 density =" compact"
535541 hide-details
536542 readonly
537- v-bind =" attrs"
538- v-on =" on"
543+ v-bind =" props"
539544 >
540- <template v-slot : label >
541- {{ item.label
542- }} <span v-if =" isFieldRequired(item.required)" class =" red--text text--darken-2" > * </span >
545+ <template # label >
546+ {{ item.label }}
547+ <span v-if =" isFieldRequired(item.required)" class =" red--text text--darken-2" > * </span >
543548 </template >
544549 </v-text-field >
545550 </template >
0 commit comments