Data rendering method and system, and electronic device and storage medium
By generating tag files in Json data format and calling the data converter and renderer, the display mode is determined according to the application scenario, which solves the problem of a single rendering method in the existing technology, realizes support for multiple rendering methods, meets the needs of different scenarios and Reduced development costs.
Patent Information
- Application Number
- PCT/CN2023/105734
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-04-18
- Filing Date
- 2023-07-04
- Publication Date
- 2024-10-24
AI Technical Summary
The rendering method of existing label printing software is relatively single and cannot meet the needs of different application scenarios, resulting in high development costs and the need to develop separate programs for different rendering methods.
Provide a data rendering method that generates tag files in Json data format by obtaining the tag editing information input by the user, determines the display mode according to the application scenario, and calls the corresponding data converter and renderer for rendering. It supports multiple rendering methods, including Top-down adaptive layout and display of position-based layout information.
It realizes the determination of the label display mode according to the application scenario, supports multiple rendering methods, meets the rendering needs of different application scenarios, reduces development costs, and improves the flexibility and efficiency of rendering.
Smart Images

Figure CN2023105734_24102024_PF_FP_ABST
Abstract
Description
Data rendering method, system, electronic device and storage medium Technical Field
[0001] The present invention belongs to the field of computers, and more specifically, relates to a data rendering method, system, electronic device and storage medium. Background Art
[0002] Labels refer to the text, graphics, and other descriptive materials on products. Labels are widely used in retail, industrial production, express delivery, apparel, and office management. Examples include price tags, product description labels, shelf labels, barcode labels, clothing labels, document labels, archive labels, various item and stationery labels, and express delivery labels. Users can edit labels using the label printing software that comes with the label maker and then send them to the label maker for printing.
[0003] Most label printing software currently available uses HTML technology as the standard for multi-client rendering, or uses the Markdown document format for cross-client rendering. This technology is relatively mature, versatile, and easy to transfer. However, its single rendering method cannot meet the needs of users in some scenarios. It requires developing separate programs for different rendering methods, which is costly.
[0004] Summary of the Invention
[0005] In view of the shortcomings of the existing technology, the present invention provides a data rendering method, system, electronic device and storage medium, which can meet the rendering requirements in different application scenarios.
[0006] To achieve the above-mentioned object, according to one aspect of the present invention, there is provided a method for obtaining tag editing information input by a user, generating a tag file based on the Json data format according to the tag editing information, wherein the tag file includes editing information of a plurality of content blocks, and the editing information includes position layout information of the content blocks;
[0007] Determine a label display mode according to an application scenario, wherein the label display mode is one of a first display mode and a second display mode, wherein the first display mode displays the content blocks in the label file in a top-down adaptive layout in a display window, and the second display mode displays the content blocks in the label file based on the position layout information;
[0008] If the label display mode is the first display mode, the position layout information in the label file is deleted and the remaining data of the label file is rendered. If the label display mode is the second display mode, the label file is rendered.
[0009] Furthermore, before rendering, it is determined whether the remaining data of the tag file or the tag file needs to be format converted according to the current application scenario. If format conversion is required, the corresponding data converter is called to perform format conversion, and the format-converted data is rendered.
[0010] Furthermore, if the label display mode is the first display mode, calling the corresponding data converter to perform format conversion includes the steps of:
[0011] Pre-configuring a first data converter and a second data converter, wherein the first data converter is used to convert the tag file into HTML format, and the second data converter is used to convert the tag file into Markdown format;
[0012] If it is necessary to convert the remaining data of the tag file or the tag file into HTML format, calling the first data converter;
[0013] If it is necessary to convert the remaining data of the tag file or the tag file into Markdown format, the second data converter is called.
[0014] Furthermore, the calling of the corresponding data converter for format conversion includes the steps of:
[0015] A standard data interface for adding a customized third data converter is provided, and format conversion is performed based on the standard data interface.
[0016] Furthermore, the tag file includes multiple content blocks, the first data converter defines a function for converting each content block into HTML format, and the second data converter defines a function for converting each content block into Markdown format.
[0017] Furthermore, rendering the remaining data of the tag file or the tag file includes the steps of:
[0018] A first renderer, a second renderer, and a third renderer are pre-configured, wherein the first renderer is used for rendering based on a data protocol specification on an application side of a mobile device, the second renderer is used for rendering based on a data protocol specification on an applet side of a mobile device, and the third renderer is used for rendering based on a data protocol specification on a web page side; any one of the first renderer, the second renderer, and the third renderer is called for rendering according to the current application scenario.
[0019] Furthermore, determining the label display mode according to the application scenario includes: if the current application scenario is the drawing board editing mode, determining the label display mode to be the second display mode.
[0020] According to a second aspect of the present invention, there is provided a data rendering system for tag editing and display, comprising:
[0021] A generation module is used to obtain tag editing information input by the user and generate a tag file based on the Json data format according to the tag editing information. The tag file includes editing information of several content blocks, and the editing information includes position layout information of the content blocks;
[0022] a determination module, configured to determine a label display mode according to an application scenario, wherein the label display mode is one of a first display mode and a second display mode, wherein the first display mode displays the content blocks in the label file in a top-down adaptive layout in a display window, and the second display mode displays the content blocks in the label file based on the position layout information;
[0023] A rendering module is used to render according to the label display mode. If the label display mode is the first display mode, the position layout information in the label file is deleted and the remaining data of the label file is rendered. If the label display mode is the second display mode, the label file is rendered.
[0024] According to a third aspect of the present invention, an electronic device is provided, comprising at least one processing unit and at least one storage unit, wherein the storage unit stores a computer program, and when the computer program is executed by the processing unit, the processing unit performs the steps of any data rendering method.
[0025] According to a fourth aspect of the present invention, a storage medium is provided, which stores a computer program executable by an access authentication device, and when the computer program is run on the access authentication device, the access authentication device executes the steps of any data rendering method.
[0026] In general, compared with the existing technology, the above technical solutions conceived by the present invention can achieve the following beneficial effects: it has a variety of different rendering methods, can determine the label display mode according to the application scenario, perform corresponding processing according to the label display mode and then perform rendering processing, and can be displayed according to the corresponding label display mode after rendering processing. Among them, the label display mode supports "adaptive layout display of content blocks in the label file from top to bottom in the display window" and also supports "display based on position layout information", which can meet the rendering requirements in different application scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] FIG1 is a flow chart of a data rendering method according to an embodiment of the present invention;
[0028] FIG2 is a schematic diagram of an interface of a first display mode according to an embodiment of the present invention;
[0029] FIG3 is a schematic diagram of an interface of a second display mode according to an embodiment of the present invention;
[0030] FIG4 is a schematic diagram of a data rendering system according to an embodiment of the present invention. DETAILED DESCRIPTION
[0031] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely for the purpose of explaining the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below may be combined with each other as long as they do not conflict with each other.
[0032] In the description of the embodiments of this application, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly specifying the number of the technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of such features. "Multiple" means at least two, for example, two, three, etc., unless otherwise specifically defined.
[0033] The terms "including" and "having" and any variations thereof in the embodiments of the present invention are intended to cover non-exclusive inclusions. For example, a process, method, apparatus, product or device comprising a series of steps or modules is not necessarily limited to those steps or modules explicitly listed, but may include other steps or modules not explicitly listed or inherent to these processes, methods, products or devices.
[0034] The naming or numbering of the steps in the embodiments of the present invention does not mean that the steps in the method flow must be executed in the time / logical sequence indicated by the naming or numbering. The execution order of the named or numbered process steps can be changed according to the technical purpose to be achieved, as long as the same or similar technical effects can be achieved.
[0035] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present invention. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute a separate or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0036] The present invention provides a data rendering method, system, electronic device and storage medium, which are described below respectively.
[0037] As shown in FIG1 , a data rendering method for tag editing and display according to an embodiment of the present invention includes steps S101 to S103 .
[0038] S101, obtaining tag editing information input by a user, and generating a tag file based on the Json data format according to the tag editing information. The tag file includes editing information of several content blocks, and the editing information includes position layout information of the content blocks.
[0039] Users can use the label printing software that comes with the label machine to edit labels, such as inserting titles, texts, pictures, lists, links, videos, etc. in the editing interface.
[0040] Content blocks are editable, insertable objects described by predefined data structures. In this embodiment of the present invention, user-inserted titles, text, images, lists, links, and videos can be used as title content blocks, text content blocks, image content blocks, list content blocks, link content blocks, and video content blocks, respectively. The data structure for each type of content block is predefined, and the editing information for each content block is recorded in a tag file according to the predefined data structure. For example, for a text content block, the editing information for the text content block includes the specific text content of the text content block and the location and layout information of the content block.
[0041] The position layout information may include the coordinates, width, height, rotation angle, etc. of the text content block.
[0042] S102, determining a label display mode according to an application scenario, wherein the label display mode is either a first display mode or a second display mode. The first display mode is to adaptively display the content blocks in the label file in a top-down layout in a display window, and the second display mode is to display the content blocks in the label file based on position layout information.
[0043] The label display mode supports "adaptively displaying the content blocks in the label file from top to bottom in the display window." As shown in Figure 2, the title, text, and image content blocks are adaptively displayed from top to bottom in the display window. In this example, the width of the content blocks matches the width of the display window, and the height is adaptively adjusted.
[0044] Tabbed display mode also supports position-based layout information display, known as WYSIWYG mode. As shown in Figure 3, each content block can be freely placed anywhere on the page. The width, height, position, and rotation of each content block are user-configurable, meaning the display in the display window remains consistent with the user's settings.
[0045] The label display mode is determined based on the application scenario. For example, if the application scenario is a canvas editing mode, such as the canvas editing mode built using Flutter, Google's open source user interface toolkit, the label display mode is determined to be the second display mode. For example, if the application scenario requires improving the convenience of user label editing operations and other design requirements are not high, the first display mode can be used. The application scenarios are not listed here.
[0046] At step S103, if the label display mode is the first display mode, the position layout information in the label file is deleted and the remaining data in the label file is rendered. If the label display mode is the second display mode, the label file is rendered. If the label display mode is the second display mode, the display on the display window must be consistent with the user's settings, so the position layout information such as coordinates, width and height must be retained in the label file.
[0047] When the label display mode is determined to be the first display mode, the coordinates, width, height and other position layout information in the label file will be ignored, and less data will be transmitted to the renderer.
[0048] Rendering refers to processing input data to display it on the interface.
[0049] In this way, the present invention can determine the label display mode according to the application scenario and perform rendering processing according to the label display mode. The label display mode supports "adaptive layout display of content blocks in the label file from top to bottom in the display window" and also supports "display based on position layout information", which can meet the rendering requirements in different application scenarios.
[0050] Furthermore, before rendering, it is determined whether the remaining data of the label file or the label file needs to be format converted according to the current application scenario. If format conversion is required, the corresponding data converter is called to perform format conversion and the format-converted data is rendered.
[0051] The data formats supported by the renderer are different in different application scenarios. For example, if rendering is performed on the browser side, the renderer generally only supports the HTML format. Therefore, the data to be rendered needs to be converted into the required format before rendering.
[0052] Furthermore, if the label display mode is the first display mode, calling the corresponding data converter to perform format conversion includes the following steps:
[0053] A first data converter and a second data converter are pre-configured, the first data converter is used to convert the tag file into HTML format, and the second data converter is used to convert the tag file into Markdown format; if the remaining data of the tag file or the tag file needs to be converted into HTML format, the first data converter is called; if the remaining data of the tag file or the tag file needs to be converted into Markdown format, the second data converter is called.
[0054] In the present invention, by pre-configuring a first data converter and a second data converter, conversion between the general solution HTML technology or Markdown technology can be achieved. Furthermore, the tag file includes multiple content blocks, the first data converter defines a function for converting each content block into HTML format, and the second data converter defines a function for converting each content block into Markdown format.
[0055] For example, if the user is supported to insert titles, texts, pictures, lists, links, videos, etc. when editing a label, the label file may contain a title content block, a text content block, a picture content block, a list content block, a link content block, and a video content block, and each content block is stored in a predefined data structure. The first data converter defines corresponding functions for each content block.
[0056] For example, if a multi-level title data structure is used for the title content block in the tag file, a field is used to identify the level of the title, such as a first-level title, a second-level title, a third-level title, etc., and another field is used to identify the specific text content of the title, then the multi-level title of the title content block is converted into multiple lines of HTML text in the first data converter, and each line corresponds to the specific text content of a title.
[0057] Furthermore, calling the corresponding data converter to perform format conversion includes the following steps:
[0058] A standard data interface for adding a customized third data converter is provided, and format conversion is performed based on the standard data interface.
[0059] In other words, by providing a standard data interface and supporting custom data converters, the renderer can customize the corresponding data converter to convert the data to be rendered into the required data format. The data converter can specifically be a functional function.
[0060] Furthermore, a fourth data converter and a fifth data converter may be pre-configured. The fourth data converter is used to convert a content block in HTML format into a content block in Json format with a predefined data structure. The fifth data converter is used to convert a content block in Markdown format into a content block in Json format with a predefined data structure. In step S101, if the tag editing information input by the user includes content based on HTML format, the fourth data converter is called to generate a tag file. If the tag editing information input by the user includes content based on Markdown format, the fifth data converter is called to generate a tag file.
[0061] Furthermore, rendering the remaining data of the tag file or the tag file includes the following steps:
[0062] The first renderer, the second renderer and the third renderer are pre-configured. The first renderer is used for rendering based on the data protocol specification of the mobile device application side, the second renderer is used for rendering based on the data protocol specification of the mobile device mini-program side, and the third renderer is used for rendering based on the data protocol specification of the web page side. Any one of the first renderer, the second renderer and the third renderer is called for rendering according to the current application scenario.
[0063] For example, if a user edits and displays tags on a mobile device, rendering is based on the Android or iOS data protocol specifications. If a user edits and displays tags on a web page, rendering is based on the web page data protocol specifications. Rendering settings, such as display clarity, are also adjusted based on the application scenario.
[0064] A data rendering system for tag editing and display according to an embodiment of the present invention includes:
[0065] The generation module 201 is used to obtain the tag editing information input by the user and generate a tag file based on the Json data format according to the tag editing information. The tag file includes the editing information of several content blocks, and the editing information includes the position layout information of the content blocks;
[0066] Determining module 202, determining a label display mode according to an application scenario, wherein the label display mode is one of a first display mode and a second display mode, wherein the first display mode displays content blocks in a label file in a top-down adaptive layout in a display window, and the second display mode displays content blocks in the label file based on position layout information;
[0067] The rendering module 203 is used to render according to the label display mode. If the label display mode is the first display mode, the position layout information in the label file is deleted and the remaining data of the label file is rendered. If the label display mode is the second display mode, the label file is rendered.
[0068] The principle and effect of the data rendering system are the same as those of the above-mentioned data rendering method, and will not be described in detail here.
[0069] The present application also provides an electronic device, comprising at least one processing unit and at least one storage unit, wherein the storage unit stores a computer program, and when the computer program is executed by the processing unit, the processing unit performs the steps of the above-mentioned data rendering method.
[0070] The present application also provides a storage medium storing a computer program executable by an access authentication device, wherein when the computer program is executed on the access authentication device, the access authentication device implements the steps of the above-mentioned data rendering method. The storage medium may include, but is not limited to, any type of disk, including a floppy disk, an optical disk, a DVD, a CD-ROM, a micro drive, a magneto-optical disk, a ROM, a RAM, an EPROM, an EEPROM, a DRAM, a VRAM, a flash memory device, a magnetic card or an optical card, or any type of medium or device suitable for storing instructions and / or data.
[0071] It will be easily understood by those skilled in the art that the above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A data rendering method for label editing and display, characterized in that: Includes steps: Acquire the tag editing information input by the user, and generate a tag file based on the Json data format according to the tag editing information, wherein the tag file includes the editing information of several content blocks, and the editing information includes the position layout information of the content blocks; Determine a label display mode according to an application scenario, wherein the label display mode is one of a first display mode and a second display mode, wherein the first display mode is to display the content blocks in the label file in a top-down adaptive layout in a display window, and the second display mode is to display the content blocks in the label file based on the position layout information; If the label display mode is the first display mode, the position layout information in the label file is deleted and the remaining data of the label file is rendered. If the label display mode is the second display mode, the label file is rendered.
2. The data rendering method according to claim 1, characterized in that: Before rendering, determine whether the remaining data of the label file or the label file needs to be format converted according to the current application scenario. If format conversion is required, call the corresponding data converter to perform format conversion and render the data after format conversion.
3. The data rendering method according to claim 2, characterized in that: If the label display mode is the first display mode, calling the corresponding data converter to perform format conversion includes the steps of: Preconfiguring a first data converter and a second data converter, wherein the first data converter is used to convert the tag file into an HTML format, and the second data converter is used to convert the tag file into a Markdown format; If it is necessary to convert the remaining data of the tag file or the tag file into HTML format, calling the first data converter; If it is necessary to convert the remaining data of the tag file or the tag file into Markdown format, the second data converter is called.
4. The data rendering method according to claim 3, characterized in that: The calling of the corresponding data converter for format conversion comprises the steps of: A standard data interface for adding a customized third data converter is provided, and format conversion is performed based on the standard data interface.
5. The data rendering method according to claim 3, characterized in that: The tag file includes multiple content blocks, the first data converter defines a function for converting each content block into HTML format, and the second data converter defines a function for converting each content block into Markdown format.
6. The data rendering method according to claim 1, characterized in that: Rendering the remaining data of the tag file or the tag file comprises the steps of: Preconfigure a first renderer, a second renderer, and a third renderer, wherein the first renderer is used for rendering based on a data protocol specification on a mobile device application side, the second renderer is used for rendering based on a data protocol specification on a mobile device mini-program side, and the third renderer is used for rendering based on a data protocol specification on a web page side; Any one of the first renderer, the second renderer, and the third renderer is called to perform rendering according to a current application scenario.
7. The data rendering method according to claim 1, characterized in that: The step of determining the label display mode according to the application scenario includes the following steps: if the current application scenario is the drawing board editing mode, determining the label display mode to be the second display mode.
8. A data rendering system for label editing and display, characterized in that: include: A generation module, used to obtain the tag editing information input by the user, and generate a tag file based on the Json data format according to the tag editing information, wherein the tag file includes the editing information of several content blocks, and the editing information includes the position layout information of the content blocks; The determination module is used to determine the label display mode according to the application scenario, and the label display mode is one of the first display mode and the second display mode. The first display mode is to display the content blocks in the label file in a top-down adaptive layout in the display window, and the second display mode is to display the content blocks in the label file in a top-down adaptive layout in the display window. The content blocks in the tag file are displayed based on the position layout information; A rendering module is used to render according to the label display mode. If the label display mode is the first display mode, the position layout information in the label file is deleted and the remaining data of the label file is rendered. If the label display mode is the second display mode, the label file is rendered.
9. An electronic device, characterized in that: The method comprises at least one processing unit and at least one storage unit, wherein the storage unit stores a computer program, and when the computer program is executed by the processing unit, the processing unit executes the steps of the method according to any one of claims 1 to 7.
10. A storage medium, characterized in that: It stores a computer program executable by an access authentication device. When the computer program runs on the access authentication device, the access authentication device executes the steps of the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
JavaScript rendering method and apparatus
CN105404514A
Label display method, intelligent terminal and storage medium
CN113986059A
Label generating and printing method and device and storage medium
CN115660012A
Data rendering method and system, electronic equipment and storage medium
CN116151191A
Program for creating label and information processing device
JP2022152756A
