Introduction to the

When developing software for Internet of Things devices, the device usually has modules to read ID cards, such as the self-service terminal of banks and libraries. However, the original data to read ID cards from the hardware terminal is required to synthesize the front and back sides of THE ID Card and display them on the terminal. Finally, the base64 encoded picture data is uploaded to the server. This tool is mainly used for synthesizing the second-generation ID Card (based on the basic information drawn on the ID Card template, rather than reading the ID Card information). It does not support foreigner permanent residence permit and self-defining ID Card font size. The following functions are supported: 1. Combine the front and back sides of ID cards based on basic information. 2 Combine the front and back sides of ID cards on one page

rendering

Github.com/kellysong/I…

conclusion

This tool is not difficult to achieve in general. It is purely drawing, that is, drawing the appropriate content at the appropriate distance. Two important methods of Canvas are mainly used:

1. DrawText Draw the text

2. Draw the bitmap

The difficulty is:

1. Avatar background processing, with white background by default, need to clear during synthesis

2. ID Card address multi-line drawing problem. Some people have two lines of ID Card address, some have three lines

Specific usage reference

Github.com/kellysong/I…