How to save signature without background transparanting

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
MegumiSawada
Posts: 79
Joined: Tue Mar 22, 2016 1:45 pm
Location: Tokyo, Japan

How to save signature without background transparanting

Post by MegumiSawada »

Hi All,

I'm developping an application to save the captured signature to IFS.
When saving the signature to IFS, the file will be saved as PNG file and the background will be automatically transparent.
I would like to save it without background tranparanting.Is there any way to do so?
I tried to save it as JPG file but it was still saved with transparent background.

Web page

Code: Select all

Define_Com Class(#PRIM_WEB.Signature) Name(#Signature) Displayposition(1) Parent(#COM_OWNER) Tabposition(1) Tabstop(False) Height(664) Width(669) Top(44) Left(4)

Evtroutine Handling(#Button1.Click)
Define_Com Class(#SVRM01.SaveFile) Name(#SaveFile)
#Image.FileName := #Signature.Blob
#SaveFile.Execute Std_Blob(#Signature.Blob)
Endroutine
Server module

Code: Select all

#FileName := *PART_DIR_OBJECT + #FileName
Use Builtin(OV_FILE_SERVICE) With_Args(COPY_FILE #STD_BLOB.FileName #FileName) To_Get(#ReturnCode)
Best Regards,
Megumi Sawada
User avatar
Dino
Posts: 472
Joined: Fri Jul 19, 2019 7:49 am
Location: Robbinsville, NC
Contact:

Re: How to save signature without background transparanting

Post by Dino »

Hi Megumi

As the #PRIM_WEB.Signature do not have a way to control transparency, it by defaults returns a PNG file with transparency.
You will need either to request an enhancement to be able to control if you want transparency or not
or you will need to consume a restful api to convert from PNG to JPG for example and to loss the transparency in that step.

Notice that files JPG and PNG are totally different inside. you need to convert them not just to rename them.

Also. Why do you need the file not to have transparency? For example, if I want to be able to show the signature
with a background in an Image, I can control de background of the image been displayed using style. That dont
stop the image to have a transparent background, but now the image covers whatever is behind anyway.

Code: Select all

Begin_Com Role(*EXTENDS #PRIM_WEB) Theme(#SYS_THEME<MaterialDesignBlue>)

Define_Com Class(#PRIM_WEB.Signature) Name(#Signature) DisplayPosition(1) Parent(#COM_OWNER) TabPosition(1) TabStop(False) Height(664) Width(669) Top(44) Left(4) Hint('Sign here') ThemeDrawStyle('LightTitle')
Define_Com Class(#PRIM_MD.RaisedButton) Name(#Button) Caption('Display as Image') DisplayPosition(2) Left(724) Parent(#COM_OWNER) TabPosition(2) ThemeDrawStyle('MediumTitle+Rounded') Top(56) Width(221)
Define_Com Class(#PRIM_IMAG) Name(#Image) DisplayPosition(3) Image(#xImageImage32) Left(784) Parent(#COM_OWNER) TabPosition(3) TabStop(False) Top(256) Height(193) Width(217) ThemeDrawStyle('LightAccent')
Define_Com Class(#PRIM_MD.Label) Name(#Text) DisplayPosition(4) Left(728) Parent(#COM_OWNER) TabPosition(4) Top(136) Caption('alalala alalal alalal alalala alalala alalala alalal alalal alalala alalala alalala alalal alalal alalala alalala  alalala alalal alalal alalala alalala alalala alalal alalal alalala alalala alalala alalal alalal alalala alalala ') Height(265) Width(209) WordWrap(True)
Define_Com Class(#PRIM_MD.Label) Name(#Subtitle1) DisplayPosition(5) Left(4) Parent(#COM_OWNER) TabPosition(5) Top(6) Width(277) Caption('Sign here')

Evtroutine Handling(#Button.Click)
* Image captured is a png with transparent
#Image.Image <= #SYS_APPLN.CreateBitmap( #Signature.Blob )
#Text.Caption := #Signature.Blob
* #sys_web.Navigate Url(#Signature.Blob) Target(New)
Endroutine
End_Com
MegumiSawada
Posts: 79
Joined: Tue Mar 22, 2016 1:45 pm
Location: Tokyo, Japan

Re: How to save signature without background transparanting

Post by MegumiSawada »

Hi Dino,

Thank you for your reply. I now understand #PRIM_WEB.Signature do not have a way to control transparency.
I will consider controling the background of the image been displayed using style.

Best Regards,
Megumi Sawada
Post Reply