[go: up one dir, main page]

CN119828987A - Printing method and system compatible with all-page full display of various browsers - Google Patents

Printing method and system compatible with all-page full display of various browsers Download PDF

Info

Publication number
CN119828987A
CN119828987A CN202411848118.XA CN202411848118A CN119828987A CN 119828987 A CN119828987 A CN 119828987A CN 202411848118 A CN202411848118 A CN 202411848118A CN 119828987 A CN119828987 A CN 119828987A
Authority
CN
China
Prior art keywords
printing
content
web page
print
webpage
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202411848118.XA
Other languages
Chinese (zh)
Inventor
蒋晟
郑秀明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Tongtong Internet Technology Co ltd
Original Assignee
Shanghai Tongtong Internet Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Tongtong Internet Technology Co ltd filed Critical Shanghai Tongtong Internet Technology Co ltd
Priority to CN202411848118.XA priority Critical patent/CN119828987A/en
Publication of CN119828987A publication Critical patent/CN119828987A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Transfer Between Computers (AREA)

Abstract

The invention relates to a webpage printing method and a webpage printing system compatible with various browsers, wherein the method comprises the following steps that a browser side invokes a printing service of a server side, and the printing service obtains a URL address of a current webpage and converts the URL address into a printed URL address; the printing service of the server side stores the processed webpage content into a PDF format and returns the PDF format to the user. According to the invention, the server at the rear end is called for printing, so that a user is not influenced by browser compatibility when printing by the browser, and the webpage content is processed by loading the uniform printing style sheet through the printing service at the server end, so that the user can print the webpage with neat format typesetting and complete content when printing by the browser.

Description

Printing method and system compatible with all-page full display of various browsers
Technical Field
The invention relates to the technical field of webpage printing, in particular to a printing method and system compatible with all-page full display of various browsers.
Background
In modern office environments, users often need to print web page content as a basis for records or contract endorsements. However, the existing browser printing function has various limitations, such as the problems that the whole webpage cannot be printed, the content displayed by hovering a mouse cannot be printed, the multi-label page content cannot be printed at one time, and the like. When a webpage is printed, the printing effect of different browsers may be inconsistent, some contents (such as the contents displayed by hovering a mouse) cannot be printed, the contents of the multi-label pages cannot be completely displayed, and the table display is incomplete. The prior art can not uniformly print out webpages with orderly format typesetting and complete content in different browsers.
Disclosure of Invention
The invention aims to provide a printing method and a printing system compatible with all page full display of various browsers, and aims to solve the problem that in the prior art, webpages with orderly format typesetting and complete content cannot be uniformly printed in different browsers.
In order to achieve the above purpose, in one aspect, the present invention provides a printing method compatible with all page full display of various browsers, the method comprising the following steps:
the browser side calls a printing service of the server side, and the printing service obtains the URL address of the current webpage and converts the URL address into a printed URL address;
The printing service loads a unified printing style sheet, processes the webpage content and generates a printing layout;
and the print service of the server saves the processed webpage content into a PDF format and returns the PDF format to the user.
Preferably, in the printing method, the printing service loads a unified printing style sheet, and the processing of the webpage comprises the step of displaying all the content needing to be displayed in a mouse hovering mode.
Preferably, in the printing method, the whole display of the mouse-over content is realized by modifying the style of the printing style sheet or JavaScript code.
Preferably, in the printing method, the printing service loads a unified printing style sheet, and the processing of the webpage comprises the step of tiling all the content displayed by the webpage with the label page.
Preferably, in the printing method, the content displayed by the label page of the web page is all tiled by server-side script dynamic rendering.
Preferably, in the printing method, the printing service loads a unified printing style sheet, and processing the web page includes displaying all the content which is not fully displayed in the form in a line-wrapping mode.
Preferably, in the printing method, the line feed display of the content in the table is realized by adjusting the style of the printing style sheet at the server side.
Preferably, in the printing method, in the process of processing the web page content, a web page access interface needs to be acquired, and whether the loading of the web page content is completed is judged according to the configuration condition of the web page access interface, so that the integrity of the printed content is ensured.
In addition, in another aspect of the present invention, there is also provided a web page printing system compatible with various kinds of browsers, the web page printing system including:
the printing service module is used for acquiring the URL address of the webpage currently browsed by the user;
the layout conversion module is used for converting the URL address into a printing layout;
the content display module is used for processing the mouse-over content, the Tab page content and the table content to enable the mouse-over content, the Tab page content and the table content to be displayed in a printing layout completely;
and the PDF conversion module is used for saving the printing layout into a PDF format and returning the printing layout to the user.
Preferably, the web page printing system further comprises a state judging module for judging the state of the web page request interface, so as to ensure that the loading of the web page content is complete.
Compared with the prior art, the invention has at least the following technical effects:
according to the printing method and the printing system compatible with all page full display of various browsers, the server at the rear end is called for printing, and the uniform printing style sheet is loaded through the printing service at the server end to process the webpage content, so that the webpage with consistent format and complete content can be printed no matter any browser is used, and the problem encountered in the traditional printing mode is solved.
Drawings
FIG. 1 is a flow chart of a printing method compatible with full page full display of various browsers in an embodiment of the invention;
FIG. 2 is a detailed flowchart of a printing method compatible with all page full display of various browsers in an embodiment of the invention.
Detailed Description
The following describes in more detail a printing method and system compatible with all page full display of various browsers in conjunction with the schematic drawings, in which preferred embodiments of the present invention are shown, it being understood that one skilled in the art can modify the invention described herein while still achieving the advantageous effects of the invention. Accordingly, the following description is to be construed as broadly known to those skilled in the art and not as limiting the invention.
In the interest of clarity, not all features of an actual implementation are described. In the following description, well-known functions or constructions are not described in detail since they would obscure the invention in unnecessary detail. It should be appreciated that in the development of any such actual embodiment, numerous implementation details must be made to achieve the developer's specific goals, such as compliance with system-related or business-related constraints, which will vary from one implementation to another. In addition, it will be appreciated that such a development effort might be complex and time-consuming, but would nevertheless be a routine undertaking for those of ordinary skill in the art.
The invention is more particularly described by way of example in the following paragraphs with reference to the drawings. The advantages and features of the present invention will become more apparent from the following description. It should be noted that the drawings are in a very simplified form and are all to a non-precise scale, merely for convenience and clarity in aiding in the description of embodiments of the invention.
As shown in fig. 1 and 2, the invention provides a printing method compatible with full page full display of various browsers, which comprises the following steps:
the browser side calls a printing service of the server side, and the printing service firstly obtains the URL address of the current webpage and converts the URL address into a printed URL address;
then loading a unified printing style sheet through the printing service, and processing webpage content to generate a printing layout;
and the print service of the server saves the processed webpage content into a PDF format and returns the PDF format to the user.
Specifically, when the user clicks the print button, the browser sends a request to the server at the back end, and invokes the print service at the server end. After receiving the request, the print service at the server side first obtains the URL address of the current web page, where the URL address points to the page that the user wants to print. The print service converts the acquired URL address into a printed URL address. And then, the printing service loads a unified printing style sheet, processes the webpage and generates a printing layout so as to ensure that webpage content can be displayed in an expected mode during printing.
In this embodiment, in normal web browsing, certain content (e.g., tool-tips, drop-down menus, etc.) will only be displayed when the user hovers the mouse over a particular element. The print service needs to recognize these contents and cause them to be displayed all in the print layout, not only when hovering. This is typically accomplished by modifying the print style sheet so that the content is always visible at the time of printing.
Specifically, the process of loading a unified print style sheet through a print service and processing a web page involves applying a unified print style sheet (CSS). In this process, for interactive visual effects defined by the CSS's river (mouse-over) pseudo-class in the web page element, i.e. those that trigger display only when the user hovers a mouse over the element, the print style sheet will intervene and redefine. Specifically, the print style sheet will cover the original mouse-over effect so that all hidden content that depends on the river pseudo class is visible by default in the print layout and can be fully displayed without any mouse interaction. This step can ensure the integrity of the printout so that the printed document can provide the same amount of information as in screen browsing while avoiding information omission.
In this embodiment, the printing service loads a unified printing style sheet, and processing the web page includes dynamically rendering the web page by the server-side script to realize that the content displayed by the tag page of the web page is tiled. For a web page with multiple Tab (Tab pages), a user needs to click on a different Tab page to view the corresponding content while browsing. The print service will spread the contents of these Tab pages all out and display them in a top-to-bottom arrangement in the print layout so that the user can see the contents of all Tab pages at the time of printing without clicking one by one as in the browser.
In particular, the process includes the step of, for content in the web page that is presented via the tabbed mechanism, the print style sheet will override the original display attributes such that all tabbed content is expanded by default and displayed continuously in the print layout, rather than displaying only the currently activated tabbed content. And dynamically rendering the tag page content by using the server-side script. This process involves executing JavaScript or other client-side scripts at the server side to ensure that the contents of all tab pages are rendered and incorporated into the final printout when the print layout is generated.
In this embodiment, the printing service loads a unified printing style sheet, and processes the web page, including displaying all the content that is not fully displayed in the form in a line feed manner, where the line feed display of the content in the form is implemented by adjusting the style of the printing style sheet by the server side.
Forms in a web page may not be fully displayed in the browser due to the excessive length of the content, and portions of the content may be hidden or truncated. The printing service can adjust the style of the tables, and adopts an automatic line feed or column width adjustment mode to ensure that all table contents can be completely displayed without being truncated or hidden during printing.
Specifically, in the prior art, if the text content exceeds the preset display limit in the cells of the web page table, the excess portion is omitted and indicated by an ellipsis (a.). In order to meet the printing requirement, the style sheet of the printing style sheet is required to be modified, so that the text in the unit cell can be automatically fed when the display limit is reached, thereby ensuring that all text contents can be completely displayed on a printing medium and avoiding information loss and misunderstanding.
It should be noted that, as shown in fig. 2, in the process of processing the web page content, a web page access interface needs to be acquired, and whether loading of the web page content is completed is judged according to the configuration condition of the web page access interface, so as to ensure that the printed content is complete. Specifically, related configuration content of the webpage access interface needs to be read, if the configuration content does not require that the interface is required to be completed, the webpage in the current state can be directly stored as a picture without waiting for the completion of loading of the interface. If the configuration content indicates that the interface must wait for completion to ensure that the page content loading is complete, then the following operations will be performed:
And if the loading of the interface is not completed, the webpage access interface needs to be re-acquired, and whether the loading of the webpage content is completed is judged again according to the interface.
Through the steps, when the webpage content is printed, the printed content is ensured to be as complete as possible, and the method is beneficial to improving the integrity and reliability of the webpage content printing under the condition that the interface is already loaded or the interface is not required to wait for completion.
Finally, the print service of the server saves the processed webpage content as a picture, converts the picture into a PDF file and returns the PDF file to the user, and the webpage layout and format which are uniformly processed by the print style sheet can be ensured not to be destroyed, so that the webpage with consistent format and complete content is printed.
In another aspect of the present invention, there is also provided a web page printing system compatible with various kinds of browsers, the web page printing system including:
the printing service module is used for acquiring the URL address of the webpage currently browsed by the user;
the layout conversion module is used for converting the URL address into a printing layout;
the content display module is used for processing the mouse-over content, the Tab page content and the table content to enable the mouse-over content, the Tab page content and the table content to be displayed in a printing layout completely;
and the PDF conversion module is used for saving the printing layout into a PDF format and returning the printing layout to the user.
Preferably, the web page printing system further comprises a state judging module for judging the state of the web page request interface, so as to ensure that the loading of the web page content is complete.
In summary, in the printing method compatible with all page full display of various browsers provided by the embodiment of the invention, the server at the back end is called to print, and the unified printing style sheet is loaded through the printing service at the server end to process the webpage content, so that the webpage with consistent format and complete content can be printed no matter any browser is used, and the problem encountered in the traditional printing mode is solved.
The foregoing is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Any person skilled in the art will make any equivalent substitution or modification to the technical solution and technical content disclosed in the invention without departing from the scope of the technical solution of the invention, and the technical solution of the invention is not departing from the scope of the invention.

Claims (10)

1.一种兼容各类浏览器的网页打印方法,其特征在于,该方法包括以下步骤:1. A web page printing method compatible with various browsers, characterized in that the method comprises the following steps: 浏览器端调用服务器端的打印服务,所述打印服务获取当前网页的URL地址,并转换为打印的URL地址;The browser side calls the print service on the server side, and the print service obtains the URL address of the current web page and converts it into a print URL address; 所述打印服务加载统一的打印样式表,对网页内容进行处理,生成打印布局;The printing service loads a unified printing style sheet, processes the webpage content, and generates a printing layout; 服务器端的打印服务将处理后的网页内容保存为PDF格式返回给用户。The server-side printing service saves the processed web page content in PDF format and returns it to the user. 2.根据权利要求1所述的方法,其特征在于,所述打印服务加载统一的打印样式表,对网页进行处理包括:将需要鼠标悬停显示的内容全部显示。2. The method according to claim 1 is characterized in that the printing service loads a unified printing style sheet, and processing the web page includes: displaying all content that needs to be displayed when the mouse is hovered. 3.根据权利要求2所述的方法,其特征在于,通过修改打印样式表的样式或JavaScript代码实现鼠标悬停内容的全部显示。3. The method according to claim 2 is characterized in that the full display of the mouse hovering content is achieved by modifying the style of the print style sheet or the JavaScript code. 4.根据权利要求1所述的方法,其特征在于,所述打印服务加载统一的打印样式表,对网页进行处理包括:将网页用标签页显示的内容全部平铺显示。4. The method according to claim 1 is characterized in that the printing service loads a unified printing style sheet, and the processing of the web page includes: all the contents displayed by the web page using the tab page are displayed in a tiled manner. 5.根据权利要求4所述的方法,其特征在于,通过服务器端脚本动态渲染实现所述将网页用标签页显示的内容全部平铺显示。5. The method according to claim 4 is characterized in that the tiling display of all the contents displayed by the web page using the tabs is achieved through dynamic rendering of a server-side script. 6.根据权利要求1所述的方法,其特征在于,所述打印服务加载统一的打印样式表,对网页进行处理包括,将表格中显示不全的内容采用换行形式全部显示。6. The method according to claim 1 is characterized in that the printing service loads a unified printing style sheet, and the processing of the web page includes displaying all the incomplete contents in the table in a line break format. 7.根据权利要求6所述的方法,其特征在于,所述表格中内容的换行显示是通过服务器端调整打印样式表的样式实现的。7. The method according to claim 6 is characterized in that the line break display of the content in the table is achieved by adjusting the style of the print style sheet on the server side. 8.根据权利要求1所述的方法,其特征在于,所述在对网页内容进行处理的过程中,需获取网页访问接口,根据所述网页访问接口的配置情况判断页面内容是否加载完成,确保打印内容完整。8. The method according to claim 1 is characterized in that, in the process of processing the web page content, it is necessary to obtain a web page access interface, and determine whether the page content is loaded according to the configuration of the web page access interface to ensure that the printed content is complete. 9.一种兼容各类浏览器的网页打印系统,其特征在于,包括:9. A web page printing system compatible with various browsers, comprising: 打印服务模块,用于获取用户当前浏览的网页的URL地址;The printing service module is used to obtain the URL address of the web page currently browsed by the user; 布局转换模块,用于将所述URL地址转换为打印布局;A layout conversion module, used to convert the URL address into a print layout; 内容显示模块,用于处理鼠标悬停内容、标签页内容和表格内容,使其在打印布局中完整显示;Content display module, used to process mouse hover content, tab content and table content so that they can be fully displayed in the print layout; PDF转换模块,用于将打印布局保存为PDF格式并返回给用户。The PDF conversion module is used to save the print layout in PDF format and return it to the user. 10.根据权利要求9所述的系统,其特征在于,还包括一个状态判断模块,用于判断网页请求接口状态,确保页面内容加载完整。10. The system according to claim 9 is characterized in that it also includes a status judgment module for judging the status of the web page request interface to ensure that the page content is loaded completely.
CN202411848118.XA 2024-12-16 2024-12-16 Printing method and system compatible with all-page full display of various browsers Pending CN119828987A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202411848118.XA CN119828987A (en) 2024-12-16 2024-12-16 Printing method and system compatible with all-page full display of various browsers

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202411848118.XA CN119828987A (en) 2024-12-16 2024-12-16 Printing method and system compatible with all-page full display of various browsers

Publications (1)

Publication Number Publication Date
CN119828987A true CN119828987A (en) 2025-04-15

Family

ID=95307272

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202411848118.XA Pending CN119828987A (en) 2024-12-16 2024-12-16 Printing method and system compatible with all-page full display of various browsers

Country Status (1)

Country Link
CN (1) CN119828987A (en)

Similar Documents

Publication Publication Date Title
US7251778B1 (en) Method and system for dynamically adapting the layout of a document to an output device
US6986105B2 (en) Methods employing multiple clipboards for storing and pasting textbook components
US6278448B1 (en) Composite Web page built from any web content
CA2508929C (en) Method and apparatus for viewing and interacting with a spreadsheet from within a web browser
US9778940B2 (en) Webtop: multiple applet delivery within a fixed-sized viewing space
JP4758176B2 (en) Improved user interface for displaying a gallery of formatting options that can be applied to selected objects
KR101169087B1 (en) Method, system, and computer-readable medium for applying a global formatting scheme to a chart in an electronic document
CN100565524C (en) A kind of system, method and browser of preserving web page contents
US20040172584A1 (en) Method and system for enhancing paste functionality of a computer software application
US20140250369A1 (en) Interactive special paste
EP1712991B1 (en) System and method for providing a consistent visual appearance to output generated by multiple applications
US20030041102A1 (en) Methods and systems for scaling inappropriately-sized documents in a distributed environment
WO2004021211A2 (en) System and method for browser document editing
US20080134077A1 (en) Chameleon graphic user interface
CN115048905A (en) File processing method, device and equipment of rich text editor and storage medium
AU760816B2 (en) System for capturing, annotating and transmitting images of internet web pages
US20020010720A1 (en) Hyper-text document formatting collating and printing
CN119828987A (en) Printing method and system compatible with all-page full display of various browsers
JP3589400B2 (en) Server client system, network server, client, form providing method, storage medium, and program transmission device
JP2007316873A (en) Content server and layout system
US20040057078A1 (en) Method and system for printing
Green Publishing data.
Linecker Final Draft 7: scriptwriting package lacks polish
Stevens PFS: Publisher for Windows does budget desktop publishing.
Harrel Publish It! Easy v3. 02.

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination