CN110008195B - Method, device and system for dynamically configuring html (hypertext markup language) to pdf (pdf) - Google Patents
Method, device and system for dynamically configuring html (hypertext markup language) to pdf (pdf) Download PDFInfo
- Publication number
- CN110008195B CN110008195B CN201910290777.9A CN201910290777A CN110008195B CN 110008195 B CN110008195 B CN 110008195B CN 201910290777 A CN201910290777 A CN 201910290777A CN 110008195 B CN110008195 B CN 110008195B
- Authority
- CN
- China
- Prior art keywords
- file
- template
- user side
- html
- 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.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/17—Details of further file system functions
- G06F16/178—Techniques for file synchronisation in file systems
- G06F16/1794—Details of file format conversion
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/958—Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
- G06F16/986—Document structures and storage, e.g. HTML extensions
Abstract
The invention discloses a method, a device and a system for dynamically configuring an html-to-pdf conversion, which belong to the field of computers, and the method for dynamically configuring the html-to-pdf conversion provided by the invention comprises the following steps: a user sends a template configuration request to a web server; the web server calls an editable template in the form of an html webpage from the built-in library to the user; a user configures a template on an html webpage and then sends configuration parameters to a web server; the web server receives the configuration parameters of the user and generates a complete html page file; the web server converts the complete html file into a pdf file.
Description
Technical Field
The invention belongs to the field of computers, and particularly relates to a method, a device and a system for dynamically configuring html (hypertext markup language) to pdf.
Background
The purpose of Adobe corporation to design PDF file format is to support cross-platform, multimedia-integrated information publishing and distribution, and in particular to provide support for network information distribution.
PDF has many advantages over other electronic document formats. The PDF file format may encapsulate text, fonts, formats, colors, and device and resolution independent graphical images, etc. in one file. The format file can also contain electronic information such as hypertext links, sound, dynamic images and the like, supports a special file, and has high integration level and high safety and reliability.
The traditional batch pdf creation has low efficiency of editing files according to pdf files, the modification of templates costs a lot of manpower and material resources, and the pdf generation efficiency is low.
Disclosure of Invention
The invention provides a method, a device and a system for dynamically configuring an html-to-pdf conversion, which aim to solve the problems that the traditional batch pdf creation has low efficiency of editing files according to pdf files, a large amount of manpower and material resources are consumed for template modification, and the pdf generation efficiency is low.
In order to achieve the purpose, the technical scheme adopted by the invention is as follows:
a method for dynamically configuring an html to pdf for use in a web server, the method comprising:
receiving a template configuration request from a user side;
calling an editable template in a webpage form in a built-in library and sending the editable template to a user side;
receiving configuration parameters from a user side, wherein the configuration parameters are generated after the user side configures a template on a received html webpage;
receiving configuration parameters of a user side to generate a complete html page file;
and converting the complete html file into a pdf file.
Before receiving the template configuration request from the user side, the method further comprises the following steps:
and acquiring an editable template which is from the user side and has the same html webpage form as the pdf template for the template according to the pdf template.
Before converting the complete html file into the pdf file, the method further includes:
receiving configuration parameters from a user side, adding tasks of the configuration parameters into a blocking queue, and returning the generation condition of the tasks and/or the extraction address of the task generation file sent to the user side;
after the converting the complete html file into the pdf file, the method further includes:
and transferring the generated pdf file to a file server, wherein the file server generates a file extraction address after receiving the pdf file and sends the file extraction address to the user side.
An apparatus for dynamically configuring html to pdf for use in a web server, the apparatus comprising:
the request acquisition module is used for receiving a template configuration request from a user side;
the template calling module is used for calling the editable template in the webpage form in the built-in library and sending the editable template to the user side;
the parameter acquisition module is used for receiving configuration parameters from the user side, wherein the configuration parameters are generated after the user side configures the template on the received html webpage;
the template rendering module is used for receiving the configuration parameters of the user side and generating a complete html page file;
and the html-to-pdf module is used for converting the complete html file into a pdf file.
Further comprising:
and the html template creating module is used for acquiring an editable template which is from the user side and has the same html webpage form as the pdf template for the template according to the pdf template.
Further comprising:
the multithreading asynchronous task management module is used for receiving the configuration parameters from the user side, adding the tasks of the configuration parameters into the blocking queue, and returning the generation condition of the tasks and/or the extraction address of the task generation file sent to the user side;
further comprising:
and the file storage server is used for transferring the generated pdf file to a file server, and the file server generates a file extraction address after receiving the pdf file and sends the file extraction address to the user side.
A system for dynamically configuring html (hypertext markup language) to pdf (pdf) comprises a user side and a web server connected with the user side;
the user side includes:
the request sending module is used for sending a template configuration request to the web server;
the template acquisition module is used for receiving editable templates in a webpage form in a built-in library from the web server;
the parameter sending module is used for sending the received configuration parameters input by the user side after the template is configured on the html webpage to the web server, receiving the configuration parameters by the web server, and converting the complete html page file into a pdf file after the web server generates the complete html page file according to the configuration parameters in the web server;
the web server includes:
the request acquisition module is used for receiving a template configuration request from a user side;
the template calling module is used for calling the editable template in the webpage form in the built-in library and sending the editable template to the user side;
the parameter acquisition module is used for receiving configuration parameters from the user side, wherein the configuration parameters are generated after the user side configures the template on the received html webpage;
the template rendering module is used for receiving the configuration parameters of the user side and generating a complete html page file;
and the html-to-pdf module is used for converting the complete html file into a pdf file.
The web server also comprises:
the multithreading asynchronous task management module is used for receiving the configuration parameters from the user side, adding the tasks of the configuration parameters into the blocking queue, and returning the generation condition of the tasks and/or the extraction address of the task generation file sent to the user side; and/or
And the file storage server is used for transferring the generated pdf file to a file server, and the file server generates a file extraction address after receiving the pdf file and sends the file extraction address to the user side.
The method has the advantages that the pdf automatic creation is realized by using the html dynamic page according to the visual configuration, the html file of the pdf template style required for editing on the html webpage is provided for the user side by using the web server according to the principle of the dynamic web page, the html file is converted into the pdf file by using the html-to-pdf plug-in, and the template which is consistent with the pdf style and is convenient to edit is formed according to the html language characteristic. Therefore, different pdf files can be constructed according to different parameters, so that the creation and modification of the pdf files are converted from offline to online, and the working efficiency is greatly improved.
Drawings
FIG. 1 is a flowchart of a method for dynamically configuring an html to pdf according to an embodiment of the present invention;
FIG. 2 is a flowchart of a method for dynamically configuring an html to pdf according to another embodiment of the present invention;
FIG. 3 is a flowchart of a method for dynamically configuring an html to pdf according to an embodiment of the present invention;
FIG. 4 is a flowchart of a method for dynamically configuring an html to pdf according to another embodiment of the present invention;
fig. 5 is a block diagram illustrating an apparatus for dynamically configuring html pdf according to an embodiment of the present invention;
fig. 6 is a block diagram illustrating a structure of an apparatus for dynamically configuring html pdf according to another embodiment of the present invention;
fig. 7 is a block diagram illustrating an apparatus for dynamically configuring html pdf according to an embodiment of the present invention;
FIG. 8 is a flowchart of a method for dynamically configuring an html to pdf according to another embodiment of the present invention;
fig. 9 is a block diagram of an apparatus for dynamically configuring html pdf according to an embodiment of the present invention.
Detailed Description
It should be noted that, in the embodiments of the present invention, the terms referred to are:
and the web server is used for receiving the instruction of the user side, editing the html page, sending the html page to the user side, returning and generating html page preview edited according to the requirements of the user side.
The editable template in the html webpage form is a common dynamic web resource development technology based on a user side: JSP/Servlet, ASP, PHP and the like, and uses dynamic resources in the web server manufactured by the prior art, the dynamic resources can be processed and pieced together by the web server, and html webpage files which are configured by using configuration parameters and have the same style as a PDF template are generated at a user side; alternatively, thymeleaf may be used as the html template engine.
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail with reference to the accompanying drawings.
Referring to fig. 1, a method for dynamically configuring an html pdf according to an embodiment of the present invention is shown, where the method includes:
110, the user side sends a template configuration request to the web server;
120, the web server calls an editable template in the form of an html webpage from the built-in library to the user side;
130, the user side configures the template on the html webpage and then sends the configuration parameters to the web server;
140, the web server receives the configuration parameters of the user terminal to generate a complete html page file;
150, the web server converts the complete html file into a pdf file.
In the above embodiment, in a large amount of pdf file writing work, for example, when a user directly edits a required file in pdf software or manually converts the file into a pdf file after making the file by using software such as wps, the user needs to continuously repeat tedious work, which wastes time resources;
aiming at the problems, the embodiment establishes a template for the work of the user side needing repetitive operation, and realizes pdf automatic establishment by using an html dynamic page according to visual configuration;
the method comprises the steps that a user logs in a web server firstly, namely the user sends a template configuration request through a user side, the web server sends an editable template in an html webpage form to the user, the user can preview template styles, and the user can edit styles and contents in a needed pdf file according to the template styles, such as information of editing template styles, header configuration, footer configuration and the like; the web server receives template parameters input by a user, renders the html template into a complete html file, and converts the complete html file into a pdf file by using an plugin. Optionally, the entire html file is converted into a pdf file using an itext plug-in. Wherein itext is prior art.
Further, referring to fig. 2, before the web server calls an editable template in the form of an html web page from the built-in library to the user side, the method further includes:
100, the user end creates an editable template in the html webpage form with the same style as the pdf template by using the pdf template as a template according to the pdf template and stores the editable template in the web server.
In the above embodiment, the web server stores an editable template in the html web page form, where the editable template in the html web page form is based on a common dynamic web resource development technology at a user end: JSP/Servlet, ASP, PHP and the like, and uses dynamic resources in the web server manufactured by the prior art, the dynamic resources can be processed and pieced together by the web server, and html webpage files which are configured by using configuration parameters and have the same style as a PDF template are generated at a user side; alternatively, thymeleaf may be used as the html template engine.
Further, referring to fig. 3, which shows another embodiment of the present invention, before the web server converts the complete html file into the pdf file, the method further includes:
131, after receiving the configuration parameter of the user end, the web server adds the task of the configuration parameter into the blocking queue, and returns the generation condition of the task and/or the extraction address of the task generation file sent to the user end.
In the above embodiment, asynchronous workpieces are adopted due to the large task amount of the workpieces and the influence of network factors. The realization method comprises the following steps:
1) and constructing a task thread pool of a blocking queue as a workpiece task thread pool, and performing workpiece work by using an asynchronous thread after receiving a workpiece task.
2) A task thread pool of a blocking queue retries as a work piece task failure processing thread pool. The retry is only made for failures due to network reasons.
3) And updating the task state.
And the user acquires the state of the workpiece according to the task id round training of the workpiece. And continuing to perform round training in the process, and returning the reason of task failure if the task fails.
Further, referring to fig. 4, it shows another embodiment of the present invention, after the web server converts the complete html file into the pdf file, the method further includes:
160, the web server downloads the generated pdf file to the file server,
161, the file server receives the pdf file, generates a file extraction address and sends the file extraction address to the user side.
In the above embodiment, when the web server needs to process more PDF file generation tasks submitted by the user side, the processing time of the web server may be quite long, and in order to avoid wasting user time, the web server generates a file extraction address, and the user can extract the generated PDF file after a period of time, so that the user time is saved.
Further, please refer to fig. 1, which illustrates a method for dynamically configuring html to pdf for a web server according to an embodiment of the present invention, where the method includes:
receiving a template configuration request from a user side;
calling an editable template in a webpage form in a built-in library and sending the editable template to a user side;
receiving configuration parameters from a user side, wherein the configuration parameters are generated after the user side configures a template on a received html webpage;
receiving configuration parameters of a user side to generate a complete html page file;
and converting the complete html file into a pdf file.
In the above embodiment, in a large amount of pdf file writing work, for example, when a user directly edits a required file in pdf software or manually converts the file into a pdf file after making the file by using software such as wps, the user needs to continuously repeat tedious work, which wastes time resources;
aiming at the problems, the embodiment establishes a template for the work of the user needing repeated operation, and realizes pdf automatic establishment by using an html dynamic page according to visual configuration;
the method comprises the steps that a user logs in a web server firstly, namely a user sends a template configuration request through the user, the web server sends an editable template in an html webpage form to the user, the template style can be previewed by the user, and the user can edit the style and the content in a needed pdf file according to the template style, such as information of editing the template style, header configuration, footer configuration and the like; the web server receives template parameters input by a user side, renders the html template into a complete html file, and converts the complete html file into a pdf file by using an plugin. Optionally, the entire html file is converted into a pdf file using an itext plug-in. Wherein itext is prior art.
Further, referring to fig. 2, it shows another embodiment of the present invention, before receiving the template configuration request from the user side, the method further includes:
and acquiring an editable template which is from the user side and has the same html webpage form as the pdf template for the template according to the pdf template.
In the above embodiment, the web server stores an editable template in the html web page form, and the editable template in the html web page form is a technique developed by a user based on a commonly used dynamic web resource: JSP/Servlet, ASP, PHP and the like, and uses dynamic resources in the web server manufactured by the prior art, the dynamic resources can be processed and pieced together by the web server, and html webpage files which are configured by the user by using configuration parameters and have the same style as the PDF template are generated; alternatively, thymeleaf may be used as the html template engine.
Further, referring to fig. 3 and fig. 4, another embodiment of the present invention is shown, before converting the complete html file into the pdf file, further comprising:
receiving configuration parameters from a user side, adding tasks of the configuration parameters into a blocking queue, and returning the generation condition of the tasks and/or the extraction address of the task generation file sent to the user side;
after the converting the complete html file into the pdf file, the method further includes:
and transferring the generated pdf file to a file server, wherein the file server generates a file extraction address after receiving the pdf file and sends the file extraction address to the user side.
In the above embodiment, asynchronous workpieces are adopted due to the large task amount of the workpieces and the influence of network factors. The realization method comprises the following steps:
1) and constructing a task thread pool of a blocking queue as a workpiece task thread pool, and performing workpiece work by using an asynchronous thread after receiving a workpiece task.
2) A task thread pool of a blocking queue retries as a work piece task failure processing thread pool. The retry is only made for failures due to network reasons.
3) And updating the task state.
When the web server needs to process more PDF file generation tasks submitted by the user side, the processing time of the web server may be quite long, and in order to avoid wasting user time, the web server generates a file extraction address, so that the user can extract generated PDF files after a period of time, and the user time is saved.
Referring to fig. 5, it shows an apparatus for dynamically configuring html to pdf, according to an embodiment of the present invention, where the apparatus is used in a web server, and the apparatus includes:
a request obtaining module 210, configured to receive a template configuration request from a user side;
the template calling module 220 is used for calling editable templates in a webpage form in the built-in library and sending the editable templates to the user side;
the parameter obtaining module 230 is configured to receive a configuration parameter from the user side, where the configuration parameter is a configuration parameter generated after the user side configures a template on a received html webpage;
the template rendering module 240 is configured to receive configuration parameters of a user side and generate a complete html page file;
and the html to pdf module 250 is used for converting the complete html file into a pdf file.
In the above embodiment, in a large amount of pdf file writing work, for example, when a user directly edits a required file in pdf software or manually converts the file into a pdf file after making the file by using software such as wps, the user needs to continuously repeat tedious work, which wastes time resources;
aiming at the problems, the embodiment establishes a template for the work of the user needing repeated operation, and realizes pdf automatic establishment by using an html dynamic page according to visual configuration;
a user firstly logs in a request acquisition module of a web server to connect with the web server through a user side, which is equivalent to the user side sending a template configuration request, the web server sends an editable template in the form of html webpage to the user side by using a template calling module for the user to preview the template style, and the user can edit the style and content in a required pdf file according to the template style, such as information of editing template style, header configuration, footer configuration and the like; the parameter acquisition module of the web server receives template parameters input by a user terminal, the template rendering module renders the html template into a complete html file, and the complete html file is converted into a pdf file by using an plugin. Optionally, the entire html file is converted into a pdf file using an itext plug-in. Wherein itext is prior art.
Further, please refer to fig. 6, which shows another embodiment of the present invention, further comprising:
the html template creating module 200 is used for obtaining an editable template which is from the user end and has the same html webpage form as the pdf template for the template according to the pdf template.
In the above embodiment, the web server stores an editable template in the html web page form, where the editable template in the html web page form is a html template creation module edited by a user through a user side, and the html template creation module is used and is based on a common dynamic web resource development technology: JSP/Servlet, ASP, PHP and the like, and uses dynamic resources in the web server manufactured by the prior art, the dynamic resources can be processed and pieced together by the web server, and html webpage files which are configured by using configuration parameters and have the same style as a PDF template are generated at a user side; alternatively, thymeleaf may be used as the html template engine.
Further, please refer to fig. 7, which shows another embodiment of the present invention, further comprising:
the multithreading asynchronous task management module 231 is configured to receive the configuration parameter from the user side, add the task of the configuration parameter to the blocking queue, and return the generation condition of the task and/or the extraction address of the task generation file sent to the user side;
and the file storage server 260 is configured to forward the generated pdf file to a file server, where the file server generates a file extraction address after receiving the pdf file and sends the file extraction address to the user side.
In the above embodiment, asynchronous workpieces are adopted due to the large task amount of the workpieces and the influence of network factors. The realization method comprises the following steps:
1) and constructing a task thread pool of a blocking queue as a workpiece task thread pool, wherein the task pool is a multi-thread asynchronous task management module, and the multi-thread asynchronous task management module uses an asynchronous thread to perform workpiece work after receiving a workpiece task.
2) A task thread pool of a blocking queue retries as a work piece task failure processing thread pool. The retry is only made for failures due to network reasons.
3) And updating the task state.
When the web server needs to process more PDF file generation tasks submitted by users through the user side, the processing time of the web server may be quite long, in order to avoid wasting user time, the web server generates a file extraction address, and the generated PDF files are transferred to the file storage server, so that the users can extract the generated PDF files after a period of time, and the user time is saved.
One embodiment of the present invention provides a system for dynamically configuring html pdf,
the system comprises a user side and a web server connected with the user side;
the user side includes:
the request sending module is used for sending a template configuration request to the web server;
the template acquisition module is used for receiving editable templates in a webpage form in a built-in library from the web server;
the parameter sending module is used for sending the received configuration parameters input by the user side after the template is configured on the html webpage to the web server, receiving the configuration parameters by the web server, and converting the complete html page file into a pdf file after the web server generates the complete html page file according to the configuration parameters in the web server;
the web server includes:
the request acquisition module is used for receiving a template configuration request from a user side;
the template calling module is used for calling the editable template in the webpage form in the built-in library and sending the editable template to the user side;
the parameter acquisition module is used for receiving configuration parameters from the user side, wherein the configuration parameters are generated after the user side configures the template on the received html webpage;
the template rendering module is used for receiving the configuration parameters of the user side and generating a complete html page file;
and the html-to-pdf module is used for converting the complete html file into a pdf file.
In the above embodiment, in a large amount of pdf file writing work, for example, when a user directly edits a required file in pdf software or manually converts the file into a pdf file after making the file by using software such as wps, the user needs to continuously repeat tedious work, which wastes time resources;
aiming at the problems, the embodiment establishes a template for the work of the user needing repeated operation, and realizes pdf automatic establishment by using an html dynamic page according to visual configuration;
a user logs in a web server through a request sending module of a user side to connect with a request obtaining module of the web server, which is equivalent to the user side sending a template configuration request, the web server uses a template calling module to send an editable template in the form of html webpage to the user side, so that the user can preview the template style through the template obtaining module, and can edit the style and content in a required pdf file according to the template style, and information such as the edited template style, the header configuration, the footer configuration and the like is sent to the web server through a parameter sending module; the parameter acquisition module of the web server receives template parameters input by a user terminal, the template rendering module renders the html template into a complete html file, and the complete html file is converted into a pdf file by using an plugin. Optionally, the entire html file is converted into a pdf file using an itext plug-in. Wherein itext is prior art.
Further, the web server further comprises:
the multithreading asynchronous task management module is used for receiving the configuration parameters from the user side, adding the tasks of the configuration parameters into the blocking queue, and returning the generation condition of the tasks and/or the extraction address of the task generation file sent to the user side; and/or
And the file storage server is used for transferring the generated pdf file to a file server, and the file server generates a file extraction address after receiving the pdf file and sends the file extraction address to the user side.
In the above embodiment, asynchronous workpieces are adopted due to the large task amount of the workpieces and the influence of network factors. The realization method comprises the following steps:
1) and constructing a task thread pool of a blocking queue as a workpiece task thread pool, wherein the task pool is a multi-thread asynchronous task management module, and the multi-thread asynchronous task management module uses an asynchronous thread to perform workpiece work after receiving a workpiece task.
2) A task thread pool of a blocking queue retries as a work piece task failure processing thread pool. The retry is only made for failures due to network reasons.
3) And updating the task state.
When the web server needs to process more PDF file generation tasks submitted by users through the user side, the processing time of the web server may be quite long, in order to avoid wasting user time, the web server generates a file extraction address, and the generated PDF files are transferred to the file storage server, so that the users can extract the generated PDF files after a period of time, and the user time is saved.
Referring to FIG. 8, in another embodiment of the present invention, first, a transformation configuration database is designed according to transformation requirements, and specific fields include HTML template style, header configuration, footer configuration, and the like. JAVA language is used as a back-end language, mysql is used as a database to store data, and node is used as a front-end development language to provide page visualization configuration operation. Here, thymeleaf is used as html template engine, and itext is used as pdf editing component. The Thymeleaf template engine does not influence the HTML grammar format, convenient direct dynamic preview and itext provide a quick and convenient PDF function and editing function by HTML conversion, and the implementation principle is not described in detail.
And the user calls the corresponding template configuration to perform the workpiece through the service parameters of the user, the system receives the workpiece request, creates a workpiece task record and returns the data after pre-generating a pdf file path and a task id. And the workpiece task thread pool acquires the configuration content created in advance according to the configuration id, and a thymeleaf engine is used for configuring and combining the parameters and the template to generate complete html language content. The HTML content is converted to a pdf file using the itext component, completing the creation of the pdf and uploading the file stream directly to the file server. Asynchronous parts are adopted due to the fact that the task quantity of the parts is large and the parts are influenced by network factors. Implementation mode
1) And constructing a task thread pool of a blocking queue as a workpiece task thread pool, and performing workpiece work by using an asynchronous thread after receiving a workpiece task.
2) A task thread pool of a blocking queue retries as a work piece task failure processing thread pool. The retry is only made for failures due to network reasons.
3) And updating the task state.
And the user acquires the state of the workpiece according to the task id round training of the workpiece. And continuing to perform round training in the process, and returning the reason of task failure if the task fails.
Referring to fig. 9, in another embodiment of the present invention, a html template is created according to a pdf template, a template configuration is created by configuring header and footer styles of the pdf template, a user end transmits template parameters, and the html template is rendered into a complete html file. And converting the html file into pdf style configuration according to the style of the html file and generating a binary pdf file stream. And uploading the file stream to a file server. Asynchronous artifacts avoid waiting based on multithreaded asynchronous tasks. And returning the pdf file path to the service system.
The foregoing detailed description and preferred embodiments should be taken as readily understood and as readily put into practical effect by those skilled in the art.
It should be noted that: in the above embodiment, when the task is completed, the above division of each function module is merely used as an example to illustrate, and in practical applications, the above function distribution may be completed by different function modules according to needs, that is, the internal structure of the html pdf apparatus is divided into different function modules to complete all or part of the above described functions. In addition, the html-to-pdf device provided by the above embodiment and the html-to-pdf method embodiment belong to the same concept, and the specific implementation process thereof is described in the method embodiment, and is not described herein again.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc. The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; such modifications and substitutions do not depart from the spirit and scope of the present invention, and they should be construed as being included in the following claims and description.
Claims (5)
1. A method for dynamically configuring an html (hypertext markup language) to a pdf (pdf) is used in a web server, and the method comprises the following steps:
receiving a template configuration request from a user side;
calling an editable template in a webpage form in a built-in library and sending the editable template to a user side;
receiving configuration parameters from a user side, wherein the configuration parameters are generated after the user side configures a template on a received html webpage;
receiving configuration parameters of a user side to generate a complete html page file;
converting the complete html file into a pdf file;
after the converting the complete html file into the pdf file, the method further includes: the generated pdf file is transferred to a file server, and the file server generates a file extraction address to be sent to a user side after receiving the pdf file;
before converting the complete html file into the pdf file, the method further includes: receiving configuration parameters from a user side, adding tasks of the configuration parameters into a blocking queue, and returning the generation condition of the tasks and/or the extraction address of the task generation file sent to the user side, specifically comprising:
constructing a task thread pool of a blocking queue as a workpiece task thread pool, and performing workpiece work by using an asynchronous thread after receiving a workpiece task;
a task thread pool of a blocking queue is used as a workpiece task failure processing thread pool for retrying, and the retrying is only carried out aiming at the failure caused by network reasons;
and updating the task state.
2. The method of claim 1, wherein the step of receiving a template configuration request from the user side further comprises:
and acquiring an editable template which is from the user side and has the same html webpage form as the pdf template for the template according to the pdf template.
3. An apparatus for dynamically configuring html to pdf, wherein the apparatus is used in a web server, and the apparatus comprises:
the request acquisition module is used for receiving a template configuration request from a user side; the template calling module is used for calling the editable template in the webpage form in the built-in library and sending the editable template to the user side;
the parameter acquisition module is used for receiving configuration parameters from the user side, wherein the configuration parameters are generated after the user side configures the template on the received html webpage;
the template rendering module is used for receiving the configuration parameters of the user side and generating a complete html page file; the html-to-pdf module is used for converting the complete html file into a pdf file;
further comprising: the file storage server is used for transferring the generated pdf file to a file server, and the file server generates a file extraction address after receiving the pdf file and sends the file extraction address to the user side;
the multithreading asynchronous task management module is used for receiving the configuration parameters from the user side, adding the tasks of the configuration parameters into the blocking queue, and returning the generation condition of the tasks and/or the extraction address of the task generation file sent to the user side, and specifically comprises the following steps:
constructing a task thread pool of a blocking queue as a workpiece task thread pool, and performing workpiece work by using an asynchronous thread after receiving a workpiece task;
a task thread pool of a blocking queue is used as a workpiece task failure processing thread pool for retrying, and the retrying is only carried out aiming at the failure caused by network reasons;
and updating the task state.
4. The apparatus for dynamically configuring an html-to-pdf conversion as recited in claim 3, further comprising:
and the html template creating module is used for acquiring an editable template which is from the user side and has the same html webpage form as the pdf template for the template according to the pdf template.
5. A system for dynamically configuring html to pdf is characterized by comprising a user side and a web server connected with the user side;
the user side includes: the request sending module is used for sending a template configuration request to the web server;
the template acquisition module is used for receiving editable templates in a webpage form in a built-in library from the web server;
the parameter sending module is used for sending the received configuration parameters input by the user side after the template is configured on the html webpage to the web server, receiving the configuration parameters by the web server, and converting the complete html page file into a pdf file after the web server generates the complete html page file according to the configuration parameters in the web server;
the web server includes:
the request acquisition module is used for receiving a template configuration request from a user side; the template calling module is used for calling the editable template in the webpage form in the built-in library and sending the editable template to the user side;
the parameter acquisition module is used for receiving configuration parameters from the user side, wherein the configuration parameters are generated after the user side configures the template on the received html webpage;
the template rendering module is used for receiving the configuration parameters of the user side and generating a complete html page file; the html-to-pdf module is used for converting the complete html file into a pdf file;
the file storage server is used for transferring the generated pdf file to a file server, and the file server generates a file extraction address after receiving the pdf file and sends the file extraction address to the user side;
the multithreading asynchronous task management module is used for receiving the configuration parameters from the user side, adding the tasks of the configuration parameters into the blocking queue, and returning the generation condition of the tasks and/or the extraction address of the task generation file sent to the user side, and specifically comprises the following steps:
constructing a task thread pool of a blocking queue as a workpiece task thread pool, and performing workpiece work by using an asynchronous thread after receiving a workpiece task;
a task thread pool of a blocking queue is used as a workpiece task failure processing thread pool for retrying, and the retrying is only carried out aiming at the failure caused by network reasons;
and updating the task state.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910290777.9A CN110008195B (en) | 2019-04-11 | 2019-04-11 | Method, device and system for dynamically configuring html (hypertext markup language) to pdf (pdf) |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910290777.9A CN110008195B (en) | 2019-04-11 | 2019-04-11 | Method, device and system for dynamically configuring html (hypertext markup language) to pdf (pdf) |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110008195A CN110008195A (en) | 2019-07-12 |
CN110008195B true CN110008195B (en) | 2020-06-02 |
Family
ID=67171122
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910290777.9A Active CN110008195B (en) | 2019-04-11 | 2019-04-11 | Method, device and system for dynamically configuring html (hypertext markup language) to pdf (pdf) |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110008195B (en) |
Families Citing this family (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110851092A (en) * | 2019-11-15 | 2020-02-28 | 厦门商集网络科技有限责任公司 | Customized printing method and system based on printing template under B/S framework |
CN111243044B (en) * | 2020-01-06 | 2023-04-18 | 福建天泉教育科技有限公司 | PDF transcoding method and storage medium for webpage containing picture |
CN113704187A (en) * | 2020-05-21 | 2021-11-26 | 北京字节跳动网络技术有限公司 | Method and device for generating file |
CN112187909B (en) * | 2020-09-23 | 2022-11-08 | 上海万向区块链股份公司 | Financing information generation system and method based on block chain |
CN112836468A (en) * | 2021-01-21 | 2021-05-25 | 山东健康医疗大数据有限公司 | Method and system for generating pdf document by virtue of front end and back end of server |
CN113723059A (en) * | 2021-07-29 | 2021-11-30 | 微易签(杭州)科技有限公司 | Method and system for converting HTML (hypertext markup language) into PDF (Portable document Format) based on block chain |
CN115242777A (en) * | 2022-07-12 | 2022-10-25 | 观澜网络(杭州)有限公司 | Method, system, server and storage medium for generating file |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105955730A (en) * | 2016-04-26 | 2016-09-21 | 浪潮电子信息产业股份有限公司 | Method for obtaining SSR (Server Security Reinforcement) centralized management platform statement |
CN106776498A (en) * | 2016-12-09 | 2017-05-31 | 山东浪潮商用系统有限公司 | A kind of method that data export as PDF |
Family Cites Families (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20100122233A1 (en) * | 2008-11-13 | 2010-05-13 | Honeywell International Inc. | Software license independent model image generation system and method |
CN102938115B (en) * | 2012-11-22 | 2017-02-08 | 南京途牛科技有限公司 | Contract agreement management system |
US20150149371A1 (en) * | 2013-11-27 | 2015-05-28 | Red Ball Express, LLC | System And Method For Generating And Formatting Formally Correct Case Documents From Rendered Semantic Content |
CN104461538B (en) * | 2014-12-08 | 2018-11-30 | 畅捷通信息技术股份有限公司 | Report form generation method and report generating system |
CN106326306A (en) * | 2015-07-03 | 2017-01-11 | 湖南科兴达信息科技有限公司 | Technology of generating digital newspaper by automatically recognizing PDF file |
CN105786787B (en) * | 2016-02-29 | 2018-07-06 | 四川长虹电器股份有限公司 | Efficient PDF reports test method based on Java |
CN108052490B (en) * | 2017-12-29 | 2019-04-30 | 北京仁和汇智信息技术有限公司 | A kind of online methodology of composition of XML paper and device |
CN109582928B (en) * | 2018-12-06 | 2023-07-21 | 万兴科技股份有限公司 | PDF report data extraction method and device |
-
2019
- 2019-04-11 CN CN201910290777.9A patent/CN110008195B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105955730A (en) * | 2016-04-26 | 2016-09-21 | 浪潮电子信息产业股份有限公司 | Method for obtaining SSR (Server Security Reinforcement) centralized management platform statement |
CN106776498A (en) * | 2016-12-09 | 2017-05-31 | 山东浪潮商用系统有限公司 | A kind of method that data export as PDF |
Also Published As
Publication number | Publication date |
---|---|
CN110008195A (en) | 2019-07-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110008195B (en) | Method, device and system for dynamically configuring html (hypertext markup language) to pdf (pdf) | |
CN109933752B (en) | Method and device for exporting electronic document | |
CN106844307B (en) | System and method for converting Excel into Word based on mark | |
CN104484216A (en) | Method and device for generating service interface document and on-line test tool | |
CN111045655A (en) | Page rendering method and device, rendering server and storage medium | |
CN101526942A (en) | Component implementation technology for automatically generating dynamic web page on line in real time | |
CN110705237B (en) | Automatic document generation method, data processing device and storage medium | |
CN111597484B (en) | UI dynamic generation method | |
US20160277460A1 (en) | Method and apparatus for initiating network conference | |
CN104660635A (en) | Message synchronizing method, device and system | |
CN113312033A (en) | Template protocol generation and management method | |
CN104750472A (en) | Resource bundle management method and device of terminal application | |
CN111208995A (en) | Method, system, device and storage medium for automatically generating IBM host job | |
CN111290996A (en) | Document format conversion method, device, equipment and readable storage medium | |
CN111552464A (en) | SDK generation method, device, equipment and medium | |
CN102521008A (en) | Program compiling device and method for compiling program | |
CN106815181B (en) | Method and device for converting Indesign typesetted ind files into Office files | |
CN111488731B (en) | File generation method, device, computer equipment and storage medium | |
CN111367805B (en) | Development and debugging method and device | |
CN113111281A (en) | DWG drawing preview service method, system and storage medium | |
JP2011070644A (en) | Mashup method and device of network resource | |
CN115514759A (en) | File forwarding method, electronic device and storage medium | |
CN112394930A (en) | Method, electronic device, and medium for automatically constructing front-end interface | |
CN113254017A (en) | Method, device, equipment and medium for generating development template file based on Vue framework | |
CN110543371A (en) | Method and device for remotely calling interface, electronic equipment and storage medium |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |