Tabla de Contenidos

Type IMG-Firma


Propiedad de tipo FIRMA

   <prop name="FIRMA" visible="1" type="IMG" readonly="false" labelwidth="0" width="90%" height="50%" onchange="refresh"/>


Para personalizar los iconos


Se han definido algunos atributos para personalizar la apariencia de los iconos al definir un type=“IMG” con readonly=“false”. (Firma vieja, para mayor personalización utilizar el type=“DR”)

Atributos:

Atributo Descripción
img-sign Icono de la firma.
img-sign-sel Icono de la firma cuando pulsamos en él.
img-delete Icono para descartar la firma.
img-delete-sel Icono para cuando pulsamos en descartar la firma.
img-save Icono para guardar la firma.
img-save-sel Icono para cuando pulsamos en guardar la firma.
hide-no-picture Para ocultar la imagen predeterminada “NO PICTURE”, (hide-no-picture=“true”) para ocultar
Apariencia de un campo type=“IMG” readonly=“false” Pantalla para firmar, sólo se pueden personalizar los iconos

Límites Subida de Archivos


Se han incorporado ciertos atributos para “limitar” la subida de ficheros en los type “AT” (Adjuntar fichero), “IMG” (Firma), “VD” (Vídeo) y “PH” (Foto).

Atributos:

Atributo Descripción
file-maxsize=“XXX” Tamaño en bytes, tamaño máximo del fichero a subir.
file-msgfail=“Mensaje Error” Personalizamos el error si se intenta subir un fichero muy grande.
file-maxwidth=“800” Ancho máximo de la foto que se tome.
file-maxheight=“600” Alto máximo de la foto que se tome.

Se debe implementar file-maxwidth y file-maxheight para los campos de tipo foto y firma para que los distintos dispositivos repliquen todos las fotos y firmas siempre con la misma resolución. Esto hará que el tamaño de las fotos sea más predecible y de pequeño tamaño, y evitará problemas de memoria en dispositivos de gama baja.

Llamada por SCRIPT


Se puede llamar directamente con un botón que se cree el usuario a un script para que lance la firma, esto lanzará la ventana para firmar y asociará la firma realizada al campo que se especifique como parámetro.

<frame name="group1Frame" class="frmtodo" height="1040p" bgcolor="#FFFFFF" align="top|center">
	<prop name="MAP_IMG" type="IMG" visible="7" align="center" width="45%" height="40%" lmargin="30p" tmargin="16p" />    
	<prop name="MAP_BT_CAMBIOIMAGEN" type="B" method="ExecuteNode(LanzarFirma)" title="Lanzar Firma" width="330p" height="100p" labelwidth="1" visible="1" align="center" />   
</frame>
 
<LanzarFirma>
	<action name="runscript">
		<script language="VBScript">
			ui.StartSignature "MAP_IMG", 640, 480
		</script>
	</action>
</LanzarFirma>
 
let fileManager;
 
function lanzarFirma() {
    let imageDrawing = new ImageDrawing();
	imageDrawing.create(640, 480);
	//imageDrawing.setBackgroundColor("#FF0000");
	imageDrawing.setBackground("splash.jpg");
	imageDrawing.setFont("alexbrush.ttf");
	imageDrawing.setFontSize("32");
	imageDrawing.setFontStyle("bold");
	imageDrawing.addImageSetXY("testbackground.jpg", 100, 200);
	imageDrawing.addTextSetXY("texto de prueba", 100, 200, 0);
	imageDrawing.save("temporal_ImagenFondoFirma.png");
	ui.startSignature("MAP_FIRMA", 640, 480, "temporal_ImagenFondoFirma.png");
}
 
function addTimestamp(sPath) {
    if (!sPath) {
        throw "Haga una foto primero";
    }
    let sPathEdited = "edited_" + sPath;
    let imageDrawing = new ImageDrawing();
    let imageInfo = imageDrawing.getImageInfo(sPath);
    imageDrawing.create(imageInfo.getWidth(), imageInfo.getHeight());
    imageDrawing.setBackground(sPath);
    imageDrawing.setFont("Product-Sans-Regular.ttf");
    imageDrawing.setFontSize(64);
    imageDrawing.setFontColor("#FF0000");
    imageDrawing.addTextSetXY(new Date().toString(), 100, 200, 0);
    imageDrawing.save(sPathEdited);
    ui.openFile(sPathEdited);
}
 
function obtenerInformacion() {
    let imageDrawing = new ImageDrawing();
	let imageInfo = imageDrawing.getImageInfo("splash.jpg");
	let sMessage = "Ancho: " + imageInfo.getWidth() + "\n";
	sMessage = sMessage + "Alto: " + imageInfo.getHeight() + "\n";
	sMessage = sMessage + "Mime type: " + imageInfo.getMimeType();
	ui.msgBox(sMessage, "Mensaje", 0);
}
 
function mostrarInformacion(sPath) {
    let imageDrawing = new ImageDrawing();
	let imageInfo = imageDrawing.getImageInfo(sPath);
	let sMessage = "Ancho: " + imageInfo.getWidth() + "\n";
	sMessage = sMessage + "Alto: " + imageInfo.getHeight() + "\n";
	sMessage = sMessage + "Mime type: " + imageInfo.getMimeType();
	ui.msgBox(sMessage, "Mensaje", 0);
}
 
function resizeImage() {
    let imageDrawing = new ImageDrawing();
	let sPath = "splash.jpg";
	let sPathResized = "splash_resized.png";
	mostrarInformacion(sPath);
	imageDrawing.create(100, 100);
	imageDrawing.setBackground(sPath);
	imageDrawing.save(sPathResized);
	mostrarInformacion(sPathResized);
	self.MAP_FIRMA = sPathResized;
	ui.refresh("MAP_FIRMA");
}
 
function resizeImageCopyExif() {
    let imageDrawing = new ImageDrawing();
	let sPath = self.MAP_FOTO;
	if (!fileExists(sPath)) {
	    throw "Haga la foto primero";
	}
	let sPathResized = "photo_resized.jpg";
	imageDrawing.create(640, 480);
	imageDrawing.setBackground(sPath);
	imageDrawing.save(sPathResized);
	imageDrawing.copyExifMetadata(sPath, sPathResized);
	mostrarInformacion(sPathResized);
	self.MAP_FOTO = sPathResized;
	ui.refresh("MAP_FOTO");
}

Veáse también: Type="IMG" Tipo Imagen


Type IMG- Tipo Imagen