A method and system for realizing remote printing based on DeepLink technology
Patent Information
- Application Number
- CN202311562420.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-22
- Publication Date
- 2026-10-30
- Estimated Expiration
- 2043-11-22
AI Technical Summary
[0002]目前常用的打印设备体积普遍比较大,不方便携带或者移动位置;但是随着4G、5G网络的迅速普及和物联网的快速发展,出现了越来越多功能丰富多样,体积类似手机大小的易于随身携带的无线网络POS机打印设备,使得打印需求不再受场所的限制,这促进了移动打印业务的发展,实现了随时随地任何时候都可以打印小票或者发票
[0035]本发明的APP端与网站端不存在直接交互,两者之间的耦合度非常低,更方便各自后续的维护和升级。
Smart Images

Figure CN117632055B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of remote printing technology, specifically, it relates to a method and system for remote printing based on DeepLink technology. Background Technology
[0002] Currently, commonly used printing devices are generally bulky, making them inconvenient to carry or move. However, with the rapid popularization of 4G and 5G networks and the rapid development of the Internet of Things, more and more feature-rich, portable wireless network POS printing devices, similar in size to mobile phones, have emerged. This has removed location restrictions on printing needs, promoting the development of mobile printing services and enabling the printing of receipts or invoices anytime, anywhere. Banks and tax bureaus, after completing complex business workflows, need to print process forms or invoices for offline archiving or delivery. In some special cases, these forms and invoices need to be printed and delivered anytime, anywhere, but traditional printing methods cannot meet the demand due to location limitations. Therefore, the development of mobile printing services is also necessary. For example, a complex tax system originally deployed on a Windows desktop computer would require specialized development to run on an Android-based POS machine, resulting in high R&D costs in terms of personnel, development time, and testing. Summary of the Invention
[0003] To address the aforementioned issues, this invention proposes a method and system for remote printing based on DeepLink technology. The system comprises a printing app and a website. The printing app does not handle business operations; it only provides printing services. The website transmits the print content string, which the printing app receives and formats according to the app's preset printing format, achieving adaptive print layout. This enables mobile remote printing of existing workflow forms and other documents on the website, ultimately printing compliant documents on portable devices. This allows for rapid adaptation to business systems with minimal development costs.
[0004] This invention is achieved through the following technical solution: a system for remote printing based on DeepLink:
[0005] The system includes: a printing app, a wireless POS machine, and a cloud server;
[0006] The printing app is installed on the portable wireless network POS machine. It is used to identify the encrypted printing data string transmitted through DeepLink, automatically format it according to the preset format and display the print preview. If the preview is correct, it will be printed.
[0007] A printing service website is deployed on the cloud server. Encrypted printing data is generated through the printing service website, and the printing data is transmitted as a key-value pair string containing the title and content by sending a DeepLink request.
[0008] The wireless network POS machine opens a printing service website deployed on a cloud server by entering the domain name address in a browser, and performs printing business in the printing service website to launch the printing APP for layout and printing.
[0009] Furthermore, the printing app runs completely offline. A component that supports DeepLink is deployed in the printing app, and the component is registered with the Android system. A deep link protocol is defined so that there is no direct network interaction between the printing app, the printing service website, and the browser. Instead, the printing service website is opened by the browser.
[0010] When performing a printing service, the printing app sends a deep link request with the exact same protocol when it clicks the print button on the printing service website. This request is captured by the Android system, which then matches it with the registered app component, launches it, and passes the data to the app component.
[0011] Furthermore, the definition of the deep linking protocol specifically refers to: when declaring an Activity component in the printing app, defining the DeepLink deep linking protocol in detail in the component's Intent filter. The deep linking protocol is defined in the Activity component's... <intent-filter>Within the tag, the Activity component is declared in the Android application manifest file AndroidManifest.xml. When the app is installed on the POS machine, the Android system reads the AndroidManifest.xml manifest file and registers the component and deep linking protocol into the system. This protocol is used as a listening object to capture requests and data sent by the printing service website through the browser.
[0012] The Intent filter must satisfy the following values or matching string patterns specified by the tag elements:
[0013] <action>Tag: Must be specified as "android.intent.action.VIEW";
[0014] <category>Tags: Two need to be defined <category>One tag must be specified as the "android.intent.category.BROWSABLE" category; the other must be specified as the "android.intent.category.DEFAULT" category.
[0015] <data>Tags: Add one or more to the Intent filter <data>Tags, each <data>Each tag represents a URI format that resolves to an Activity; <data>The tag must contain at least the android:scheme attribute, and optionally include android:host, android:port, android:path, or variants of pathPattern and pathPrefix. The value of each attribute can be customized. The variant attributes of android:path or pathPattern and pathPrefix must be prefixed with a forward slash " / ". Different combinations of these attributes can further refine the types of URIs accepted by the Activity.
[0016] Furthermore, after the Android system captures the print request, it parses the data in the deep link, matches and starts the Activity component of the printing app through the Intent filter, and calls the getData() method of the Intent in the onCreate() or onStart() method to obtain the Uri object. This object contains complete deep link protocol data. Then, in the parseURIIntentData() method, it calls the getQueryParameter method of the Uri object to retrieve the data, thereby determining the print content that the Activity needs to display.
[0017] Furthermore, when the website data changes, it needs to jump to the printing app. At this time, it is necessary to decide whether to create a new Activity object to display the passed data or to refresh the existing Activity component based on the actual business.
[0018] Specifically, the launch mode of the Activity component is defined when it is declared in the AndroidManifest.xml manifest file;
[0019] If it is the first case, set the launch mode to the default standard mode. In this mode, a new Activity object will be launched every time a deep link request is sent, and the original Activity state will remain unchanged.
[0020] If it is the second case, set launchMode to any one of singleTop, singleTask, or singleInstance. In this mode, no new Activity object will be created. Instead, the previous object will be reused. However, the latest data needs to be retrieved again in the onNewIntent() lifecycle method to refresh the interface.
[0021] Furthermore, the display of the print preview specifically involves the following steps: After the printing app receives the complete print data from the website, it decrypts the data to obtain plaintext data, and then calls the updatePrintPreview() method according to the POS machine's print size to adaptively arrange the layout and display the print preview.
[0022] The adaptive layout is as follows: after the printing APP starts, it reads the paper placement and paper size through the printer driver; the paper placement can be either stacked or a long roll of paper; the paper size includes width and height, in pixels (px).
[0023] If the printed papers are stacked, the total height of all key-value pairs displayed must be calculated and compared with the height of a single sheet of paper. If the total height exceeds the height of a single sheet of paper, the print preview needs to be displayed in pages, and the last set of data on each page must not be split and displayed on two sheets of paper.
[0024] If the printing paper is in roll format, there is no need to calculate the total height of the printed data; all content can be previewed by placing key-value pairs in groups.
[0025] The printing app reads the title and content stored in key-value pairs from the printing data and arranges each key-value pair data in a predetermined format and size.
[0026] Furthermore, when printing, clicking the print button in the print preview interface sequentially calls the openPrinter(), checkPrinter(), and checkPaperOut() methods to check the printer status and whether there is paper. The asyncDoPrint() method is called in a background thread to execute the printing. After successful printing, the closePrinter() method is called to close the printer.
[0027] A method for remote printing based on DeepLink: The method specifically includes the following steps:
[0028] Step 1: Install the printing app on the portable wireless network POS machine;
[0029] Step 2: A printing service website is deployed on the cloud server. The wireless network POS machine opens the printing service website deployed on the cloud server by entering the domain name address in a browser, and performs printing business in the printing service website.
[0030] Step 3: Generate encrypted print data through the print service website, and send the print data as a key-value pair string containing the title and content by sending a DeepLink request;
[0031] Step 4: The printing app is used to identify the encrypted printing data string transmitted through DeepLink, automatically format it according to the preset format and display a print preview. If the preview is correct, the print will proceed.
[0032] An electronic device includes a memory and a processor, the memory storing a computer program, the processor executing the computer program to implement the steps of the above method.
[0033] A computer-readable storage medium for storing computer instructions that, when executed by a processor, implement the steps of the above-described method.
[0034] Beneficial effects of the invention
[0035] The APP and website of this invention do not have direct interaction, and the coupling between the two is very low, which makes it easier for each to maintain and upgrade in the future.
[0036] The printing app of this invention captures printing data string information and typeset and previews it according to the printer's preset printing format, making it clear and easy to understand.
[0037] This invention can serve as a universal mobile printing solution, while simultaneously integrating with multiple website systems of different industries and functions.
[0038] The method described in this invention requires minimal R&D investment and has a short development cycle, significantly reducing the cost of secondary development for repetitive functions. It is also easier to port and adapt to mobile printing devices of different manufacturers and models. Furthermore, during printing, the print format can be set as needed, and the print preview allows for adaptive layout, ensuring the printed document meets requirements. Only driver adaptation is required for different printer models. Attached Figure Description
[0039] Figure 1 This is a schematic diagram of the overall process of the present invention.
[0040] Figure 2 This is a schematic diagram illustrating the definition of component classes in an embodiment of the printing APP of the present invention. Detailed Implementation
[0041] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0042] Combination Figure 1 and Figure 2 ,
[0043] A system for remote printing based on DeepLink:
[0044] The system includes: a printing app, a wireless POS machine, and a cloud server;
[0045] The printing app is installed on the portable wireless network POS machine. It only provides printing services and does not involve business operations. It is used to identify the encrypted printing data string transmitted through DeepLink, automatically format it according to the preset format and display the print preview. If the preview is correct, it will print.
[0046] A printing service website is deployed on the cloud server. Encrypted printing data is generated through the printing service website, and the printing data is transmitted as a key-value pair string containing the title and content by sending a DeepLink request.
[0047] The wireless network POS machine accesses a printing service website deployed on a cloud server by entering a domain name address in a browser. The printing service website then initiates a printing app for layout and printing. This is a passive activation method; the app obtains the print content string and automatically formats and previews it according to a preset format, ultimately enabling remote printing from any location.
[0048] DeepLink does not exist between two devices and does not require a physical link. It is a connection between applications on a mobile device and between an application and the operating system. It is a way for the mobile operating system to launch applications and transfer data, and it is also a way for the operating system to give local applications more functions and more interactive methods.
[0049] The printing app runs completely offline. A DeepLink-enabled component is deployed in the printing app and registered to the Android system. A deep link protocol is defined so that there is no direct network interaction between the printing app, the printing service website, and the browser. Instead, the browser opens the printing service website.
[0050] When performing a printing service, the printing app sends a deep link request with the exact same protocol when it clicks the print button on the printing service website. This request is captured by the Android system, which then matches it with the registered app component, launches it, and passes the data to the app component.
[0051] The Android system described is based on the definitions in the Activity component. <intent-filter>The specific protocol in the attributes is used to capture deep link requests from the printing service website. <intent-filter>The tag also contains at least four sub-tags, namely: one named ACTION_VIEW <action>The tag named DEFAULT <category>The tag is named BROWSABLE. <category>The tag, and includes at least the android:scheme attribute, optionally including the attributes android:host, android:port, android:path, or variations of pathPattern and pathPrefix. <data>Label. <data>These attributes of the tag define the DeepLink deep link protocol in detail, and multiple tags can be added. <data>Tags, each tag represents a URI format that resolves to an Activity;
[0052] The definition of the deep linking protocol specifically refers to: when declaring an Activity component in the printing app, defining the DeepLink deep linking protocol in detail within the component's Intent filter. The deep linking protocol is defined within the Activity component's... <intent-filter>Within the tag, the Activity component is declared in the Android application manifest file AndroidManifest.xml. When the app is installed on the POS machine, the Android system reads the AndroidManifest.xml manifest file and registers the component and deep linking protocol into the system. This protocol is used as a listening object to capture requests and data sent by the printing service website through the browser.
[0053] The Intent filter must satisfy the following values or matching string patterns specified by the tag elements:
[0054] <action>Tag: Must be specified as "android.intent.action.VIEW";
[0055] <category>Tags: Two need to be defined <category>One tag must be specified as the "android.intent.category.BROWSABLE" category. This category is required if the Intent filter is accessed from a web browser; otherwise, clicking the link in the browser will not resolve to the app of this invention. The other tag must be specified as the "android.intent.category.DEFAULT" category. This allows the app of this invention to respond to implicit Intents. Otherwise, the Activity can only be launched if the app component name is specified in the Intent.
[0056] <data>Tags: Add one or more to the Intent filter <data>Tags, each <data>Each tag represents a URI format that resolves to an Activity; <data>The `<activity>` tag must contain at least the `android:scheme` attribute, and optionally include attributes such as `android:host`, `android:port`, `android:path`, or variations of `pathPattern` and `pathPrefix`. The value of each attribute can be customized, but the prefix for `android:path` or variations of `pathPattern` and `pathPrefix` must include a forward slash " / ". Different combinations of these attributes can further refine the types of URIs accepted by the Activity. For example, there might be multiple Activities that accept similar URIs, differing only in their path names. In this case, the `android:path` attribute, or its variations of `pathPattern` or `pathPrefix`, can be used to distinguish which Activity the system should open for different URI paths.
[0057] After the Android system captures the print request, it parses the data in the deep links, matches it using the Intent filter, and launches the Activity component of the printing app. Figure 2 The diagram shows a component class. In the onCreate() or onStart() method, the getData() method of Intent is called to obtain a Uri object. This object contains complete deep link protocol data. Then, in the parseURIIntentData() method, the getQueryParameter method of the Uri object is called to retrieve the data, thereby determining the print content that the Activity needs to display.
[0058] When the website data changes, it needs to jump to the printing app. At this time, it is necessary to decide whether to create a new Activity object to display the passed data or to refresh the existing Activity component based on the actual business.
[0059] Specifically, the launch mode of the Activity component is defined when it is declared in the AndroidManifest.xml manifest file;
[0060] If it is the first case, set the launch mode to the default standard mode. In this mode, a new Activity object will be launched every time a deep link request is sent, and the original Activity state will remain unchanged.
[0061] If it is the second case, set launchMode to any one of singleTop, singleTask, or singleInstance. In this mode, no new Activity object will be created. Instead, the previous object will be reused. However, the latest data needs to be retrieved again in the onNewIntent() lifecycle method to refresh the interface.
[0062] The specific steps for displaying the print preview are as follows: After the printing APP receives the complete print data from the website, it decrypts the data to obtain plaintext data, and then calls the updatePrintPreview() method according to the POS machine's print size to adaptively arrange the layout and display the print preview.
[0063] The adaptive layout is as follows: after the printing APP starts, it reads the paper placement and paper size through the printer driver; the paper placement can be either stacked or a long roll of paper; the paper size includes width and height, in pixels (px).
[0064] If the printed papers are stacked, the total height of all key-value pairs displayed must be calculated and compared with the height of a single sheet of paper. If the total height exceeds the height of a single sheet of paper, the print preview needs to be displayed in pages, and the last set of data on each page must not be split and displayed on two sheets of paper.
[0065] If the printing paper is in roll format, there is no need to calculate the total height of the printed data; all content can be previewed by placing key-value pairs in groups.
[0066] The printing app reads the title and content stored as key-value pairs from the printing data and arranges each key-value pair in a predetermined format and size. In this embodiment, the predetermined format and size are as follows: the title uses 40px bold black Song typeface, left-aligned; the content uses 35px black, non-bold Song typeface, right-aligned; the title must not exceed 30% of the paper width, and the content must not exceed 70% of the paper width, with any excess automatically wrapping; a colon and at least two spaces are displayed immediately to the right of the title to separate the title and content.
[0067] The printed data is encrypted. For data security reasons, the printing app and the printing service website use the same algorithm to encrypt and decrypt the printed data. After obtaining the printed data, the printing app typeset the printed string according to the preset printing format to preview the printing effect.
[0068] When printing, click the print button in the print preview interface. The openPrinter(), checkPrinter(), checkPaperOut() and other methods are called in sequence to check the printer status and whether there is paper. The asyncDoPrint() method is called in the background thread to execute printing. After printing is successful, the closePrinter() method is called to close the printer.
[0069] A method for remote printing based on DeepLink:
[0070] The method specifically includes the following steps:
[0071] Step 1: Install the printing APP on the portable wireless network POS machine. It only provides printing services and does not involve business operations.
[0072] Step 2: A printing service website is deployed on the cloud server. The wireless network POS machine opens the printing service website deployed on the cloud server by entering the domain name address in a browser, and performs printing business in the printing service website.
[0073] Step 3: Generate encrypted print data through the print service website, and send the print data as a key-value pair string containing the title and content by sending a DeepLink request;
[0074] Step 4: The printing app is used to identify the encrypted printing data string transmitted through DeepLink, automatically format it according to the preset format and display a print preview. If the preview is correct, the print will proceed.
[0075] The implementation of the printing service website also requires:
[0076] (1) Website interface adapted for POS machines:
[0077] The website system deployed on the server was originally developed for desktop computers and laptops. Now, in order to meet the needs of mobile printing services, the website interface must be adapted in terms of layout and interaction for Android system browsers and screen sizes.
[0078] (2) Send a deep link request:
[0079] When the deep link protocol defined in the printing app is "printapp: / / web.print / invoice", then in website development, there are several ways to send deep links:
[0080] 1. Assign the protocol string to the href attribute of the tag in HTML. When the user clicks the tag, a deep link request will be sent.
[0081] 2. Assign the protocol string to the src attribute of the iframe tag. This can be done either by assigning it statically or dynamically in a JavaScript code block.
[0082] 3. Assign the protocol string to window.location.href.
[0083] 4. By including the JSBridge framework in the HTML interface, you can send deep links by passing the protocol string as a parameter when calling the JavaScript function.
[0084] (3) Parameter passing methods for deep links:
[0085] The parameter passing format of deep links is similar to that of path parameters in ordinary network addresses. It also uses a question mark "?" as the separator between the path and the parameter. After the question mark "?", the parameter is passed in the form of key-value pairs with the symbols "=" and "&". For example, the deep link below can be understood as passing two parameters: the invoice number is 123321 and the product name is milk.
[0086] "printapp: / / web.print / invoice?invoiceNo=123321&goodsName=milk"
[0087] However, the following points should be noted when passing path parameters:
[0088] 1. URIs without a schema will be assumed to be either http or https. For example, www.google.com matches both http: / / www.google.com and https: / / www.google.com.
[0089] 2. When passing parameters, you can use pattern matching. Path parameter placeholders of the form {placeholder_name} match one or more characters. For example, printapp: / / web.print / invoice / {id} matches printapp: / / web.print / invoice / 4. The system attempts to resolve the placeholder value to the appropriate type by matching the placeholder name against a defined parameter (defined for the deep link destination). If no parameter with the same name is defined, the default String type is used for the parameter value. You can use the * wildcard to match zero or more characters.
[0090] 3. Query parameter placeholders can be used instead of path parameters, or they can be combined with path parameters. For example, `printapp: / / web.print / invoice / {id}?myarg={myarg}` matches `printapp: / / web.print / invoice / 4?myarg=28`.
[0091] 4. Query parameter placeholders for variables defined using default values or nullable values do not need to match. For example, `printapp: / / web.print / invoice / {id}?arg1={arg1}&arg2={arg2}` matches `printapp: / / web.print / invoice / 4?arg2=28` or `printapp: / / web.print / invoice / 4?arg1=7`. However, this is not the case for path parameters. For example, `printapp: / / web.print / invoice?arg1=7&arg2=28` does not match the above pattern because the required path parameter is not provided.
[0092] 5. Extraneous query parameters will not affect deep link URI matching. For example, even if extraneousParam is not defined in the URI pattern, printapp: / / web.print / invoice / {id} will match printapp: / / web.print / invoice / 4?extraneousParam=7.
[0093] The above describes the problem of passing parameters through deep links. However, this method can only pass a small number of string parameters. If a large number of complex data structures need to be passed, the web page needs to serialize the data and store it as a file in a directory of the printer device. Then, the web page can use the simple parameter passing method described above to tell the app how to restore the file data to their original data structure.
[0094] The present invention has provided a detailed description of a method and system for remote printing based on DeepLink technology, and has explained the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.< / data> < / data> < / data> < / data> < / category> < / category> < / action> < / data> < / data> < / data> < / category> < / category> < / action> < / data> < / data> < / data> < / data> < / category> < / category> < / action>
Claims
1. A system for remote printing based on DeepLink, characterized in that: The system includes: a printing app, a wireless POS machine, and a cloud server; The printing app is installed on the portable wireless network POS machine. It is used to identify the encrypted printing data string transmitted through DeepLink, automatically format it according to the preset format and display the print preview. If the preview is correct, it will be printed. A printing service website is deployed on the cloud server. Encrypted printing data is generated through the printing service website, and the printing data is transmitted as a key-value pair string containing the title and content by sending a DeepLink request. The wireless network POS machine opens the printing service website deployed on the cloud server by entering the domain name address in the browser, and performs printing business in the printing service website to start the printing APP for layout and printing; The printing app runs completely offline. A DeepLink-enabled component is deployed in the printing app and registered to the Android system. A deep link protocol is defined so that there is no direct network interaction between the printing app, the printing service website, and the browser. Instead, the browser opens the printing service website. When performing a printing service, the printing app sends a deep link request with the exact same protocol when it clicks the print button on the printing service website. This request is captured by the Android system, which then matches it with the registered app component, and then starts and passes the data to the app component. The definition of the deep linking protocol specifically refers to: when declaring an Activity component in the printing app, defining the DeepLink deep linking protocol in detail within the component's Intent filter. The deep linking protocol is defined within the Activity component's... <intent-filter> Within the tag, the Activity component is declared in the Android application manifest file AndroidManifest.xml. When the app is installed on the POS machine, the Android system reads the AndroidManifest.xml manifest file and registers the component and deep linking protocol into the system. This protocol is used as a listening object to capture requests and data sent by the printing service website through the browser. The Intent filter must satisfy the following values or matching string patterns specified by the tag elements: <action> Tag: Must be specified as "android.intent.action.VIEW";< / action> <category>Tags: Two need to be defined <category> One tag must be specified as the "android.intent.category.BROWSABLE" category; the other must be specified as the "android.intent.category.DEFAULT" category.< / category> < / category> <data>Tags: Add one or more to the Intent filter <data>Tags, each <data>Each tag represents a URI format that resolves to an Activity; <data>The tag must contain at least the android:scheme attribute, and optionally include android:host, android:port, android:path, or variants of pathPattern and pathPrefix. The value of each attribute can be customized. The variant attributes of android:path or pathPattern and pathPrefix must be prefixed with a forward slash " / ". Different combinations of these attributes can further refine the types of URIs accepted by the Activity.< / data> < / data> < / data> < / data> 2. The system according to claim 1, characterized in that: After the Android system captures the print request, it parses the data in the deep link, matches and starts the Activity component of the printing app through the Intent filter, and calls the getData() method of the Intent in the onCreate() or onStart() method to obtain the Uri object. This object contains complete deep link protocol data. Then, in the parseURIIntentData() method, it calls the getQueryParameter method of the Uri object to retrieve the data, thereby determining the print content that the Activity needs to display.
3. The system according to claim 2, characterized in that: When the website data changes, it needs to jump to the printing app. At this time, it is necessary to decide whether to create a new Activity object to display the passed data or to refresh the existing Activity component based on the actual business. Specifically, the launch mode of the Activity component is defined when it is declared in the AndroidManifest.xml manifest file; If it is the first case, set the launch mode to the default standard mode. In this mode, a new Activity object will be launched every time a deep link request is sent, and the original Activity state will remain unchanged. If it is the second case, set launchMode to any one of singleTop, singleTask, or singleInstance. In this mode, no new Activity object will be created. Instead, the previous object will be reused. However, the latest data needs to be retrieved again in the onNewIntent() lifecycle method to refresh the interface.
4. The system according to claim 3, characterized in that: The specific steps for displaying the print preview are as follows: After the printing APP receives the complete print data from the website, it decrypts the data to obtain plaintext data, and then calls the updatePrintPreview() method according to the POS machine's print size to adaptively arrange the layout and display the print preview. The adaptive layout is as follows: after the printing APP starts, it reads the paper placement and paper size through the printer driver; the paper placement can be either stacked or a long roll of paper; the paper size includes width and height, in pixels (px). If the printed papers are stacked, the total height of all key-value pairs displayed must be calculated and compared with the height of a single sheet of paper. If the total height exceeds the height of a single sheet of paper, the print preview needs to be displayed in pages, and the last set of data on each page must not be split and displayed on two sheets of paper. If the printing paper is in roll format, there is no need to calculate the total height of the printed data; all content is arranged and previewed in groups of key-value pairs. The printing app reads the title and content stored in key-value pairs from the printing data and arranges each key-value pair data in a predetermined format and size.
5. The system according to claim 4, characterized in that: When printing, click the print button in the print preview interface. The openPrinter(), checkPrinter(), and checkPaperOut() methods are called in sequence to check the printer status and whether there is paper. The asyncDoPrint() method is called in the background thread to execute the printing. After the printing is successful, the closePrinter() method is called to close the printer.
6. A method for remote printing based on DeepLink, characterized in that: The method is based on the DeepLink-based remote printing system as described in any one of claims 5; The method specifically includes the following steps: Step 1: Install the printing app on the portable wireless network POS machine; Step 2: A printing service website is deployed on the cloud server. The wireless network POS machine opens the printing service website deployed on the cloud server by entering the domain name address in the browser, and performs printing business in the printing service website. Step 3: Generate encrypted print data through the print service website, and send the print data as a key-value pair string containing the title and content by sending a DeepLink request; Step 4: The printing APP is used to identify the encrypted printing data string transmitted through DeepLink, automatically format it according to the preset format and display the print preview. If the preview is correct, the print will proceed. The printing app runs completely offline. A DeepLink-enabled component is deployed in the printing app and registered to the Android system. A deep link protocol is defined so that there is no direct network interaction between the printing app, the printing service website, and the browser. Instead, the browser opens the printing service website. When performing a printing service, the printing app sends a deep link request with the exact same protocol when it clicks the print button on the printing service website. This request is captured by the Android system, which then matches it with the registered app component, and then starts and passes the data to the app component. The definition of the deep linking protocol specifically refers to: when declaring an Activity component in the printing app, defining the DeepLink deep linking protocol in detail within the component's Intent filter. The deep linking protocol is defined within the Activity component's... <intent-filter>Within the tag, the Activity component is declared in the Android application manifest file AndroidManifest.xml. When the app is installed on the POS machine, the Android system reads the AndroidManifest.xml manifest file and registers the component and deep linking protocol into the system. This protocol is used as a listening object to capture requests and data sent by the printing service website through the browser.< / intent-filter> The Intent filter must satisfy the following values or matching string patterns specified by the tag elements: <action> Tag: Must be specified as "android.intent.action.VIEW";< / action> <category>Tags: Two need to be defined <category> One tag must be specified as the "android.intent.category.BROWSABLE" category; the other must be specified as the "android.intent.category.DEFAULT" category.< / category> < / category> <data>Tags: Add one or more to the Intent filter <data>Tags, each <data>Each tag represents a URI format that resolves to an Activity; <data> The tag must contain at least the android:scheme attribute, and optionally include android:host, android:port, android:path, or variants of pathPattern and pathPrefix. The value of each attribute can be customized. The variant attributes of android:path or pathPattern and pathPrefix must be prefixed with a forward slash " / ". Different combinations of these attributes can further refine the types of URIs accepted by the Activity.< / data> < / data> < / data> < / data>
Citation Information
Patent Citations
Method and system for printing OFD electronic invoice layout files in batches
CN114281273A
Printer setting state updating system
US20170322752A1