How to quickly and high-quality output PDF experiment report?

Abstract: This article was originally published on CSDN by the technical team of Grape City. Please indicate the source of the reprint: Grape City official website , Grape City provides developers with professional development tools, solutions and services to empower developers.

The printing of PDF documents will be used in many application scenarios, the most common one is the application scenario of laboratory information management, which involves a large number of report presentation and printing requirements.

LIMS background introduction

Laboratory Information Management System (LIMS) is an information management tool that combines information technology with database as the core and laboratory management requirements. Based on the ISO/IEC17025:2017 CNAS-CL01 "General Requirements for Testing and Calibration Laboratory Capabilities" (the national standard is GB/T 27025:2008), combined with network technology, the laboratory's business processes, all resources and administrative Management, etc. are managed in a reasonable manner.

LIMS system requirements and solutions

In the process of building the LIMS system, the main requirements of the LIMS system are the design of the experimental template, the filling of the experimental data, the export of a complete PDF experimental report, and the realization of a paperless and systematic inspection process. So how to quickly and high-quality output PDF experiment report?

With the help of SpreadJS table technology and GcExcel, it only takes three steps to complete the development of the entire function:

  1. Integrate SpreadJS into the system to quickly realize online data entry
  2. Configure the parameters required to export PDF documents in the system
  3. Export the experiment report as a PDF file via GcExcel

specific steps

  1. Use SpreadJS to complete the realization of template design and experimental data filling

Using SpreadJS 's online table editor, experimenters can complete the design of experimental reports through Excel-like operations.

SpreadJS can be quickly integrated into the existing system through the following code:

Create a JavaScript application:

Note that SpreadJS has no dependencies, only the following files are needed: gc.spread.sheets.xx.xxcss, gc.spread.sheets.all.xx.xxmin.js.

<!DOCTYPE html><html lang="zh"><head>

<meta charset="utf-8" \>

<script src="gc.spread.sheets.all.xx.x.x.min.js"><link rel="stylesheet" href="gc.spread.sheets.xx.x.x.css"type="text/css"\><head\>

<body\><body\></html\>

添加SpreadJS容器元素 - 在页面的body元素中添加一个DOM元素作为它的容器。

<div id="ss">\</div\>

//初始化SpreadJS JavaScript控件。 - SpreadJS控件通过使用new GC.Spread.Sheets.Workbook(document.getElementById('ss'), { sheetCount: 1 })来进行初始化。

window.onload = function () {
    
    // Initialize a workbookvar workbook = new GC.Spread.Sheets.Workbook(document.getElementById('ss'), { sheetCount: 1 });// get workbook object// var workbook = GC.Spread.Sheets.findControl(document.getElementById('ss'));

};

After the embedding is completed, through the data binding function of SpreadJS, some default data can be loaded from the database and displayed in the experiment template, and the experimental data reported by the experimenter can also be easily obtained through data binding

  1. Use SpreadJS to complete the configuration of exporting PDF (printing)

Use the SpreadJS online form editor to complete the configuration of the exported PDF, configurable export area, repeat area, header, footer, watermark, etc., to customize the exported PDF report.

  1. Export the experiment report with GCExcel

After completing the template design, experimental data reporting, and various printing configurations in SpreadJS, the entire experimental template file can be exported as a json and sent to the backend, which can be loaded with GCExcel, which is perfectly compatible with the characteristics of SpreadJS. The configuration of the template in SpreadJS and the configuration of the exported PDF are perfectly compatible in GCExcel. Of course, the configuration of the template and the configuration of PDF export can also be completed in GCExcel.

Java Workbook workbook = new Workbook(); //打开SpreadJS导出的模板 workbook.open("template.ssjson");  // 导出PDF配置  PdfSaveOptions pdfSaveOptions = new PdfSaveOptions(); // 配置支持换行缩小  pdfSaveOptions.getShrinkToFitSettings().setCanShrinkToFitWrappedText(true);  // 导出PDF  workbook.save("ExportPdf.pdf");


At this point, the printing of the PDF document is completed.

If you want to try the Lims system, you can visit this online Demo link:
https://demo.grapecity.com.cn/spreadjs/demos/cases/#/preview?template=limsData

Advantages of using SpreadJS and GCExcel to build a LIMS system

  1. SpreadJS can help the LIMS system to quickly realize the data binding function and realize automatic data extraction. For example, entrusting unit information, routine monitoring tasks, etc. can be directly called after the first entry, and it supports modifying monitoring items and generating new ones when calling historical tasks. Task orders do not need to be entered repeatedly, which greatly reduces labor costs and error rates.
  2. Using the SpreadJS design template, the system obtains the instrument test data and fills in the original record sheet (preset calculation formula, rounding off, etc.) to directly generate an Excel record sheet. By selecting a report template to generate a complete monitoring report, the whole process does not need to write original records. There is no need to repeatedly enter monitoring data, which is convenient and fast with high accuracy.
  3. SpreadJS provides permission control methods, which can standardize the modification process and strictly control report modification.
  4. Exported PDFs can be precisely configured using Spread.
  5. GCExcel is perfectly compatible with the SpreadJS features, and can export complete PDF experiment reports in batches at the back end, which is both beautiful and efficient.

Extension link :

Create AcroForm-enabled PDF files from applications with the C1 PDF control

Converting images to searchable PDF files with text, metadata using LEADTOOLS: 25 projects in 25 days

Project Combat: Online Quotation Procurement System (React +SpreadJS+Echarts)

Implementing Excel server-side import and export under the Spring Boot framework

Guess you like

Origin blog.csdn.net/powertoolsteam/article/details/131423128