Self-adaptive adjustment method and device for size of ticket printing template
By adopting relative layout and relative unit settings in the printing template, adaptively adjusting the size and position of ticket content, the problem of low printing efficiency of tickets of different sizes is solved, and efficient adaptive adjustment of printing templates is achieved.
Patent Information
- Application Number
- CN202510312652.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-17
- Publication Date
- 2025-07-11
AI Technical Summary
In the prior art, inconsistent size of conference tickets results in the need to adjust the printing template for each meeting, resulting in inefficient printing.
Use relative layout to define the parent container and child elements in the printing template, use relative units to set the adjustment ratio of font size and image size to paper size, and adjust the print content adaptively according to the ticket information to be printed.
It improves the adaptive adjustment efficiency of the printing template, saves time for each adjustment, and improves the stability and working efficiency of the OMO system.
Smart Images

Figure CN120295585A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of adaptive adjustment of printing templates, and more specifically, to a method and device for adaptively adjusting the size of a ticket printing template. Background Art
[0002] With the increase in meetings, printing meeting tickets has also become a demand for people. Nowadays, when the OMO system signs in for participating users, it will print a participating ticket for the user. Since the sizes of participating tickets for different meetings are inconsistent, every time a meeting is held, the code needs to be adjusted to adjust the adaptation position of the content in the ticket and then print the ticket, resulting in the technical problem of low ticket printing efficiency. Summary of the Invention
[0003] In view of the deficiencies of the prior art, the present invention provides a method and device for adaptively adjusting the size of a ticket printing template.
[0004] According to one aspect of the present invention, there is provided a method for adaptively adjusting the size of a ticket printing template, including:
[0005] Defining the parent container and child elements in the printing template by using a relative layout method to generate a printing template;
[0006] Setting the adjustment ratio of the font size and image size to the paper size by using relative units;
[0007] Printing the ticket to be printed based on the ticket information to be printed, the printing template, and the adjustment ratio.
[0008] Optionally, defining the parent container and child elements in the printing template by using a relative layout method to generate a printing template includes:
[0009] Setting the width of the pre-constructed parent container to 100%;
[0010] Setting the width of the pre-constructed child element to a preset percentage;
[0011] Determining a relative ratio based on the preset percentage to generate a printing template.
[0012] Optionally, printing the ticket to be printed based on the ticket information to be printed, the printing template, and the adjustment ratio includes:
[0013] Calculating the adjustment ratio according to the size of the background image, the desired font size, and the graphic size in the ticket information;
[0014] Traversing the text and images of the content in the ticket information, and setting each element by using the adjustment ratio to obtain the adjusted content;
[0015] Print the tickets to be printed according to the adjusted content and the print template.
[0016] Optionally, traverse the text and images in the ticket information, and set each element using the adjustment ratio to obtain the adjusted content, including:
[0017] For each text element traversed, calculate the new font size according to the adjustment ratio and apply it to the text element to obtain the adjusted text element;
[0018] For each image element traversed, calculate the new image size according to the adjustment ratio and apply it to the image element to obtain the adjusted image element;
[0019] Based on the adjusted text elements and image elements, obtain the adjusted content.
[0020] According to another aspect of the present invention, there is provided an adaptive adjustment device for the size of a ticket print template, including:
[0021] A generation module for defining the parent container and child elements in the print template in a relative layout manner to generate the print template;
[0022] A setting module for setting the adjustment ratio of the font size and image size to the paper size using relative units;
[0023] A printing module for printing the tickets to be printed based on the ticket information of the tickets to be printed, the print template, and the adjustment ratio.
[0024] According to still another aspect of the present invention, there is provided a computer-readable storage medium storing a computer program for executing the method described in any one of the above aspects of the present invention.
[0025] According to still another aspect of the present invention, there is provided an electronic device including: a processor; a memory for storing executable instructions of the processor; the processor for reading the executable instructions from the memory and executing the instructions to implement the method described in any one of the above aspects of the present invention.
[0026] Thus, the present invention defines the parent container and child elements in the print template in a relative layout manner to generate the print template; sets the adjustment ratio of the font size and image size to the paper size using relative units; and prints the tickets to be printed based on the ticket information of the tickets to be printed, the print template, and the adjustment ratio. This saves the time for adjusting the print template each time, greatly improving the work efficiency and the stability of the OMO system. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The exemplary embodiments of the present invention can be more fully understood by referring to the following accompanying drawings:
[0028] Figure 1 It is a schematic flowchart of a method for adaptively adjusting the size of a ticket printing template provided by an exemplary embodiment of the present invention;
[0029] Figure 2 It is a schematic structural diagram of a device for adaptively adjusting the size of a ticket printing template provided by an exemplary embodiment of the present invention;
[0030] Figure 3 It is the structure of an electronic device provided by an exemplary embodiment of the present invention. Detailed Embodiments
[0031] Next, exemplary embodiments of the present invention will be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments of the present invention. It should be understood that the present invention is not limited by the exemplary embodiments described herein.
[0032] It should be noted that: unless otherwise specifically stated, the relative arrangements, numerical expressions, and numerical values of the components and steps set forth in these embodiments do not limit the scope of the present invention.
[0033] Those skilled in the art can understand that terms such as "first", "second", etc. in the embodiments of the present invention are only used to distinguish different steps, devices, or modules, etc., and neither represent any specific technical meaning nor indicate an inevitable logical order between them.
[0034] It should also be understood that in the embodiments of the present invention, "a plurality" may refer to two or more, and "at least one" may refer to one, two, or more.
[0035] It should also be understood that for any component, data, or structure mentioned in the embodiments of the present invention, unless clearly defined or given a contrary indication in the context, it can generally be understood as one or more.
[0036] In addition, the term "and / or" in the present invention is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the character " / " in the present invention generally represents an "or" relationship between the associated objects before and after.
[0037] It should also be understood that the present invention emphasizes the differences between the various embodiments. The same or similar parts can be referred to each other. For the sake of brevity, they will not be described one by one.
[0038] Meanwhile, it should be understood that, for ease of description, the dimensions of the various parts shown in the drawings are not drawn in actual proportional relationship.
[0039] The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way a limitation on the present invention, its application, or its use.
[0040] Technologies, methods, and devices known to those of ordinary skill in the relevant art may not be discussed in detail, but where appropriate, the technologies, methods, and devices should be regarded as part of the specification.
[0041] It should be noted that like reference numerals and letters indicate like items in the following figures, and thus, once an item is defined in one figure, it need not be further discussed in subsequent figures.
[0042] Embodiments of the present invention can be applied to electronic devices such as terminal devices, computer systems, servers, etc., which can operate with numerous other general-purpose or special-purpose computing system environments or configurations. Examples of well-known terminal devices, computing systems, environments, and / or configurations suitable for use with terminal devices, computer systems, servers, etc. include, but are not limited to: personal computer systems, server computer systems, thin clients, thick clients, handheld or laptop devices, microprocessor-based systems, set-top boxes, programmable consumer electronics, network personal computers, minicomputer systems, mainframe computer systems, and distributed cloud computing technology environments including any of the above systems, and so on.
[0043] Terminal devices, computer systems, servers, etc. can be described in the general context of computer system-executable instructions (such as program modules) executed by a computer system. Generally, program modules can include routines, programs, object programs, components, logics, data structures, etc., which perform specific tasks or implement specific abstract data types. The computer system / server can be implemented in a distributed cloud computing environment where tasks are performed by remote processing devices linked through a communication network. In a distributed cloud computing environment, program modules can be located on local or remote computing system storage media including storage devices.
[0044] Exemplary method
[0045] Figure 1 It is a schematic flowchart of a method for adaptively adjusting the size of a ticket printing template provided by an exemplary embodiment of the present invention. This embodiment can be applied to an electronic device, such as Figure 1 As shown, the method 100 for adaptively adjusting the size of a ticket printing template includes the following steps:
[0046] Step 101: Define the parent container and child elements in the print template using relative layout to generate the print template.
[0047] Step 102: Set the adjustment ratios of the font size and image size to the paper size using relative units.
[0048] Step 103: Print the ticket to be printed based on the ticket information of the ticket to be printed, the print template, and the adjustment ratio.
[0049] Specifically, to solve the technical problems raised in the background art, the present application innovatively develops the adaptability of the ticket size, so that for each subsequent event, the ticket content can be automatically adjusted to fit the position according to the on-site ticket size. The specific implementation is as follows:
[0050] 1. Layout: When designing the print template, relative layout is used instead of absolute pixel point positioning. This can ensure that the output content can still be typeset according to the predetermined layout on papers of different sizes.
[0051] Innovative means: There is a parent container (`.container`) whose width is set to `100%`, indicating that it will occupy the entire available width. Then there is a child element (`.element`) whose width is set to `50%`, indicating that it will occupy half of the width of the parent container. Therefore, regardless of the width of your paper or screen, this child element will adaptively center and occupy half of the space in the parent container. This is because the width of the child element is calculated relative to the width of the parent container, so no matter how wide the parent container is, the width of the child element will be adjusted accordingly. This setting makes the child element always remain in the center position of the parent container, regardless of the width of the parent container. This adaptive layout method can ensure that the child element can be well adapted and centered on different devices and screen sizes.
[0052] 2. Content: The font size, image size, etc. of the content are adjusted according to the size of the paper. For example, you can use relative units such as em when designing the template, or directly use code to dynamically set the font size according to the paper size before printing.
[0053] (1) Calculate the adjustment ratio: Calculate the adjustment ratio according to the size of the background image and the desired font size, image size, etc. The ratio of the font size and image size can be adjusted as needed.
[0054] (2) Apply the adjustment ratio: Traverse the text and images in the content, and apply the adjustment ratio to each element to set the appropriate font size and image size. The font size and image size can be adjusted according to the size of the background image to ensure that they are suitable for display on the background image.
[0055] Get all the text elements and image elements in the content.
[0056] For each text element, calculate the new font size according to the adjustment ratio and apply it to the text element.
[0057] For each image element, calculate the new image size according to the adjustment ratio and apply it to the image element.
[0058] Repeat steps 2 and 3 until all text and image elements have been traversed.
[0059] The specific implementation steps may vary depending on the programming language and interface development tools used. The following is a pseudocode example of a possible implementation:
[0060] # Get all text elements and image elements
[0061] text_elements = get_text_elements(content)
[0062] image_elements = get_image_elements(content)
[0063] # Traverse text elements and apply the adjustment ratio to set the font size
[0064] for text_element in text_elements:
[0065] new_font_size = calculate_new_font_size(text_element, adjustment_ratio)
[0066] set_font_size(text_element, new_font_size)
[0067] # Traverse image elements and apply the adjustment ratio to set the image size
[0068] for image_element in image_elements:
[0069] new_image_size = calculate_new_image_size(image_element, adjustment_ratio)
[0070] set_image_size(image_element, new_image_size)
[0071] In the above example code, the functions get_text_elements() and get_image_elements() are used to obtain the text elements and image elements in the content. The functions calculate_new_font_size() and calculate_new_image_size() calculate the new font size and image size according to the adjustment ratio. The functions set_font_size() and set_image_size() are used to apply the calculated new font size and image size to the corresponding elements.
[0072] em: In CSS, 1em is equal to the current font size. If the font size is not set, the default size is usually 16px. Therefore, usually 1em == 16px. If you set the font size inside an element, then 1em inside that element is calculated according to the size you set.
[0073] For example, relative units can be used in the design of the printing template so that no matter how the size of the printing paper changes, the size of the text can maintain a consistent ratio.
[0074] Thus, the present invention defines the parent container and child elements in the printing template by using a relative layout method to generate a printing template; sets the adjustment ratio of the font size and image size to the paper size using relative units; and prints the ticket to be printed based on the ticket information of the ticket to be printed, the printing template, and the adjustment ratio. This saves the time for adjusting the printing template each time and greatly improves the work efficiency and the stability of the OMO system.
[0075] Exemplary device
[0076] Figure 2 FIG. is a schematic structural diagram of an adaptive adjustment device for the size of a ticket printing template provided by an exemplary embodiment of the present invention. As Figure 2 shown, the device 200 includes:
[0077] A generation module 210, configured to define the parent container and child elements in the printing template by using a relative layout method to generate a printing template;
[0078] A setting module 220, configured to set the adjustment ratio of the font size and image size to the paper size by using relative units;
[0079] A printing module 230, configured to print the ticket to be printed based on the ticket information of the ticket to be printed, the printing template, and the adjustment ratio.
[0080] Optionally, the generation module 210 includes:
[0081] The first setting sub-module is used to set the width of the pre-constructed parent container to 100%;
[0082] The second setting sub-module is used to set the width of the pre-constructed sub-elements to a preset percentage;
[0083] The generation sub-module is used to determine the relative ratio based on the preset percentage and generate a printing template.
[0084] Optionally, the printing module 230 includes:
[0085] The calculation sub-module is used to calculate the adjustment ratio according to the size of the background image, the desired font size and the graphic size in the ticket information;
[0086] The acquisition sub-module is used to traverse the text and images in the ticket information, set each element with the adjustment ratio, and obtain the adjusted content;
[0087] The printing sub-module is used to print the ticket to be printed according to the adjusted content and the printing template.
[0088] Optionally, the acquisition sub-module includes:
[0089] The first acquisition unit is used to calculate a new font size for each traversed text element according to the adjustment ratio and apply it to the text element to obtain the adjusted text element;
[0090] The second acquisition unit is used to calculate a new image size for each traversed image element according to the adjustment ratio and apply it to the image element to obtain the adjusted image element;
[0091] The third acquisition unit is used to obtain the adjusted content based on the adjusted text elements and image elements.
[0092] Exemplary electronic device
[0093] Figure 3 is the structure of an electronic device provided by an exemplary embodiment of the present invention. As Figure 3 shown, the electronic device 30 includes one or more processors 31 and a memory 32.
[0094] The processor 31 can be a central processing unit (CPU) or other forms of processing units with data processing capabilities and / or instruction execution capabilities, and can control other components in the electronic device to perform desired functions.
[0095] The memory 32 may include one or more computer program products, and the computer program products may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, random access memory (RAM) and / or cache memory, etc. The non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage media, and the processor 31 may run the program instructions to implement the methods of the software programs of the various embodiments of the present invention described above and / or other desired functions. In one example, the electronic device may further include: an input device 33 and an output device 34, and these components are interconnected through a bus system and / or other forms of connection mechanisms (not shown).
[0096] In addition, the input device 33 may further include, for example, a keyboard, a mouse, and so on.
[0097] The output device 34 may output various information to the outside. The output device 34 may include, for example, a display, a speaker, a printer, and a communication network and its connected remote output devices, etc.
[0098] Of course, for simplicity, Figure 3 only some of the components related to the present invention in the electronic device are shown, and components such as buses, input / output interfaces, etc. are omitted. In addition, according to specific application situations, the electronic device may further include any other appropriate components.
[0099] Exemplary computer program product and computer-readable storage medium
[0100] In addition to the above methods and devices, embodiments of the present invention may also be computer program products, which include computer program instructions that, when run by a processor, cause the processor to execute the steps in the methods according to various embodiments of the present invention described in the "Exemplary Methods" section above of this specification.
[0101] The computer program products may be written in any combination of one or more programming languages for programming code to perform the operations of the embodiments of the present invention. The programming languages include object-oriented programming languages, such as Java, C++, etc., and also include conventional procedural programming languages, such as the "C" language or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, executed as an independent software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0102] In addition, an embodiment of the present invention may also be a computer-readable storage medium storing computer program instructions, which, when run by a processor, cause the processor to execute the steps in the method for information mining of historical change records according to various embodiments of the present invention described in the above "Exemplary Method" section of this specification.
[0103] The computer-readable storage medium may employ any combination of one or more readable media. The readable media may be a readable signal medium or a readable storage medium. The readable storage medium may include, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0104] The basic principles of the present invention have been described above in conjunction with specific embodiments. However, it should be noted that the advantages, benefits, effects, etc. mentioned in the present invention are only examples and not limitations, and it cannot be considered that these advantages, benefits, effects, etc. are essential for each embodiment of the present invention. In addition, the above-disclosed specific details are only for illustrative purposes and for ease of understanding, and are not limitations. The above details do not limit the present invention to necessarily adopt the above specific details for implementation.
[0105] Each embodiment in this specification is described in a progressive manner. The key point of each embodiment is to illustrate the differences from other embodiments. The same or similar parts among the embodiments can be referred to each other. For system embodiments, since they basically correspond to method embodiments, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiments.
[0106] The block diagrams of the devices, systems, equipment, and systems involved in the present invention are only illustrative examples and do not intend to require or imply that they must be connected, arranged, and configured in the manner shown in the block diagrams. As those skilled in the art will recognize, these devices, systems, equipment, and systems can be connected, arranged, and configured in any manner. Words such as "including", "comprising", "having", etc. are open-ended terms, meaning "including but not limited to", and can be used interchangeably with each other. The words "or" and "and" used herein refer to the phrase "and / or" and can be used interchangeably with each other, unless the context clearly indicates otherwise. The word "such as" used herein refers to the phrase "such as but not limited to" and can be used interchangeably with each other.
[0107] The methods and systems of the present invention can be implemented in many ways. For example, the methods and systems of the present invention can be implemented by software, hardware, firmware, or any combination of software, hardware, and firmware. The above order of the steps for the method is for illustrative purposes only, and the steps of the method of the present invention are not limited to the order specifically described above, unless otherwise specifically stated. In addition, in some embodiments, the present invention can also be implemented as a program recorded in a recording medium, and these programs include machine-readable instructions for implementing the method according to the present invention. Therefore, the present invention also covers a recording medium storing a program for executing the method according to the present invention.
[0108] It should also be noted that in the systems, devices, and methods of the present invention, each component or each step can be decomposed and / or recombined. These decompositions and / or recombinations should be regarded as equivalent solutions of the present invention. The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein can be applied to other aspects without departing from the scope of the present invention. Therefore, the present invention is not intended to be limited to the aspects shown herein, but rather to the broadest scope consistent with the principles and novel features disclosed herein.
[0109] The above description has been given for purposes of illustration and description. In addition, this description is not intended to limit the embodiments of the present invention to the forms disclosed herein. Although multiple example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, alterations, additions, and subcombinations thereof.
Claims
1. An adaptive adjustment method for the size of a ticket printing template, characterized in that, Including: Define the parent container and child elements in the print template using a relative layout method to generate the print template; Set the adjustment ratios of the font size and image size to the paper size using relative units; Print the ticket to be printed based on the ticket information of the ticket to be printed, the print template, and the adjustment ratio.
2. The method according to claim 1, wherein Define the parent container and child elements in the print template using a relative layout method to generate the print template, including: Set the width of the pre-constructed parent container to 100%; Set the width of the pre-constructed child elements to a preset percentage; Determine the relative distance based on the preset percentage to generate the print template.
3. The method according to claim 1, wherein Print the ticket to be printed based on the ticket information of the ticket to be printed, the print template, and the adjustment ratio, including: Calculate the adjustment ratio according to the size of the background image, the desired font size, and the graphic size in the ticket information; Traverse the text and images in the content of the ticket information, set each element using the adjustment ratio to obtain the adjusted content; Print the ticket to be printed according to the adjusted content and the print template.
4. The method according to claim 3, characterized in that, Traverse the text and images in the content of the ticket information, set each element using the adjustment ratio to obtain the adjusted content, including: For each text element traversed, calculate the new font size according to the adjustment ratio and apply it to the text element to obtain the adjusted text element; For each image element traversed, calculate the new image size according to the adjustment ratio and apply it to the image element to obtain the adjusted image element; Obtain the adjusted content based on the adjusted text elements and image elements.
5. An adaptive adjustment device for the size of a ticket printing template, characterized in that, Including: A generation module for defining the parent container and child elements in the print template using a relative layout method to generate the print template; A setting module for setting the adjustment ratios of the font size and image size to the paper size using relative units; A printing module for printing the ticket to be printed based on the ticket information of the ticket to be printed, the print template, and the adjustment ratio.
6. The device according to claim 5, characterized in that, The generation module includes: A first setting sub-module for setting the width of the pre-constructed parent container to 100%; A second setting sub-module for setting the width of the pre-constructed child elements to a preset percentage; A generation sub-module for determining the relative distance based on the preset percentage to generate the print template.
7. The device according to claim 5, characterized in that, The printing module includes: A calculation sub-module for calculating the adjustment ratio according to the size of the background image, the desired font size, and the graphic size in the ticket information; An acquisition sub-module for traversing the text and images in the content of the ticket information, setting each element using the adjustment ratio to obtain the adjusted content; A printing sub-module for printing the ticket to be printed according to the adjusted content and the print template.
8. The device according to claim 7, characterized in that, The acquisition sub-module includes: A first acquisition unit for, for each text element traversed, calculating the new font size according to the adjustment ratio and applying it to the text element to obtain the adjusted text element; A second acquisition unit, configured to calculate a new image size according to a scaling ratio for each traversed image element, apply the new image size to the image element, and acquire the adjusted image element; A third acquisition unit, configured to acquire adjusted content based on the adjusted text element and image element; 9. A computer-readable storage medium, characterized in that, The storage medium stores a computer program, and the computer program is used to execute the method according to any one of claims 1-4 above.
10. An electronic device, characterized in that, The electronic device includes: A processor; A memory for storing executable instructions of the processor; The processor is configured to read the executable instructions from the memory and execute the instructions to implement the method according to any one of claims 1-4 above.
Citation Information
Patent Citations
Webpage self-adaptive layout method, server and computer readable storage medium
CN110837617A
Standard character printing method and device, storage medium and electronic equipment
CN116301671A
Page content processing method and device and electronic equipment
CN117009686A
Method and apparatus for printing web pages
CN1770089A
Variable print system
JP2010176366A