Signature generation method and device based on signature area size, equipment and medium
By generating a signature example, the user is guided to sign and adjust the size of the electronic signature image according to the size of the signature area, the problem of excessively large electronic signature image obstructing copy is solved, and the adaptability between signature and file is improved.
Patent Information
- Application Number
- CN202411527418.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-29
- Publication Date
- 2025-02-21
AI Technical Summary
The existing electronic signature generation method cannot process user signatures based on the actual signature area reserved in the contract or agreement, resulting in the electronic signature image being too wide and obstructing the copywriting of the contract or agreement.
By obtaining the name to be signed and generating a signature example, the user is guided to sign and obtain a handwritten signed image; then, based on the signature area size information in the document to be signed and the size information of the handwritten signed image, the target width and height dimension of the target signature image is determined, and Process the handwritten signature image to generate a target signature image that adapts to the signature area.
It effectively avoids the problem of excessive size of electronic signature images that obstruct copywriting, improves the adaptability of signatures and files, and ensures that the overall performance of signatures and files is more coordinated.
Smart Images

Figure CN119494892A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of digital signature and financial technology, and in particular to a signature generation method, device, equipment and medium based on signature area size. Background Art
[0002] With the development of computer technology in the financial field, e-commerce has gradually been widely used in financial transactions. In order to ensure the security and reliability of e-commerce. In business scenarios where user authorization is required for signature authentication, an electronic signature is generated based on the user's actual signature to display the electronic signature in the electronic contract and transaction records to ensure the integrity and validity of the transaction contract. However, the current electronic signature generation method cannot process the user's signature according to the actual signature area reserved in the contract or agreement, resulting in the obtained electronic signature image being too large in width and height and obscuring part of the text of the contract or agreement. Therefore, how to guide users to sign and control the size of the electronic signature and improve the adaptability of the signature to the document has become an urgent problem to be solved. Summary of the invention
[0003] The present application provides a signature generation method, apparatus, device and medium based on signature area size to improve the compatibility between signature and file.
[0004] In a first aspect, the present application provides a signature generation method based on signature area size, the method comprising:
[0005] Obtain the name to be signed, and generate a signature example corresponding to the name to be signed based on the width and height information of the preset background canvas and the display style information;
[0006] Based on the signature example, guiding the user to sign and obtaining the user's handwritten signature image;
[0007] Acquire the size information of the signature area in the document to be signed, and determine the target width and height of the target signature image based on the size information of the signature area and the size information of the handwritten signature image;
[0008] Based on the target width and height dimensions, the handwritten signature image is processed to obtain a target signature image.
[0009] In a second aspect, the present application further provides a signature generation device based on the signature area size, the device comprising:
[0010] A signature example generation module is used to obtain a name to be signed, and generate a signature example corresponding to the name to be signed based on the width and height information of a preset background canvas and display style information;
[0011] An initial electronic signature acquisition module, used to guide the user to sign based on the signature example and obtain the user's handwritten signature image;
[0012] A target width and height size acquisition module is used to obtain the size information of the signature area in the document to be signed, and determine the target width and height size of the target signature image based on the size information of the signature area and the size information of the handwritten signature image;
[0013] The target signature image acquisition module is used to process the handwritten signature image based on the target width and height dimensions to obtain the target signature image.
[0014] In a third aspect, the present application also provides a computer device, comprising a memory and a processor; the memory is used to store a computer program; the processor is used to execute the computer program and implement the signature generation method based on the signature area size as described above when executing the computer program.
[0015] In a fourth aspect, the present application further provides a computer-readable storage medium storing a computer program, which, when executed by a processor, enables the processor to implement the signature generation method based on the signature area size as described above.
[0016] The present application discloses a signature generation method, device, equipment and medium based on the size of the signature area, which obtains the name to be signed, generates a signature example corresponding to the name to be signed based on the width and height information of the preset background canvas and the display style information; guides the user to sign based on the signature example, and obtains the handwritten signature image of the user; obtains the size information of the signature area in the document to be signed, and determines the target width and height of the target signature image based on the size information of the signature area and the size information of the handwritten signature image; processes the handwritten signature image based on the target width and height to obtain the target signature image. The present application can generate a signature example based on the name to be signed to guide the user to sign, avoiding the user signature not meeting the specification due to the different lengths of different user names when using a unified example; secondly, according to the actual signature area size in the document to be signed, controls the size of the target signature image, avoids the target signature image size being too large to cover the text part of the document to be signed, and improves the adaptability of the signature to the document to be signed. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0018] Figure 1 is a schematic flow chart of a first embodiment of a signature generation method based on signature area size provided by an embodiment of the present application;
[0019] Figure 2 is a schematic flow chart of a second embodiment of a signature generation method based on signature area size provided in an embodiment of the present application;
[0020] Figure 3 is a schematic flow chart of a third embodiment of a signature generation method based on signature area size provided in an embodiment of the present application;
[0021] Figure 4 A schematic block diagram of a signature generation device based on signature area size provided in an embodiment of the present application;
[0022] Figure 5 A schematic block diagram of the structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0023] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0024] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.
[0025] It should be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0026] It should be further understood that the term “and / or” used in the specification and appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0027] The embodiments of the present application provide a signature generation method, device, equipment and medium based on the signature area size. Among them, the signature generation method based on the signature area size can be applied to the server, and a signature example is generated according to the name to be signed to guide the user to sign, thereby avoiding the user signature not meeting the specification due to the different lengths of different user names when using a unified example; secondly, according to the actual signature area size of the document to be signed, the size of the target signature image is controlled, thereby avoiding the target signature image size being too large and obscuring the text part of the document to be signed, thereby improving the compatibility of the signature and the document to be signed. Among them, the server can be an independent server or a server cluster.
[0028] In conjunction with the accompanying drawings, some embodiments of the present application are described in detail below. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0029] See also Figure 1 , Figure 1 This is a schematic flow chart of a signature generation method based on signature area size provided by an embodiment of the present application. The signature generation method based on signature area size can be applied to a server to generate a signature example based on the name to be signed to guide the user to sign, thereby avoiding the user signature not meeting the specification due to the different lengths of different user names when using a unified example; secondly, according to the actual signature area size of the document to be signed, the size of the target signature image is controlled, thereby avoiding the target signature image size being too large to block the text part of the document to be signed, thereby improving the adaptability of the signature to the document to be signed.
[0030] like Figure 1 As shown, the signature generation method based on signature area size specifically includes steps S101 to S104.
[0031] S101, obtaining a name to be signed, and generating a signature example corresponding to the name to be signed based on the width and height information of a preset background canvas and display style information;
[0032] In one embodiment, the name to be signed can be obtained through a form input or other methods. For example, when a bank handles business, it is required that the customer sign and authenticate the relevant documents. At this time, the bank staff will input the user's ID card name through a form or directly identify the user's name from the ID card, and use the name as the name to be signed. After the user signs, the user's handwritten signature can also be compared with the name to be signed to confirm that the user's handwritten signature is written correctly.
[0033] In this embodiment, the width and height information of the preset background canvas, that is, the size of the background canvas of the signature example, can be a fixed size or a size dynamically adjusted according to the screen size of the user's device.
[0034] In this embodiment, the preset display style information includes a signature style and a background style, including font, font size, color, alignment, text baseline, etc., which will be used to generate a signature example.
[0035] In one embodiment, when the name to be signed is obtained, the position of each character in the background canvas is determined according to the width and height information of the background canvas and the number of characters in the name to be signed, and the signature component is used to draw the text trajectory of the name to be signed onto the background canvas according to the position and display style corresponding to each character to obtain a signature example.
[0036] S102, guiding the user to sign based on the signature example, and obtaining the user's handwritten signature image;
[0037] Furthermore, the method of guiding the user to sign based on the signature example and obtaining the user's handwritten signature image includes: guiding the user to sign based on the signature example and monitoring the user's signature trajectory; calling the signature component to render the user's signature trajectory into a preset initial signature canvas to generate the handwritten signature image.
[0038] In this embodiment, the signature component generally refers to a set of tools and interface elements used in software or web pages to obtain a user's handwritten signature. It allows the user to draw a signature on an electronic device and save and use the signature in digital form. A canvas area can be provided for the user to draw a signature, and touch and mouse events can be supported for use on different devices. The user's signature trajectory on the canvas is monitored and captured, and the trajectory data is saved in a format that can reproduce the signature. After the user completes the signature, a real-time preview of the signature is provided. Undo and redo operations are supported to facilitate the user to modify the signature. An API interface is provided to facilitate developers to integrate the signature component into different applications.
[0039] In one embodiment, the position of each character of the user's name is shown in the signature example to guide the user to sign in the correct position. The generated signature example is displayed on the user interface to let the user know the expected style and position of the signature.
[0040] In one embodiment, a canvas area is provided on the user interface to prompt the user to sign by hand in this area. Some guiding words or icons may be provided to tell the user how to start signing.
[0041] In a specific embodiment, the mouse click event, mouse move event and mouse lift event are monitored, and for a touch screen device, the touch start event, touch move event and touch end event are monitored to capture the user's signature action.
[0042] In one embodiment, when the above event is detected, the mouse or touch movement trajectory is recorded as the user's signature trajectory, and the signature trajectory is rendered in real time onto the initial signature canvas to obtain a handwritten signature image.
[0043] S103, obtaining the size information of the signature area in the document to be signed, and determining the target width and height of the target signature image based on the size information of the signature area and the size information of the handwritten signature image;
[0044] Furthermore, the method of obtaining the size information of the signature area in the file to be signed includes: obtaining the file to be signed, identifying the file to be signed, and obtaining the signature keyword; based on the signature keyword, determining the signature range including the signature area; based on the text boundary in the signature range, determining the bounding box of the signature area, and performing size statistics on the bounding box to obtain the size information.
[0045] In this embodiment, the file to be signed may be an electronic document, such as a PDF or Word document, or an image file, such as a PNG or JPEG.
[0046] In a specific embodiment, a corresponding library or tool is used to open and identify the content of the file to be signed. For example, for a PDF file, a PDF processing library (such as PDF.js, PyPDF2, Apache PDFBox, etc.) can be used to parse the file content.
[0047] In one embodiment, in the document to be signed, there are usually specific keywords or phrases to indicate the location of the signature, such as "Signature:", "Signature:", "Signature", etc. By searching these keywords, the approximate signature range including the signature area can be quickly located.
[0048] In one embodiment, a text analysis tool or an image processor is used to determine the boundaries of the text in the signature area. For text files, the start and end positions of a specific text block are found. For image files, optical character recognition technology is used to identify the text in the image.
[0049] In one embodiment, the text boundary or the area boundary at a preset distance from the text boundary is used as the boundary box of the signature area, and the size of the boundary box of the signature area is measured, including measuring the width and height of the boundary box, to obtain the size information of the signature area.
[0050] S104: Process the handwritten signature image based on the target width and height dimensions to obtain a target signature image.
[0051] Furthermore, the handwritten signature image is processed based on the target width and height dimensions to obtain the target signature image, including: creating a target signature canvas based on the target width and height dimensions; drawing the signature trajectory in the handwritten signature image into the target signature canvas, and converting the target signature canvas into an image string with preset attributes; and generating the target signature image based on the image string.
[0052] In one embodiment, a new canvas element is created with the target width and height dimensions to serve as the target signature canvas.
[0053] In one embodiment, the handwritten signature track of the user on the original signature canvas is drawn onto the target signature canvas. If the handwritten signature track exceeds the target signature canvas, the handwritten signature track is scaled according to the size of the target signature canvas to ensure that the handwritten signature track is within the target signature canvas.
[0054] In one embodiment, the target signature canvas is converted into an image string with preset properties (such as format, quality, etc.). For example, the target signature canvas is converted into a base64 string in the image / png image file format using the toDataUrl method.
[0055] In one embodiment, the obtained image string is used to generate a target signature image. Specifically, the image string can be sent to a server as Base64-encoded data, and the server saves the image string as a target signature image file.
[0056] In one embodiment, the obtained target signature image is embedded into the signature area of the document to be signed to implement the user signature.
[0057] The above embodiment provides a signature generation method, device, equipment and medium based on the size of the signature area, obtains the name to be signed, and generates a signature example corresponding to the name to be signed based on the width and height information of the preset background canvas and the display style information; based on the signature example, guides the user to sign and obtains the handwritten signature image of the user; obtains the size information of the signature area in the document to be signed, and determines the target width and height of the target signature image based on the size information of the signature area and the size information of the handwritten signature image; based on the target width and height, processes the handwritten signature image to obtain the target signature image. The present application can generate a signature example based on the name to be signed to guide the user to sign, avoiding the user signature not meeting the specification due to the different lengths of different user names when using a unified example; secondly, according to the actual signature area size in the document to be signed, the size of the target signature image is controlled, avoiding the target signature image size being too large to block the text part of the document to be signed, and improving the adaptability of the signature to the document to be signed.
[0058] See also Figure 2 , Figure 2 This is a schematic flow chart of a signature generation method based on signature area size provided by an embodiment of the present application. The signature generation method based on signature area size can be applied to a server to dynamically adjust the layout of signature examples according to the size of the example background canvas and the number of characters in the name to be signed. Names to be signed of different lengths correspond to different examples, thereby providing a better user experience and visual guidance, and improving the standardization of signatures.
[0059] like Figure 2 As shown, the signature generation method based on signature area size specifically includes steps S201 to S203.
[0060] S201, determining the position of each character in the name to be signed in the background canvas based on the width and height information and the number of characters in the name to be signed;
[0061] S202, processing the name to be signed based on the display style information and the position to obtain a signature to be displayed;
[0062] S203: Fill the signature to be displayed into the background canvas to obtain the signature example.
[0063] In one embodiment, the width and height of the background canvas and the length of the name to be signed are obtained.
[0064] In one embodiment, the rendering position of each character is dynamically calculated according to the size of the background canvas and the number of characters in the name. Usually, the name will be horizontally centered and displayed in the middle of the canvas.
[0065] In a specific embodiment, a loop syntax is used to calculate the rendering position of each character in the name. Specifically, the position of each character is calculated by the formula [x, y] = [(bgCanvas.width / (name.length*2))*(1+index*2), bgCanvas.height / 2]. Where bgCanvas.height is the height of the background canvas, bgCanvas.width is the width of the background canvas, name.length is the length of the user's name, and index is an index variable that can be used to determine the position when drawing multiple text instances on the canvas.
[0066] The coordinates [x,y] are used to determine where to center the text on the canvas. Specifically, the x coordinate is calculated by dividing the width of the canvas by (the length of the name times 2) and then multiplying by (1 plus the index times 2). The text will be positioned across the width of the canvas based on the length of the name and the index. The y coordinate is calculated by dividing the height of the canvas by 2 and is used to vertically center the text on the canvas.
[0067] In one embodiment, the font, color, alignment, text baseline, etc. of the text are set according to the display style information to obtain the signature to be displayed.
[0068] In one embodiment, according to the calculated position of each character, each character of the signature to be displayed is rendered and drawn at a corresponding position in the background canvas, so that the signature to be displayed fills the background canvas, and a signature example is obtained.
[0069] In the above embodiment, the layout of the signature example is dynamically adjusted according to the size of the example background canvas and the number of characters in the name to be signed. Names to be signed of different lengths correspond to different examples, thereby providing a better user experience and visual guidance, and improving the standardization of the signature.
[0070] See also Figure 3 , Figure 3 This is a schematic flow chart of a signature generation method based on the size of the signature area provided by an embodiment of the present application. The signature generation method based on the size of the signature area can be applied to a server to determine the width and height of the target signature image according to the size of the signature area, thereby improving the adaptability of the signature to the document to be signed. In addition, the width and height ratio of the user's signature is maintained to ensure the accuracy of the user's signature.
[0071] like Figure 3 As shown, the signature generation method based on signature area size specifically includes steps S301 to S304.
[0072] S301, comparing the size information of the signature area with the size information of the handwritten signature image, wherein the size information includes a width value and a height value;
[0073] S302: when the width value of the signature area is smaller than the width value of the handwritten signature image, taking the width value of the signature area as the target width value of the target signature image;
[0074] S303, obtaining a target height value of the target signature image based on the target width value and the aspect ratio of the handwritten signature image;
[0075] S304: Obtain the target width and height dimensions based on the target height value and the target width value.
[0076] In one embodiment, the width of the signature area is compared with the width of the handwritten signature image. If the width of the signature area is smaller than the width of the handwritten signature image, it means that the handwritten signature image may cover part of the text outside the signature area, and the handwritten signature image needs to be reduced to fit the signature area.
[0077] In a specific embodiment, the width of the signature area is used as the target width value of the target signature image. The target height value is calculated using the original aspect ratio of the handwritten signature image. The target height is calculated using the target width and the original aspect ratio. This can be accomplished using the following formula: target height = target width ÷ width of the handwritten signature image × height of the handwritten signature image.
[0078] The original aspect ratio = the width of the handwritten signature image / the height of the handwritten signature image.
[0079] In one embodiment, the target width value and the target height value are combined to obtain the target width and height dimensions.
[0080] This process ensures that the handwritten signature image is properly scaled to fit the dimensions of the signature area while maintaining the image's aspect ratio. By comparing the width values of the signature area and the handwritten signature image, and using the original aspect ratio to calculate the target height value, you can get a target signature image size that fits the specific signature area.
[0081] Furthermore, after comparing the size information of the signature area with the size information of the handwritten signature, it also includes: when the height value of the signature area is smaller than the height value of the handwritten signature image, using the height value of the signature area as the target height value of the target signature image; based on the target height value and the aspect ratio of the handwritten signature image, obtaining the width value of the target signature image; based on the target height value and the target width value, obtaining the target width and height dimensions.
[0082] In one embodiment, if the height of the signature area is smaller than the height of the handwritten signature image, it means that the handwritten signature image also needs to be reduced to fit into the signature area.
[0083] In a specific embodiment, the height value of the signature area is set as the target height value of the handwritten signature image. The target width is calculated using the target height value and the original aspect ratio. This can be done by the following formula: target width value = target height value × aspect ratio.
[0084] In one embodiment, the calculated target width value and target height value are used as the target width and height dimensions.
[0085] In one embodiment, when the height value of the signature area is smaller than the height value of the handwriting area and the width value of the signature area is also smaller than the width value of the handwriting area, it indicates that the handwritten signature image needs to be reduced to fit into the signature area.
[0086] In a specific embodiment, the smaller value of the width or height of the signature area is used to determine the target size, and the other size is calculated accordingly. For example, the width value of the signature area is used to calculate the target height value, and the calculated target height value is compared with the height value of the signature area. If it is still greater than the height value of the signature area, the height value of the signature area is used as the target height value, and the target width value is calculated by the aspect ratio. The target width and height dimensions are obtained by combining the target width and height values.
[0087] In one embodiment, when the size of the signature area is larger than the size of the handwritten signature image, the size of the handwritten signature image is used as the target width and height size.
[0088] In the above embodiment, the width and height of the target signature image can be determined according to the size of the signature area, thereby improving the adaptability of the signature to the document to be signed, and maintaining the width and height ratio of the user's signature to ensure the accuracy of the user's signature.
[0089] See also Figure 4 , Figure 4 The embodiment of the present application provides a schematic block diagram of a signature generation device based on signature area size, and the signature generation device based on signature area size is used to execute the aforementioned signature generation method based on signature area size. The signature generation device based on signature area size can be configured on a server.
[0090] like Figure 4 As shown, the signature generation device 400 based on the signature area size includes:
[0091] The signature example generation module 401 is used to obtain a name to be signed, and generate a signature example corresponding to the name to be signed based on the width and height information of the preset background canvas and the display style information;
[0092] An initial electronic signature acquisition module 402 is used to guide the user to sign based on the signature example and obtain the user's handwritten signature image;
[0093] The target width and height size acquisition module 403 is used to obtain the size information of the signature area in the document to be signed, and determine the target width and height size of the target signature image based on the size information of the signature area and the size information of the handwritten signature image;
[0094] The target signature image obtaining module 404 is used to process the handwritten signature image based on the target width and height dimensions to obtain a target signature image.
[0095] Furthermore, the signature example generation module 401 includes:
[0096] A position determination unit, configured to determine the position of each character in the name to be signed in the background canvas based on the width and height information and the number of characters in the name to be signed;
[0097] A signature-to-be-displayed obtaining unit, configured to process the name to be signed based on the display style information and the position to obtain the signature to be displayed;
[0098] The signature example obtaining unit is used to fill the signature to be displayed into the background canvas to obtain the signature example.
[0099] Furthermore, the target width and height size obtaining module 403 includes:
[0100] A signature key detection and acquisition unit, used to acquire the file to be signed, identify the file to be signed, and acquire signature keywords;
[0101] A signature range determining unit, configured to determine a signature range including a signature area based on the signature keyword;
[0102] The size information obtaining unit is used to determine the boundary box of the signature area based on the text boundary in the signature range, and perform size statistics on the boundary box to obtain the size information.
[0103] Furthermore, the target signature image obtaining module 404 includes:
[0104] A canvas creation unit, used to create a target signature canvas based on the target width and height dimensions;
[0105] An image character string obtaining unit, used for drawing the signature track in the handwritten signature image into the target signature canvas, and converting the target signature canvas into an image character string of preset attributes;
[0106] The target signature image generating unit is used to generate the target signature image based on the image character string.
[0107] Furthermore, the target width and height size obtaining module 403 includes:
[0108] A size comparison unit, used to compare the size information of the signature area with the size information of the handwritten signature image, wherein the size information includes a width value and a height value;
[0109] a width value determining unit, configured to use the width value of the signature area as a target width value of the target signature image when the width value of the signature area is smaller than the width value of the handwritten signature image;
[0110] A height value obtaining unit, used for obtaining a target height value of the target signature image based on the target width value and the aspect ratio of the handwritten signature image;
[0111] The width and height size obtaining unit is used to obtain the target width and height size based on the target height value and the target width value.
[0112] Furthermore, the target width and height size obtaining module 403 further includes:
[0113] a height value determining unit, configured to use the height value of the signature area as a target height value of the target signature image when the height value of the signature area is less than the height value of the handwritten signature image;
[0114] A width value obtaining unit, used to obtain a width value of the target signature image based on the target height value and the aspect ratio of the handwritten signature image;
[0115] The width and height size obtaining unit is used to obtain the target width and height size based on the target height value and the target width value.
[0116] Furthermore, the initial electronic signature obtaining module 402 includes:
[0117] A signature trajectory monitoring unit, used to guide the user to sign based on the signature example, and monitor the user's signature trajectory;
[0118] The signature image generating unit is used to call the signature component, render the user signature trajectory into a preset initial signature canvas, and generate the handwritten signature image.
[0119] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described device and each module can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0120] The above-mentioned device can be implemented in the form of a computer program. Figure 5 Runs on the computer device shown.
[0121] See also Figure 5 , Figure 5 1 is a schematic block diagram of a computer device provided in an embodiment of the present application. The computer device may be a server.
[0122] See also Figure 5 The computer device includes a processor, a memory and a network interface connected through a system bus, wherein the memory may include a non-volatile storage medium and an internal memory.
[0123] The non-volatile storage medium can store an operating system and a computer program. The computer program includes program instructions, and when the program instructions are executed, the processor can execute any signature generation method based on the signature area size.
[0124] The processor is used to provide computing and control capabilities and support the operation of the entire computer equipment.
[0125] The internal memory provides an environment for the operation of the computer program in the non-volatile storage medium. When the computer program is executed by the processor, the processor can execute any signature generation method based on the signature area size.
[0126] The network interface is used for network communication, such as sending assigned tasks, etc. Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0127] It should be understood that the processor may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0128] In one embodiment, the processor is used to run a computer program stored in the memory to implement the following steps:
[0129] Obtain the name to be signed, and generate a signature example corresponding to the name to be signed based on the width and height information of the preset background canvas and the display style information;
[0130] Based on the signature example, guiding the user to sign and obtaining the user's handwritten signature image;
[0131] Acquire the size information of the signature area in the document to be signed, and determine the target width and height of the target signature image based on the size information of the signature area and the size information of the handwritten signature image;
[0132] Based on the target width and height dimensions, the handwritten signature image is processed to obtain a target signature image.
[0133] In one embodiment, when the processor generates a signature example corresponding to the name to be signed based on the preset width and height information of the background canvas and the display style information, it is used to implement:
[0134] Based on the width and height information and the number of characters in the name to be signed, determine the position of each character in the name to be signed in the background canvas;
[0135] Based on the display style information and the position, the name to be signed is processed to obtain a signature to be displayed;
[0136] The signature to be displayed is filled into the background canvas to obtain the signature example.
[0137] In one embodiment, when obtaining the size information of the signature area in the file to be signed, the processor is used to implement:
[0138] Obtain the file to be signed, identify the file to be signed, and obtain signature keywords;
[0139] Based on the signature keyword, determining a signature range including a signature area;
[0140] Based on the text boundaries in the signature range, a boundary box of the signature area is determined, and size statistics are performed on the boundary box to obtain the size information.
[0141] In one embodiment, when the processor processes the handwritten signature image based on the target width and height to obtain the target signature image, the processor is used to implement:
[0142] Based on the target width and height dimensions, create a target signature canvas;
[0143] Drawing the signature track in the handwritten signature image into the target signature canvas, and converting the target signature canvas into an image string with preset attributes;
[0144] Based on the image character string, the target signature image is generated.
[0145] In one embodiment, when determining the target width and height of the target signature image based on the size information of the signature area and the size information of the handwritten signature image, the processor is used to implement:
[0146] Comparing the size information of the signature area with the size information of the handwritten signature image, wherein the size information includes a width value and a height value;
[0147] When the width value of the signature area is smaller than the width value of the handwritten signature image, the width value of the signature area is used as the target width value of the target signature image;
[0148] Based on the target width value and the aspect ratio of the handwritten signature image, obtaining a target height value of the target signature image;
[0149] The target width and height dimensions are obtained based on the target height value and the target width value.
[0150] In one embodiment, after the processor compares the size information of the signature area with the size information of the handwritten signature, the processor is further configured to:
[0151] When the height value of the signature area is less than the height value of the handwritten signature image, the height value of the signature area is used as the target height value of the target signature image;
[0152] Based on the target height value and the aspect ratio of the handwritten signature image, obtaining a width value of the target signature image;
[0153] The target width and height dimensions are obtained based on the target height value and the target width value.
[0154] In one embodiment, when the processor guides the user to sign based on the signature example and obtains the handwritten signature image of the user, it is used to implement:
[0155] Based on the signature example, guide the user to sign and monitor the user's signature trajectory;
[0156] The signature component is called to render the user signature trajectory into a preset initial signature canvas to generate the handwritten signature image.
[0157] A computer-readable storage medium is also provided in an embodiment of the present application, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and the processor executes the program instructions to implement any one of the signature generation methods based on signature area size provided in the embodiments of the present application.
[0158] The computer-readable storage medium may be an internal storage unit of the computer device described in the above embodiment, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the computer device.
[0159] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present application, and these modifications or replacements should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A signature generation method based on signature area size, characterized in that: include: Obtain the name to be signed, and generate a signature example corresponding to the name to be signed based on the width and height information of the preset background canvas and the display style information; Based on the signature example, guiding the user to sign and obtaining the user's handwritten signature image; Acquire the size information of the signature area in the document to be signed, and determine the target width and height of the target signature image based on the size information of the signature area and the size information of the handwritten signature image; Based on the target width and height dimensions, the handwritten signature image is processed to obtain a target signature image.
2. The signature generation method based on signature area size according to claim 1, characterized in that: The step of generating a signature example corresponding to the name to be signed based on the preset width and height information of the background canvas and the display style information includes: Based on the width and height information and the number of characters in the name to be signed, determine the position of each character in the name to be signed in the background canvas; Based on the display style information and the position, the name to be signed is processed to obtain a signature to be displayed; The signature to be displayed is filled into the background canvas to obtain the signature example.
3. The signature generation method based on signature area size according to claim 1, characterized in that: The step of obtaining the size information of the signature area in the file to be signed includes: Obtain the file to be signed, identify the file to be signed, and obtain signature keywords; Based on the signature keyword, determining a signature range including a signature area; Based on the text boundaries in the signature range, a boundary box of the signature area is determined, and size statistics are performed on the boundary box to obtain the size information.
4. The signature generation method based on signature area size according to claim 1, characterized in that: The step of processing the handwritten signature image based on the target width and height to obtain the target signature image includes: Based on the target width and height dimensions, create a target signature canvas; Drawing the signature track in the handwritten signature image into the target signature canvas, and converting the target signature canvas into an image string with preset attributes; Based on the image character string, the target signature image is generated.
5. The signature generation method based on signature area size according to claim 1, characterized in that: The step of determining the target width and height of the target signature image based on the size information of the signature area and the size information of the handwritten signature image includes: Comparing the size information of the signature area with the size information of the handwritten signature image, wherein the size information includes a width value and a height value; When the width value of the signature area is smaller than the width value of the handwritten signature image, the width value of the signature area is used as the target width value of the target signature image; Based on the target width value and the aspect ratio of the handwritten signature image, obtaining a target height value of the target signature image; The target width and height dimensions are obtained based on the target height value and the target width value.
6. The signature generation method based on signature area size according to claim 5, characterized in that: After comparing the size information of the signature area with the size information of the handwritten signature, the method further includes: When the height value of the signature area is less than the height value of the handwritten signature image, the height value of the signature area is used as the target height value of the target signature image; Based on the target height value and the aspect ratio of the handwritten signature image, obtaining a width value of the target signature image; The target width and height dimensions are obtained based on the target height value and the target width value.
7. The signature generation method based on signature area size according to any one of claims 1 to 6, characterized in that: The step of guiding the user to sign based on the signature example and obtaining the user's handwritten signature image includes: Based on the signature example, guide the user to sign and monitor the user's signature trajectory; The signature component is called to render the user signature trajectory into a preset initial signature canvas to generate the handwritten signature image.
8. A signature generation device based on signature area size, characterized in that: include: A signature example generation module is used to obtain a name to be signed, and generate a signature example corresponding to the name to be signed based on the width and height information of a preset background canvas and display style information; An initial electronic signature acquisition module, used to guide the user to sign based on the signature example and obtain the user's handwritten signature image; A target width and height size acquisition module is used to obtain the size information of the signature area in the document to be signed, and determine the target width and height size of the target signature image based on the size information of the signature area and the size information of the handwritten signature image; The target signature image acquisition module is used to process the handwritten signature image based on the target width and height dimensions to obtain the target signature image.
9. A computer device, characterized in that: The computer device includes a memory and a processor; The memory is used to store computer programs; The processor is used to execute the computer program and implement the signature generation method based on signature area size as described in any one of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, which, when executed by a processor, enables the processor to implement the signature generation method based on signature area size as described in any one of claims 1 to 7.