Cross-platform desktop application program development method and system and storage medium
By utilizing the Java technology stack, XML two-way data binding, national cryptographic algorithms, and PDF Chinese font embedding, combined with the Maven tool, the cross-platform adaptation and data security issues in traditional desktop application development have been resolved, enabling efficient and secure cross-platform development and deployment.
Patent Information
- Application Number
- CN202511439310.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-10
- Publication Date
- 2025-11-04
AI Technical Summary
Traditional desktop application development faces challenges such as strong platform dependence, high development and maintenance costs, complex cross-platform adaptation, and difficulty in ensuring data security and document display consistency. Especially in the context of domestic substitution, it needs to be compatible with different hardware architectures and operating systems.
It adopts Java as the unified technology stack, uses XML files for data storage and establishes two-way data binding, combines national cryptographic algorithms for encryption and embeds Chinese fonts into PDFs, and uses build tools such as Maven to generate cross-platform installation packages, enabling cross-platform development and deployment.
It enables efficient, secure, and low-cost cross-platform development and deployment, ensuring data security and consistent documentation display, while reducing development and maintenance complexity.
Smart Images

Figure CN120892084A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer applications, and more specifically, to a cross-platform desktop application development method, system, and storage medium. Background Technology
[0002] With the development of information technology, desktop applications continue to play a vital role in enterprise office work, industrial control, and other fields. However, traditional desktop application development faces numerous challenges. First, it is highly platform-dependent. Developing different versions of applications for Windows, macOS, and domestic operating systems such as Kylin and UnionTech UOS requires maintaining multiple code libraries, resulting in high development and maintenance costs. Second, in the context of domestic substitution, applications need to be compatible with different hardware architectures such as x86 and ARM, which further increases the complexity of adaptation.
[0003] Furthermore, many desktop applications need to process local data and generate standardized report documents (such as PDF format). In cross-platform scenarios, ensuring data security, efficiently managing local data, and ensuring that generated documents display correctly and consistently in any environment (especially for Chinese characters) are pressing technical challenges that need to be addressed. For example, if fonts are not properly handled, and the target system lacks specific Chinese fonts, the generated PDF document may display garbled characters or have font replacements, affecting the professionalism and usability of the report. At the same time, for applications involving sensitive information, it is also crucial to use secure encryption algorithms that comply with national standards (such as the national cryptographic algorithm) for data protection.
[0004] Therefore, how to provide a solution that enables efficient development, security, reliability, and seamless deployment of desktop applications across multiple operating systems and hardware architectures is a core technical challenge currently facing this field. Summary of the Invention
[0005] The main objective of this invention is to provide a cross-platform desktop application development method, system, and storage medium to solve the problems in related technologies.
[0006] To achieve the above objectives, according to one aspect of the present invention, a cross-platform desktop application development method is provided, comprising the following steps: On the client side, an XML (Extensible Markup Language) file is used as the data storage medium, and a two-way data binding is established between the interface components in the client interface and the data fields in the XML file. The preset sensitive fields in the XML file are encrypted using the national cryptographic algorithm; In response to the PDF generation instruction, a target PDF file is generated based on a preset PDF (Portable Document Format) template and the data in the XML file, and local Chinese fonts are embedded into the target PDF file; Based on the build tool, the client program and its dependent environment are packaged into an installation package suitable for at least two different operating systems and different hardware architectures.
[0007] Furthermore, establishing two-way data binding includes: When the data of the interface component is updated, the updated data is automatically synchronized to the corresponding data field in the XML file; and / or, When the data in the XML file changes, the display content of the interface components is automatically updated.
[0008] Furthermore, the method also includes: XPath (XML Path Language) expressions are used to retrieve data from the XML file to improve data query efficiency.
[0009] Furthermore, the step of generating the target PDF file includes: The preset field identifier is located in the PDF template, and the corresponding data from the XML file is filled into the position of the field identifier.
[0010] Furthermore, the method also includes: The client interface is built based on a graphical user interface framework, and a layout manager is used to build a responsive interface so that the client interface can automatically adjust the component layout according to the display resolution.
[0011] Furthermore, the method also includes: By registering listeners for the interface components, the validity of the input fields in the interface components can be verified in real time.
[0012] Furthermore, the build tool is Maven; the installation package includes an EXE format installation package suitable for Windows operating systems and a DEB format installation package suitable for domestic operating systems.
[0013] Furthermore, the method also includes: Perform a differential backup on the XML file, backing up only the data content in the XML file that has changed during the backup operation.
[0014] According to another aspect of the present invention, a cross-platform desktop application development system is provided, comprising: The data management module is used to store data locally on the client using XML files as the data storage medium, and to establish two-way data binding between interface components in the client interface and data fields in the XML file. It also uses the national cryptographic algorithm to encrypt the preset sensitive fields in the XML file. The PDF generation module is used to respond to PDF generation instructions, generate a target PDF file based on a preset PDF template and data in the XML file, and embed local Chinese fonts into the target PDF file; The application deployment module is used to package the client program and its dependencies into an installation package suitable for at least two different operating systems and different hardware architectures, based on the build tool.
[0015] Secondly, a computer-readable storage medium is also provided, on which a computer program is stored, which, when executed by a processor, implements the method described in any of the preceding claims.
[0016] Compared with the prior art, the present invention has the following beneficial effects: This invention enables efficient cross-platform development and deployment, significantly reducing development and maintenance costs. Developed using a unified technology stack (such as Java Swing), and automated by using build tools (such as Maven) to generate installation packages compatible with different operating systems (Windows, domestically developed systems) and hardware architectures (X86, ARM), it achieves "code once, run anywhere," avoiding the need to maintain multiple sets of code for different platforms and improving development efficiency and deployment flexibility.
[0017] This ensures the security of local data and the consistency of document generation. Data management is simplified by using XML combined with two-way data binding on the client side; simultaneously, sensitive data is encrypted and stored using national cryptographic algorithms, meeting high security requirements. More importantly, by embedding local Chinese fonts when generating PDFs, the problem of garbled characters or distortion caused by missing fonts on the target system is fundamentally solved, ensuring a consistent and accurate visual presentation of reports on any platform. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] The structures, proportions, sizes, etc., shown in the accompanying drawings of this specification are only for the purpose of assisting those skilled in the art in understanding and reading the content disclosed in the specification, and are not intended to limit the conditions under which the present invention can be implemented. Therefore, they have no substantial technical significance. Any modifications to the structure, changes in the proportions, or adjustments to the size, without affecting the effects and objectives that the present invention can produce, should still fall within the scope of the technical content disclosed in the present invention.
[0020] Figure 1 This is a system block diagram of Embodiment 2 of the present invention.
[0021] Diagram description: 1. Data management module; 2. PDF generation module; 3. Application deployment module. Detailed Implementation
[0022] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0023] This invention provides a cross-platform desktop application development method, system, and storage medium. Its core idea is to use a unified technology stack with inherent cross-platform capabilities (such as Java) as the development foundation, combined with localized data management strategies, high-security encryption standards, and PDF generation technology that ensures consistent document display. Through an automated toolchain, it ultimately achieves efficient development and seamless deployment of applications on multiple operating systems (such as Windows and domestic operating systems) and multiple hardware architectures (such as X86 and ARM).
[0024] The specific embodiments of the present invention will be described in detail below.
[0025] Example 1: In one specific embodiment of the present invention, the method can be applied to desktop applications that need to process local data, generate standardized reports, and require operation in a multi-platform environment, such as enterprise internal reporting systems, industrial control data acquisition and analysis software, etc.
[0026] Step 1: Client-side development and data management mechanism establishment First, the client application is built. To achieve cross-platform compatibility, this embodiment preferably uses the Java language and the Swing graphical user interface (GUI) toolkit for development. Java's "compile once, run anywhere" feature provides a fundamental guarantee for cross-platform deployment, while Java Swing, as a mature GUI framework, can provide consistent interface performance and user experience on Windows, macOS, and domestic operating systems such as Kylin and UnionTech UOS without modifying the code.
[0027] On the client side, XML (Extensible Markup Language) files are used as the core data storage medium. XML files have advantages such as clear structure, strong self-description, and ease of parsing and extension, making them ideal as a lightweight alternative to local databases. The application predefines the XML data structure (Schema) according to business needs, for example: <projectdata> <projectinfo> <projectname> Project A< / projectname> <projectid> P001< / projectid> <analyst> Zhang Jie< / analyst> < / projectinfo> <sensitivedata> <!-- encrypted data --> <coreparameter> ENCRYPTED_STRING_XYZ< / coreparameter> < / sensitivedata> <analysisresults> <resultitem id="1"> ...< / resultitem> <resultitem id="2"> ...< / resultitem> < / analysisresults> < / projectdata> Subsequently, a two-way data binding is established between UI components (such as text boxes, drop-down lists, and tables) in the client interface and data fields in the XML file. This mechanism is crucial for achieving data synchronization and UI responsiveness. The specific implementation includes: 1. Data Loading from XML to the Interface: When the application starts or opens a project file, the XML file content is read using Java's DOM (Document Object Model) or SAX (Simple API for XML) parser, and the parsed data is populated into the corresponding Swing components. For example, ... <projectname>The text "Project A" within the label is displayed in a text box named projectNameTextField.
[0028] 2. Data synchronization from UI to XML: Add listeners (such as DocumentListener or FocusListener) to UI components (such as JTextField). When the user modifies the content in the text box, the listener is triggered, and the program automatically writes the updated data to the corresponding node in the XML file. This ensures that any changes made by the user on the UI are persisted in real time and accurately.
[0029] This two-way binding eliminates the need for developers to write cumbersome data reading, writing, and synchronization code, simplifying the development logic.
[0030] To improve data retrieval efficiency, this embodiment also introduces XPath (XML Path Language). When querying specific data, XPath expressions can be used directly for location instead of traversing the entire DOM tree. For example, to obtain the project ID, the expression / ProjectData / ProjectInfo / ProjectID can be used directly, which can significantly improve query performance when processing large or complex XML files.
[0031] Step Two: Encryption of Sensitive Data Data security is paramount when handling sensitive information involving corporate secrets or personal privacy. This embodiment uses a national cryptographic algorithm to encrypt preset sensitive fields in the XML file. The national cryptographic algorithm is a domestically developed commercial cryptographic algorithm recognized by the State Cryptography Administration, possessing high security and compliance.
[0032] Specifically, when building the data model, it is possible to identify which fields are considered sensitive fields, such as in the XML example above. <coreparameter>When data needs to be written into an XML file: 1. The program obtains the plaintext data for that field.
[0033] 2. Call the national secret algorithm library (such as using SM4 block cipher algorithm) to generate a key.
[0034] Use the key to encrypt the plaintext data to generate a ciphertext string (such as ENCRYPTED_STRING_XYZ).
[0035] 4. Store the ciphertext string in the XML file.
[0036] When the sensitive data needs to be read from the XML file and displayed, the reverse decryption operation is performed. In this way, even if the XML file is illegally obtained, the core sensitive information cannot be directly read because it is encrypted, effectively ensuring data security.
[0037] Step three: PDF file generation with Chinese font embedding One of the core functions of this embodiment is to generate standardized report documents. When the user clicks the "Generate Report" button, triggering the PDF generation instruction, the system performs the following operations: 1. Load the PDF template: The system will predefine a PDF template file. This template is a PDF document with a well-designed layout, header and footer, company logo, etc., but in the places where data needs to be filled in, special field identifiers (FieldIdentifier) are reserved. For example, in the place where the project name needs to be displayed, the template may contain a text field named {projectName}.
[0038] 2. Data filling: This embodiment uses mature PDF processing libraries (such as the open-source Apache PDFBox or the commercial library Aspose.Words) to manipulate PDF. The program reads the current project's XML data file, then iterates through all the field identifiers in the PDF template, filling the corresponding data in XML into the corresponding positions. For example, find the {projectName} field and replace it with "Project A" in XML.
[0039] 3. Chinese font embedding: This is the key step to solve the cross-platform display problem. When generating the final PDF file, the program will detect whether the report content contains Chinese characters. If it does, it will obtain a specified Chinese font file (such as simsun.ttc, msyh.ttf, etc.) from the application's local resource directory or the operating system's font library, and embed the subset of the font file (containing only the characters used in the document) or the complete font file into the target PDF file.
[0040] By embedding fonts in the PDF, the PDF file itself becomes "self-contained". No matter which operating system (Windows, Kylin, UOS, etc.) it is opened on, whether the system has installed the required Chinese font, the PDF reader can use the embedded font to correctly render the text, thus fundamentally eliminating the problem of Chinese characters being displayed as garbage or replaced by inappropriate fonts, ensuring the professionalism and consistency of the report.
[0041] Step four: automated build and multi-platform package generation In order to realize convenient deployment, the embodiment adopts an automated build tool, preferably Maven. By making a delicate configuration in the pom.xml file, the generation of installation packages for different target platforms can be realized.
[0042] 1. Configure multi-platform build Profile: Set different build Profiles in Maven, such as windows-x86, linux-arm64, etc. Each Profile defines the plugins and dependencies required for a specific platform.
[0043] 2. Generate Windows installation package: For Windows platform, use tools such as launch4j-maven-plugin or jpackage to package the compiled Java program (JAR package) with a specific version of JRE (Java Runtime Environment) into an.EXE format installation package. The advantage of this is that users do not need to pre-install Java environment, and after downloading, they can directly one-key installation, and the program can run. The installation package can also be configured to write to the registry, create desktop shortcuts, etc.
[0044] 3. Generate installation package for domestic operating system: For Kylin, UOS, etc. based on Linux, use jdeb or similar plugins to package the program into a.DEB format installation package. The installation package will automatically handle dependencies (such as declaring dependencies on specific system libraries), and place the program files in the standard directory (such as / opt) when installing, and create a launcher (.desktop file) in the application menu.
[0045] 4. Support different hardware architectures: Due to the platform independence of Java, the same set of Java source code does not need to be modified. When building, only need to specify the use of corresponding JDK and packaging plugin configuration for different hardware architectures (such as X86_64, ARM64), you can generate installation packages that can run natively on the corresponding architecture.
[0046] Through this automated process, developers only need to maintain one code base, and by executing different Maven commands, they can quickly generate installers for multiple operating systems and hardware architectures that can be directly distributed to end users, greatly reducing the complexity and maintenance cost of multi-platform adaptation.
[0047] Optional optimization step: differential backup To further improve user experience and data security, the method can also include the function of performing differential backup on the XML file. When the user performs the save or backup operation, the system does not copy the entire XML file completely, but only records and backs up the data nodes or contents that have changed by comparing with the previous version. This can significantly reduce the size of the backup file and the time required for backup, especially suitable for scenarios with large data volume and frequent updates.
[0048] Embodiment 2: According to another aspect of the present application, a cross-platform desktop application development system is provided for implementing the above method. As shown in Figure 1 The system includes: Data management module 1: This module is the core data hub of the system. It is responsible for implementing all data-related operations locally on the client. Specific functions include: Using XML files as data storage carriers, responsible for the creation, reading and writing of XML files.
[0049] Implementing bidirectional data binding logic between client interface components (such as Swing components) and XML file data fields, ensuring real-time synchronization of data.
[0050] Integrating national encryption algorithm (such as SM4) encryption engine, encrypting pre-set sensitive fields before writing to XML, and decrypting when reading, ensuring data storage security.
[0051] Providing a fast data retrieval interface based on XPath.
[0052] PDF generation module 2: This module responds to the user's PDF generation instruction and is responsible for creating high-quality, consistent display report documents. Specific functions include: Load the pre-set PDF template file.
[0053] Call the data management module to obtain the XML data of the current project.
[0054] Parse the PDF template, locate the domain identifiers, and fill in the data obtained from the XML.
[0055] The font embedding operation is performed, in particular, the local Chinese font is embedded into the finally generated target PDF file, and the correctness of cross-platform display is ensured.
[0056] Application deployment module 3: this module is used in the development stage, and is responsible for packaging the entire client program and its dependent environment into a distributable installation package. The specific functions include: Based on the configuration of the build tool (such as Maven), the project dependencies and the build process are managed.
[0057] Call the packaging tool of the specific platform (such as jpackage, jdeb), and generate the corresponding installation package (such as EXE format, DEB format) according to the target operating system (Windows, domestic system) and hardware architecture (X86, ARM).
[0058] The modules of the system work cooperatively, and the whole process from development, data processing, report generation to final deployment is realized completely, and an efficient, safe and reliable cross-platform desktop application solution is provided.
[0059] Embodiment 3: The application also provides a computer readable storage medium, which stores a computer program. The computer program is executed by a processor to realize all or part of the steps of the cross-platform desktop application development method in the above embodiment one. The storage medium can be any type of physical device, such as read-only memory (ROM), random access memory (RAM), solid state disk (SSD), optical disc or magnetic tape, etc.
[0060] In summary, the application integrates Java cross-platform technology, localized XML data management, national secret level security encryption and key font embedded PDF generation technology, and combines with modern automatic build tool chain, effectively solves the technical pain points of strong platform dependence, high development and maintenance cost, difficult to guarantee data security and document display consistency in traditional desktop application development, especially in the background of domestic substitution, provides a valuable solution for developing desktop application programs that can run seamlessly on multiple operating systems and hardware architectures.
[0061] The above only describes the preferred embodiments of the application and is not intended to limit the application. For those skilled in the art, the application can have various modifications and changes. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the application shall be included in the protection scope of the application.< / coreparameter> < / projectname>
Claims
1. A cross-platform desktop application development method, characterized in that, Includes the following steps: On the client side, an XML file is used as the data storage medium, and a two-way data binding is established between the interface components in the client interface and the data fields in the XML file. The preset sensitive fields in the XML file are encrypted using the national cryptographic algorithm; In response to the PDF generation instruction, a target PDF file is generated based on a preset PDF template and the data in the XML file, and local Chinese fonts are embedded into the target PDF file; Based on the build tool, the client program and its dependent environment are packaged into an installation package suitable for at least two different operating systems and different hardware architectures.
2. The method according to claim 1, characterized in that, The two-way data binding between the interface components in the client interface and the data fields in the XML file includes: When the data of the interface component is updated, the updated data is automatically synchronized to the corresponding data field in the XML file; and / or, When the data in the XML file changes, the display content of the interface components is automatically updated.
3. The method according to claim 1, characterized in that, The method further includes: XPath expressions are used to retrieve data from the XML file to improve data query efficiency.
4. The method according to claim 1, characterized in that, The steps for generating the target PDF file include: The preset field identifier is located in the PDF template, and the corresponding data from the XML file is filled into the position of the field identifier.
5. The method according to claim 1, characterized in that, The method further includes: The client interface is built based on a graphical user interface framework, and a layout manager is used to build a responsive interface so that the client interface can automatically adjust the component layout according to the display resolution.
6. The method according to claim 5, characterized in that, The method further includes: By registering listeners for the interface components, the validity of the input fields in the interface components can be verified in real time.
7. The method according to claim 1, characterized in that, The build tool is Maven; the installation package includes an EXE format installation package for Windows operating systems and a DEB format installation package for domestic operating systems.
8. The method according to claim 1, characterized in that, The method further includes: Perform a differential backup on the XML file, backing up only the data content in the XML file that has changed during the backup operation.
9. A cross-platform desktop application development system, characterized in that, include: The data management module (1) is used to use an XML file as a data storage carrier on the client local, and to establish a two-way data binding between the interface components in the client interface and the data fields in the XML file, and to encrypt the preset sensitive fields in the XML file using the national cryptographic algorithm. The PDF generation module (2) is used to respond to the PDF generation instruction, generate a target PDF file based on the preset PDF template and the data in the XML file, and embed local Chinese fonts into the target PDF file; The application deployment module (3) is used to package the client program and its dependent environment into an installation package suitable for at least two different operating systems and different hardware architectures based on the build tool.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Method, apparatus, electronic device and computer-readable medium for automatically generating interface
CN109101304A
XML-based data association method and device, server and storage medium
CN110889013A
PDF document generation method and device and electronic equipment
CN111881650A
Cross-platform APP construction method, device and system and medium
CN113778405A
Sorting-based generated pdf file size optimization method and system
CN115358194A