CN112380828A - PDF document generation method and device, storage medium and electronic equipment - Google Patents

PDF document generation method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN112380828A
CN112380828A CN202011211392.8A CN202011211392A CN112380828A CN 112380828 A CN112380828 A CN 112380828A CN 202011211392 A CN202011211392 A CN 202011211392A CN 112380828 A CN112380828 A CN 112380828A
Authority
CN
China
Prior art keywords
page
chart
target
character string
document
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
CN202011211392.8A
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.)
Qianhai Feisuan Yunchuang Data Technology Shenzhen Co ltd
Original Assignee
Qianhai Feisuan Yunchuang Data Technology Shenzhen 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 Qianhai Feisuan Yunchuang Data Technology Shenzhen Co ltd filed Critical Qianhai Feisuan Yunchuang Data Technology Shenzhen Co ltd
Priority to CN202011211392.8A priority Critical patent/CN112380828A/en
Publication of CN112380828A publication Critical patent/CN112380828A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/186Templates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/20Drawing from basic elements, e.g. lines or circles
    • G06T11/206Drawing of charts or graphs

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • General Engineering & Computer Science (AREA)
  • Document Processing Apparatus (AREA)

Abstract

The present disclosure relates to a method and apparatus for generating a PDF document, a storage medium, and an electronic device, where the method includes a method applied to a front end of a page and a method applied to a back end of the page, where the method applied to the front end includes: acquiring diagram data in a target page sent by the back end of the page; drawing the chart data into a picture through a drawing tool, and converting the picture into a character string; and sending the character string to the page rear end, and acquiring a target PDF document generated by the page rear end based on the character string and a document template of the target page, wherein the target PDF document comprises a picture corresponding to the chart data. The method and the device can improve the quality of the PDF document generated based on the page content.

Description

PDF document generation method and device, storage medium and electronic equipment
Technical Field
The present disclosure relates to the field of data processing, and in particular, to a method and an apparatus for generating a PDF document, a storage medium, and an electronic device.
Background
PDF (Portable Document Format) is a common Document Format, can be used to display various forms of content such as text and diagrams, and is widely used in life and production, and storing web pages in PDF Format is also a preferred way to display web page content. In the conventional method for converting a web page into a PDF file, the graph data in the web page is usually unchanged, and the graph may be drawn and stored in advance, and is called when the PDF file is generated. However, in a scenario where chart data in a web page may change, for example, when the web page is used to present a real-time statistic, the conventional PDF generating method has difficulty in drawing and storing in advance in the face of chart data that changes in real time, and thus has difficulty in generating a PDF file.
At present, a chart can be drawn through a java back end, and a PDF file corresponding to a web page is generated based on a picture drawn by the java back end, but the picture drawn by the java back end is poor in quality and not attractive and clear enough; the front end can also generate a picture with higher quality through a front end drawing tool, and the picture content is intercepted through the screenshot form to generate the PDF file, but the stability of screenshot is not high, which may cause the format error of the PDF file.
Disclosure of Invention
The present disclosure is directed to a PDF document generating method and apparatus, a storage medium, and an electronic device, so as to solve the above technical problems.
In order to achieve the above object, a first aspect of the present disclosure provides a PDF document generating method, where the method is applied to a page front end, and includes: acquiring diagram data in a target page sent by the back end of the page; drawing the chart data into a picture through a drawing tool, and converting the picture into a character string; and sending the character string to the page rear end, and acquiring a target PDF document generated by the page rear end based on the character string and a document template of the target page, wherein the target PDF document comprises a picture corresponding to the chart data.
Optionally, the obtaining of the chart data in the target page sent by the page back end includes: responding to a document generation request, and sending a chart request to the page back end, wherein the chart request comprises a request moment and a target page identifier; and obtaining chart data of the target page sent by the page rear end at the request moment.
Optionally, the drawing the chart data into a picture by a drawing tool, and converting the picture into a character string includes: drawing the chart data into a picture through an Echarts drawing tool or a highcharts drawing tool, and converting the picture into a character string through a conversion module of the Echarts drawing tool or the highcharts drawing tool.
In a second aspect of the present disclosure, a PDF document generating method is provided, where the method is applied to a page back end, and the method includes: sending the chart data in the target page to the front end of the page; acquiring a character string sent by the page front end, wherein the character string is obtained by drawing a picture based on the chart data and converting the picture by the page front end; and generating a target PDF document based on the character string and a document template of the target PDF document, wherein the target PDF document comprises a picture corresponding to the chart data.
Optionally, the sending the chart data in the target page to the page front end includes: acquiring a chart request sent by the page front end, wherein the chart request comprises a request moment and a target page identifier; and calling graph data of the target page corresponding to the target page identification at the request moment, and sending the graph data to the front end of the page.
Optionally, a plurality of document templates and a corresponding relationship between the document templates and the page identifiers are stored at the back end of the page, wherein the document templates include chart character strings and fixed character strings, the fixed character strings correspond to invariant content in the page, and the chart character strings correspond to chart content in the page which changes along with time; generating a target PDF document based on the character string and the document template of the target PDF document, wherein the generating comprises: and replacing the chart character string in the document template by using the character string, and converting the replaced document template into a format corresponding to the target PDF document.
In a third aspect of the present disclosure, there is provided a PDF document generating apparatus applied to a page front end, the apparatus including: the graph acquisition module is used for acquiring graph data in a target page sent by the rear end of the page; the chart drawing module is used for drawing the chart data into a picture through a drawing tool and converting the picture into a character string; and the document acquisition module is used for sending the character string to the page rear end and acquiring a target PDF document generated by the page rear end based on the character string and a document template of the target page, wherein the document comprises a picture corresponding to the chart data.
Optionally, the graph content in the target page changes with time, and the graph obtaining module is configured to send a graph request to the page back end in response to a document generation request, and obtain graph data of the target page sent by the page back end at the request time, where the graph request includes a request time and a target page identifier.
Optionally, the chart drawing module is configured to draw the chart data into a picture by using an Echarts drawing tool or a highcharts drawing tool, and convert the picture into a character string by using a conversion module of the Echarts drawing tool or the highcharts drawing tool.
In a fourth aspect of the present disclosure, a PDF document generating apparatus is provided, where the apparatus is applied to a page back end, and the apparatus includes: the chart sending module is used for sending the chart data in the target page to the front end of the page; the character acquisition module is used for acquiring a character string sent by the front end of the page, wherein the character string is obtained by drawing a picture based on the chart data and converting the picture by the front end of the page; and the document generating module is used for generating a target PDF document based on the character string and a document template of the target PDF document, wherein the target PDF document comprises a picture corresponding to the chart data.
Optionally, the graph content in the target page changes with time, and the graph sending module is configured to obtain a graph request sent by the page front end, call graph data of the target page corresponding to the target page identifier at the request time, and send the graph data to the page front end, where the graph request includes the request time and the target page identifier.
Optionally, a plurality of document templates and a corresponding relationship between the document templates and the page identifiers are stored at the back end of the page, wherein the document templates include chart character strings and fixed character strings, the fixed character strings correspond to invariant content in the page, and the chart character strings correspond to chart content in the page which changes along with time; and the document generation module is used for replacing the chart character string in the document template by using the character string and converting the replaced document template into a format corresponding to the target PDF document.
In a fifth aspect of the disclosure, a computer-readable storage medium is provided, on which a computer program is stored, which program, when executed by a processor, performs the steps of the method of any one of the first or second aspects of the disclosure.
A sixth aspect of the present disclosure provides an electronic device comprising a memory having a computer program stored thereon and a processor configured to execute the computer program in the memory to implement the steps of the method of any one of the first or second aspects of the present disclosure.
Through the technical scheme, at least the following technical effects can be realized:
when generating the PDF file of the target page, the graph data is obtained from the rear end, the picture is drawn through the drawing tool at the front end, the picture is converted into a character string and is sent to the rear end, and the PDF file is made through the rear end, so that the PDF file including the graph content in the page is generated, and the quality of the PDF file generated based on the page is improved.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows.
Drawings
The accompanying drawings, which are included to provide a further understanding of the disclosure and are incorporated in and constitute a part of this specification, illustrate embodiments of the disclosure and together with the description serve to explain the disclosure without limiting the disclosure. In the drawings:
fig. 1 is a flow chart illustrating a PDF document generating method according to an exemplary disclosed embodiment.
Fig. 2 is a flow chart illustrating a method of generating a PDF document according to an exemplary disclosed embodiment.
Fig. 3 is a block diagram illustrating a PDF document generating device according to an exemplary disclosed embodiment.
Fig. 4 is a block diagram illustrating a PDF document generating device according to an exemplary disclosed embodiment.
FIG. 5 is a block diagram illustrating an electronic device according to an exemplary disclosed embodiment.
FIG. 6 is a block diagram illustrating an electronic device according to an exemplary disclosed embodiment.
Detailed Description
The following detailed description of specific embodiments of the present disclosure is provided in connection with the accompanying drawings. It should be understood that the detailed description and specific examples, while indicating the present disclosure, are given by way of illustration and explanation only, not limitation.
FIG. 1 is a flow chart illustrating a PDF document generation method applied to a page front end, as shown in FIG. 1, including the steps of:
and S11, obtaining the chart data in the target page sent by the back end of the page.
The target page is a page to be generated with PDF, the page is shown at the front end and includes diagram content, and the diagram content is generated based on the back-end data, so that in the process of generating a PDF document, diagram data related to the diagram content shown in the target page can be called from the back end.
In a possible implementation manner, the chart content in the target page is variable, and the chart data in the target page acquired from the page back end may be chart data at the time of generating the chart or chart data at the time specified by the user.
For example, the chart content may be generated based on real-time data, for example, the chart content may be a temperature map of a certain place, a financial flow chart of a certain shop, or the like, the content of the charts may change with time and may not be drawn and stored in advance in the template, the chart data at the current time may be acquired from the page back end for drawing the chart in response to a document generation request sent by the user, the document generation request may further include a request time, and the chart data corresponding to the request time may be acquired from the page back end, and the request time may be a specific designated time or the current time.
In one possible implementation, the front end may send a chart request to the page back end based on the document generation request, the chart request may include the request time and the target page identifier, and the back end may send corresponding chart data to the front end based on the request time and the target page identifier, so that the front end draws an image.
And S12, drawing the chart data into a picture through a drawing tool, and converting the picture into a character string.
Since the front end drawing tool generally has better drawing performance than the rear end drawing tool and can draw better pictures, the front end drawing tool may be configured as a front end drawing tool, for example, a drawing tool such as Echarts, highcharts, etc.
The front-end drawing tool can draw pictures in the forms of line drawings, pie charts, column charts and the like or other pictures which can be spliced by components of the front-end drawing tool based on the chart information, and after the drawing is completed, the front-end drawing tool can convert the pictures into base64 character strings and send the character strings to the back end, so that the back end generates a PDF file based on the character strings.
It should be noted that the front end drawing tool may perform diagram drawing in an area outside the display page, for example, the front end drawing tool may be set to be in a top: 1000 to avoid drawing tools affecting page aesthetics and page utility when drawing charts.
S13, sending the character string to the page back end, and obtaining a target PDF document generated by the page back end based on the character string and the document template of the target page, wherein the target PDF document comprises a picture corresponding to the chart data.
The page back end can generate a document template in advance based on each page, and each page template can comprise a chart character string and a fixed character string, wherein the fixed character string corresponds to the unchanged content in the page, and the chart character string corresponds to the chart content which changes along with time in the page. The document template can be generated through an html component and can be stored in advance in an html format, after the character string sent by the front end is received, the back end can replace the chart character string in the template with the character string sent by the front end, and the document template is converted into a PDF format and returned to the front end for the front end to export or display.
Through the technical scheme, at least the following technical effects can be realized:
when generating the PDF file of the target page, the graph data is obtained from the rear end, the picture is drawn through the drawing tool at the front end, the picture is converted into a character string and is sent to the rear end, and the PDF file is made through the rear end, so that the PDF file including the graph content in the page is generated, and the quality of the PDF file generated based on the page is improved.
Fig. 2 is a flow chart illustrating a method of generating a PDF document according to an exemplary disclosed embodiment. The method is applied to the back end of the page, and as shown in fig. 1, comprises the following steps:
and S21, sending the chart data in the target page to the front end of the page.
The target page is a page to be generated with PDF, the page is shown at the front end and includes diagram content, and the diagram content is generated based on the back-end data, so that in the process of generating a PDF document, diagram data related to the diagram content shown in the target page can be called from the back end.
In a possible implementation mode, the chart content in the target page is variable, and the chart data sent by the page back end to the page front end can be the chart data at the moment of generating the chart or the chart data at the moment specified by the user.
For example, the chart content may be generated based on real-time data, for example, the chart content may be a temperature map of a certain place, a financial flow chart of a certain shop, or the like, and the chart content may change with time and may not be drawn in advance and stored in the template. And sending the chart data corresponding to the request time to the page front end, wherein the request time can be specific appointed time or current time.
And S22, acquiring a character string sent by the front end of the page, wherein the character string is obtained by drawing a picture based on the chart data and converting the picture by the front end of the page.
Since the front end drawing tool generally has better drawing performance than the back end drawing tool and can draw better pictures, the front end of the page can draw pictures based on the front end drawing tool, for example, the front end drawing tool can be Echarts, highcharts, and other drawing tools.
The front-end drawing tool can draw pictures in the forms of line drawings, pie charts, bar charts and the like based on the chart information, or other pictures which can be spliced by the components of the front-end drawing tool, and after the drawing is completed, the front-end drawing tool can convert the pictures into base64 character strings.
And S23, generating a target PDF document based on the character string and the document template of the target PDF document, wherein the target PDF document comprises a picture corresponding to the chart data.
The page back end can generate a document template in advance based on each page, and each page template can comprise a chart character string and a fixed character string, wherein the fixed character string corresponds to the unchanged content in the page, and the chart character string corresponds to the chart content which changes along with time in the page. The document template can be generated through an html component and can be stored in advance in an html format, after the character string sent by the front end is received, the back end can replace the chart character string in the template with the character string sent by the front end, and the document template is converted into a PDF format and returned to the front end for the front end to export or display.
Specifically, the page back end may generate a PDF file through a freemarker, an itext, and other tools, or generate a PDF file through another feature pack with similar functions.
Through the technical scheme, at least the following technical effects can be realized:
when generating the PDF file of the target page, the graph data is obtained from the rear end, the picture is drawn through the drawing tool at the front end, the picture is converted into a character string and is sent to the rear end, and the PDF file is made through the rear end, so that the PDF file including the graph content in the page is generated, and the quality of the PDF file generated based on the page is improved.
It should be noted that the front end and the back end of the page in the two embodiments may be located in different devices, for example, the front end of the page may be set in a terminal, the back end of the page may be set in a server, and data communication may be performed between the front end and the back end of the page; the front end and the back end of the page may also be located in the same device and completed by different functional areas, which is not limited by the present disclosure.
Fig. 3 is a block diagram illustrating a PDF document generating device according to an exemplary disclosed embodiment. The apparatus is applied to a front end of a page, as shown in fig. 3, the apparatus 300 includes:
the graph obtaining module 310 is configured to obtain graph data in a target page sent by a back end of the page.
And the chart drawing module 320 is used for drawing the chart data into a picture through a drawing tool and converting the picture into a character string.
The document obtaining module 330 is configured to send the character string to the page back end, and obtain a target PDF document generated by the page back end based on the character string and a document template of the target page, where the document includes a picture corresponding to the chart data.
Optionally, the graph content in the target page changes with time, and the graph obtaining module 310 is configured to send a graph request to the page back end in response to a document generation request, and obtain graph data of the target page sent by the page back end at the request time, where the graph request includes the request time and a target page identifier.
Optionally, the chart drawing module 320 is configured to draw the chart data into a picture through an Echarts drawing tool or a highcharts drawing tool, and convert the picture into a character string through a conversion module of the Echarts drawing tool or the highcharts drawing tool.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Through the technical scheme, at least the following technical effects can be realized:
when generating the PDF file of the target page, the graph data is obtained from the rear end, the picture is drawn through the drawing tool at the front end, the picture is converted into a character string and is sent to the rear end, and the PDF file is made through the rear end, so that the PDF file including the graph content in the page is generated, and the quality of the PDF file generated based on the page is improved.
Fig. 4 is a block diagram illustrating a PDF document generating device according to an exemplary disclosed embodiment. The apparatus is applied to the back end of the page, as shown in fig. 4, the apparatus 400 includes:
and a chart sending module 410, configured to send the chart data in the target page to the page front end.
A character obtaining module 420, configured to obtain a character string sent by the page front end, where the character string is obtained by the page front end drawing a picture based on the graph data and converting the picture.
A document generating module 430, configured to generate a target PDF document based on the character string and a document template of the target PDF document, where the target PDF document includes a picture corresponding to the chart data.
Optionally, the graph content in the target page changes with time, and the graph sending module 410 is configured to obtain a graph request sent by the page front end, call graph data of the target page corresponding to the target page identifier at the request time, and send the graph data to the page front end, where the graph request includes the request time and the target page identifier.
Optionally, a plurality of document templates and a corresponding relationship between the document templates and the page identifiers are stored at the back end of the page, wherein the document templates include chart character strings and fixed character strings, the fixed character strings correspond to invariant content in the page, and the chart character strings correspond to chart content in the page which changes along with time; the document generating module 430 is configured to replace a chart character string in a document template with the character string, and convert the replaced document template into a format corresponding to the target PDF document.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Through the technical scheme, at least the following technical effects can be realized:
when generating the PDF file of the target page, the graph data is obtained from the rear end, the picture is drawn through the drawing tool at the front end, the picture is converted into a character string and is sent to the rear end, and the PDF file is made through the rear end, so that the PDF file including the graph content in the page is generated, and the quality of the PDF file generated based on the page is improved.
Fig. 5 is a block diagram illustrating an electronic device 500 in accordance with an example embodiment. As shown in fig. 5, the electronic device 500 may include: a processor 501 and a memory 502. The electronic device 500 may also include one or more of a multimedia component 503, an input/output (I/O) interface 504, and a communication component 505. The electronic device 500 may be provided as a user terminal.
The processor 501 is configured to control the overall operation of the electronic device 500, so as to complete all or part of the steps in the PDF document generating method. The memory 502 is used to store various types of data to support operation at the electronic device 500, such as instructions for any application or method operating on the electronic device 500 and application-related data, such as contact data, messaging, pictures, audio, video, and so forth. The Memory 502 may be implemented by any type of volatile or non-volatile Memory device or combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic Memory, flash Memory, magnetic disk or optical disk. The multimedia component 503 may include a screen and an audio component. Wherein the screen may be, for example, a touch screen and the audio component is used for outputting and/or inputting audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal may further be stored in the memory 502 or transmitted through the communication component 505. The audio assembly also includes at least one speaker for outputting audio signals. The I/O interface 504 provides an interface between the processor 501 and other interface modules, such as a keyboard, mouse, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 505 is used for wired or wireless communication between the electronic device 500 and other devices. Wireless Communication, such as Wi-Fi, bluetooth, Near Field Communication (NFC), 2G, 3G, 4G, NB-IOT, eMTC, or other 5G, etc., or a combination of one or more of them, which is not limited herein. The corresponding communication component 505 may thus comprise: Wi-Fi module, Bluetooth module, NFC module, etc.
In an exemplary embodiment, the electronic Device 500 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components for performing the PDF document generating method described above.
In another exemplary embodiment, there is also provided a computer readable storage medium comprising program instructions which, when executed by a processor, implement the steps of the PDF document generation method described above. For example, the computer readable storage medium may be the memory 502 described above including program instructions that are executable by the processor 501 of the electronic device 500 to perform the PDF document generation method described above.
Fig. 6 is a block diagram illustrating an electronic device 600 according to an example embodiment. For example, the electronic device 600 may be provided as a server. Referring to fig. 6, the electronic device 600 includes a processor 622, which may be one or more in number, and a memory 632 for storing computer programs executable by the processor 622. The computer program stored in memory 632 may include one or more modules that each correspond to a set of instructions. Further, the processor 622 may be configured to execute the computer program to perform the PDF document generating method described above.
Additionally, electronic device 600 may also include a power component 626 that may be configured to perform power management of electronic device 600 and a communication component 650 that may be configured to enable communication, e.g., wired or wireless communication, of electronic device 600. The electronic device 600 may also include input/output (I/O) interfaces 658. The electronic device 600 may operate based on an operating system, such as Windows Server, stored in the memory 632TM,Mac OS XTM,UnixTM,LinuxTMAnd so on.
In another exemplary embodiment, there is also provided a computer readable storage medium comprising program instructions which, when executed by a processor, implement the steps of the PDF document generation method described above. For example, the computer readable storage medium may be the memory 632 described above that includes program instructions that are executable by the processor 622 of the electronic device 600 to perform the PDF document generation method described above.
In another exemplary embodiment, a computer program product is also provided, which comprises a computer program executable by a programmable apparatus, the computer program having code portions for performing the PDF document generating method described above when executed by the programmable apparatus.
The preferred embodiments of the present disclosure are described in detail with reference to the accompanying drawings, however, the present disclosure is not limited to the specific details of the above embodiments, and various simple modifications may be made to the technical solution of the present disclosure within the technical idea of the present disclosure, and these simple modifications all belong to the protection scope of the present disclosure.
It should be noted that, in the foregoing embodiments, various features described in the above embodiments may be combined in any suitable manner, and in order to avoid unnecessary repetition, various combinations that are possible in the present disclosure are not described again.
In addition, any combination of various embodiments of the present disclosure may be made, and the same should be considered as the disclosure of the present disclosure, as long as it does not depart from the spirit of the present disclosure.

Claims (10)

1. A PDF document generation method is applied to a page front end and comprises the following steps:
acquiring diagram data in a target page sent by the back end of the page;
drawing the chart data into a picture through a drawing tool, and converting the picture into a character string;
and sending the character string to the page rear end, and acquiring a target PDF document generated by the page rear end based on the character string and a document template of the target page, wherein the target PDF document comprises a picture corresponding to the chart data.
2. The method of claim 1, wherein the chart content in the target page changes over time,
the acquiring of the diagram data in the target page sent by the page back end includes:
responding to a document generation request, and sending a chart request to the page back end, wherein the chart request comprises a request moment and a target page identifier;
and obtaining chart data of the target page sent by the page rear end at the request moment.
3. The method of claim 1, wherein the drawing the chart data into a picture by a drawing tool and converting the picture into a character string comprises:
drawing the chart data into a picture through an Echarts drawing tool or a highcharts drawing tool, and converting the picture into a character string through a conversion module of the Echarts drawing tool or the highcharts drawing tool.
4. A PDF document generation method is applied to a page back end and comprises the following steps:
sending the chart data in the target page to the front end of the page;
acquiring a character string sent by the page front end, wherein the character string is obtained by drawing a picture based on the chart data and converting the picture by the page front end;
and generating a target PDF document based on the character string and a document template of the target PDF document, wherein the target PDF document comprises a picture corresponding to the chart data.
5. The method of claim 4, wherein the chart content in the target page changes over time,
the sending of the chart data in the target page to the page front end includes:
acquiring a chart request sent by the page front end, wherein the chart request comprises a request moment and a target page identifier;
and calling graph data of the target page corresponding to the target page identification at the request moment, and sending the graph data to the front end of the page.
6. The method according to claim 5, wherein a plurality of document templates are stored in the page back end, and the document templates and the page identifiers correspond to each other, wherein the document templates include chart character strings and fixed character strings, the fixed character strings correspond to unchanged content in the page, and the chart character strings correspond to chart content in the page which changes along with time;
generating a target PDF document based on the character string and the document template of the target PDF document, wherein the generating comprises:
and replacing the chart character string in the document template by using the character string, and converting the replaced document template into a format corresponding to the target PDF document.
7. A PDF document generating apparatus applied to a page front end, the apparatus comprising:
the graph acquisition module is used for acquiring graph data in a target page sent by the rear end of the page;
the chart drawing module is used for drawing the chart data into a picture through a drawing tool and converting the picture into a character string;
and the document acquisition module is used for sending the character string to the page rear end and acquiring a target PDF document generated by the page rear end based on the character string and a document template of the target page, wherein the document comprises a picture corresponding to the chart data.
8. A PDF document generating apparatus applied to a page back end, comprising:
the chart sending module is used for sending the chart data in the target page to the front end of the page;
the character acquisition module is used for acquiring a character string sent by the front end of the page, wherein the character string is obtained by drawing a picture based on the chart data and converting the picture by the front end of the page;
and the document generating module is used for generating a target PDF document based on the character string and a document template of the target PDF document, wherein the target PDF document comprises a picture corresponding to the chart data.
9. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 6.
10. An electronic device, comprising:
a memory having a computer program stored thereon;
a processor for executing the computer program in the memory to carry out the steps of the method of any one of claims 1 to 6.
CN202011211392.8A 2020-11-03 2020-11-03 PDF document generation method and device, storage medium and electronic equipment Pending CN112380828A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011211392.8A CN112380828A (en) 2020-11-03 2020-11-03 PDF document generation method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011211392.8A CN112380828A (en) 2020-11-03 2020-11-03 PDF document generation method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN112380828A true CN112380828A (en) 2021-02-19

Family

ID=74578051

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011211392.8A Pending CN112380828A (en) 2020-11-03 2020-11-03 PDF document generation method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN112380828A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113688619A (en) * 2021-08-05 2021-11-23 深圳集智数字科技有限公司 PDF document generation method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106202546A (en) * 2016-07-27 2016-12-07 浪潮软件集团有限公司 data analysis display method based on template
CN109284453A (en) * 2018-07-19 2019-01-29 平安科技(深圳)有限公司 Data download method and device based on PDF document, storage medium, terminal
CN109558574A (en) * 2018-10-16 2019-04-02 广州市南方人力资源评价中心有限公司 A kind of generation online testing examination question processing method
CN109710902A (en) * 2018-08-17 2019-05-03 深圳壹账通智能科技有限公司 Generation method, device, equipment and the computer readable storage medium of PDF document
CN110287468A (en) * 2019-06-27 2019-09-27 苏宁消费金融有限公司 PDF document generation method and system suitable for online protocol

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106202546A (en) * 2016-07-27 2016-12-07 浪潮软件集团有限公司 data analysis display method based on template
CN109284453A (en) * 2018-07-19 2019-01-29 平安科技(深圳)有限公司 Data download method and device based on PDF document, storage medium, terminal
CN109710902A (en) * 2018-08-17 2019-05-03 深圳壹账通智能科技有限公司 Generation method, device, equipment and the computer readable storage medium of PDF document
CN109558574A (en) * 2018-10-16 2019-04-02 广州市南方人力资源评价中心有限公司 A kind of generation online testing examination question processing method
CN110287468A (en) * 2019-06-27 2019-09-27 苏宁消费金融有限公司 PDF document generation method and system suitable for online protocol

Non-Patent Citations (6)

* Cited by examiner, † Cited by third party
Title
JINGXIAN: "将html页面保存成图片,图片写入pdf的实现方法", 《HTTPS://WWW.JB51.NET/ARTICLE/92730.HTM》 *
JY352: "Echarts导出为pdf", 《HTTPS://BLOG.CSDN.NET/QQ_22778121/ARTICLE/DETAILS/54175358》 *
LIAOSILEI0927: "EChars页面图表数据导出为pdf需求记录", 《HTTPS://BLOG.CSDN.NET/LIAOSILEI0927/ARTICLE/DETAILS/93714191》 *
QQ_26676207: "java根据模板导出PDF详细教程(包含统计图)", 《HTTPS://BLOG.CSDN.NET/QQ_26676207/ARTICLE/DETAILS/80966003》 *
VOIDCN: "利用html5Canvas将Highchart图表导出图片", 《HTTP://WWW.VOIDCN.COM/ARTICLE/P-EQCWLPVV-XS.HTML》 *
用心倾听: "图库highcharts联合jquery ajax 后端取数据前端图表渲染", 《HTTPS://BLOG.CSDN.NET/JIARY5201314/ARTICLE/DETAILS/39612689》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113688619A (en) * 2021-08-05 2021-11-23 深圳集智数字科技有限公司 PDF document generation method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
WO2019019361A1 (en) Method and apparatus for processing data of database, computer device, and storage medium
CN110955416A (en) Interface document generation method, device, equipment and computer storage medium
CN111683066B (en) Heterogeneous system integration method, heterogeneous system integration device, computer equipment and storage medium
CN108027725B (en) Method, device and equipment for guiding terminal equipment operation
CN111061678B (en) Service data processing method, device, computer equipment and storage medium
CN111443909B (en) Method and device for generating page
CN114138372B (en) Front-end component loading method and device
CN111198892A (en) Information processing method, information processing device, electronic equipment and storage medium
CN110727417A (en) Data processing method and device
CN111369237B (en) Data processing method and device and computer storage medium
CN113190152A (en) Method and device for switching application program theme
CN115794437A (en) Calling method and device of microservice, computer equipment and storage medium
CN101894021A (en) Method and system for realizing interface of embedded system
CN110704030A (en) Interface configuration information generation method and device, electronic equipment and storage medium
US10931610B2 (en) Method, device, user terminal and electronic device for sharing online image
CN112380828A (en) PDF document generation method and device, storage medium and electronic equipment
CN112988311A (en) On-line experimental method based on WEB server
JP2019101889A (en) Test execution device and program
WO2023169193A1 (en) Method and device for generating smart contract
CN109614592B (en) Text processing method and device, storage medium and electronic equipment
CN112231011B (en) Activiti-based flow chart adjustment method and device, electronic equipment and storage medium
CN111897529B (en) Front-end component conversion method, device, equipment and readable storage medium
CN111177558B (en) Channel service construction method and device
CN114022300A (en) Social dynamic information publishing method and device, storage medium and electronic equipment
CN114371866A (en) Version reconfiguration test method, device and equipment of service system

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20210219

RJ01 Rejection of invention patent application after publication