Method for converting CDA file into PDF file

By creating XML template files and parsing the structured data of CDA documents, PDF documents are dynamically generated and interactive elements are converted into static content, solving the problems of CDA documents being difficult to view and secure. The generated PDF documents are easy to view and secure.

WO2026036971A1PCT designated stage Publication Date: 2026-02-19FUJIAN FOXIT SOFTWARE DEV LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/105473
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2024-08-13
Filing Date
2025-06-30
Publication Date
2026-02-19

AI Technical Summary

Technical Problem

CDA documents are difficult to view and pose security risks, so a method is needed to convert them into easy-to-view and secure PDF documents.

Method used

By creating an XML template file, parsing the structured data of the CDA document, dynamically generating a PDF document, including control positions and data filling, and converting interactive elements into static content to prevent tampering.

Benefits of technology

It makes CDA documents easier to view and improves security. The generated PDF documents are not easily tampered with, solving the difficulties in viewing CDA documents and security issues.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025105473_19022026_PF_FP_ABST
    Figure CN2025105473_19022026_PF_FP_ABST
Patent Text Reader

Abstract

Disclosed is a method for converting a CDA file into a PDF file, comprising: S1: creating an XML template file, the template file comprising predefined information of basic control elements and fields, relative or absolute relationships between positions of different controls in a page, and key values of actual content data files corresponding to attributes of the controls; S2: using XML parsing technology to perform parsing and acquire structured data content of a CDA file; S3: acquiring file type items comprising a CDA file definition from the structured data, each file type corresponding to the created template file, and, on the basis of the file type items, filling the data content into the template file; S4: directly and dynamically computing positions, sizes, and a generation order of different controls on the basis of the preset template file by using custom data in the CDA file for exchange between different systems and devices, on the basis of actual content to be inputted, performing dynamic layout, and generating a PDF file; and S5: converting generated interactive elements in the PDF file into static content.
Need to check novelty before this filing date? Find Prior Art

Description

A method for converting a CDA document into a PDF document TECHNICAL FIELD

[0001] The present application relates to the technical field of data processing, and particularly relates to a method for converting a CDA document into a PDF document. BACKGROUND

[0002] Clinical Document Architecture (CDA) is a standard of electronic document structure in the American Health Information Exchange Standard HL7 (Health Level Seven International). The HL7 CDA defines a standard format for exchanging clinical documents. The CDA document contains electronic document information such as medical records, diagnoses, image reports, laboratory reports, medical record abstracts, diagnosis certificates, and discharge summaries of patients. The HL7 CDA document is a document written in XML format, and a special browser is usually required when viewing the CDA document, and there is a certain risk in security. SUMMARY

[0003] In order to solve the above problems, the present application provides a method for converting a CDA document into a PDF document, which dynamically generates a PDF file by using structured data parsed from the CDA document and a pre-constructed XML template file, so as to convert the CDA document into the PDF document, thereby solving the problems of difficulty in viewing the existing CDA document and the security of the CDA document.

[0004] To achieve the above purpose, the present application provides a method for converting a CDA document into a PDF document, which comprises the following steps:

[0005] Step S1: creating an XML template file, the XML template file including information of pre-defined basic control elements and fields, relative or absolute relationship of positions between different controls in a page, and attributes of the controls to correspond to key-value of actual content data files;

[0006] Step S2: using an XML parsing technology to parse and obtain structured data content of the CDA document;

[0007] Step S3: obtaining document type items defined by the CDA document from the structured data, each document type corresponding to the created XML template file, and filling each data content into the XML template file according to the document type items;

[0008] Step S4: The customized data in the CDA document exchanged between different systems and devices is directly dynamically calculated for different control positions, sizes and generation sequences according to a preset XML template file, and is dynamically laid out according to actual content inputted to generate a PDF document.

[0009] Step S5: The interactive elements generated in the PDF document are converted into static content.

[0010] In an embodiment of the present application, the basic control elements in step S1 include container elements, text elements, image elements and table elements; the relative or absolute relationship of positions between different controls in a page includes the spacing between the controls and the alignment of the controls in the container, and the control text attributes; and the actual content data file includes data that can be parsed by a CDA file or data content files provided by a third party.

[0011] In an embodiment of the present application, the specific process of step S1 of creating an XML template file includes:

[0012] Step S101: Input data of the XML template file to be created and a json file of template data into an editing module;

[0013] Step S102: Edit the data of the XML template file to be created by an XML template editing module of the editing module, and check whether the XML control and its attributes are valid; if yes, continue to check whether the XML attribute binding syntax is correct; if yes, input into a layout module;

[0014] Step S103: Edit the json file of the template data by a json file editing module of the editing module and input into the layout module;

[0015] Step S104: The layout module dynamically calculates control positions, sizes and other information, and then generates a preview view;

[0016] Step S105: If the preview view meets the expectation, generate and export the XML template file and the data file.

[0017] In an embodiment of the present application, the dynamic layout of step S4 is directly dynamically calculating different control positions, sizes and generation sequences according to underlying PDF interface capabilities, PDF text objects or form objects, and dynamically laying out according to actual content files inputted to generate a PDF document.

[0018] In an embodiment of the present application, step S5 is specifically performing a Flatten operation on the interactive elements of the PDF document.

[0019] The method for converting the CDA document into the PDF document provided by the application solves the problem of difficulty in viewing the CDA document and the security problem of the CDA document by generating the PDF document containing the CDA document data from the CDA document. BRIEF DESCRIPTION OF DRAWINGS

[0020] In order to more clearly illustrate the technical solutions in the embodiments of the application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings in the following description only show some of the embodiments of the application, and other drawings can be obtained by those of ordinary skill in the art without any creative effort based on these drawings.

[0021] FIG. 1 is a flowchart of an embodiment of the application;

[0022] FIG. 2 is a flowchart of creating a template in an embodiment of the application. DETAILED DESCRIPTION

[0023] The technical solutions in the embodiments of the application will be described clearly and completely in the following with reference to the drawings in the embodiments of the application. Obviously, the described embodiments are only some of the embodiments of the application, but not all the embodiments. Based on the embodiments in the application, all other embodiments obtained by those of ordinary skill in the art without any creative effort belong to the protection scope of the application.

[0024] FIG. 1 is a flowchart of an embodiment of the application, as shown in FIG. 1, the embodiment provides a method for converting a CDA document into a PDF document, which includes the following steps:

[0025] Step S1: creating an XML template file, the XML template file includes the information of predefined basic control elements and fields, the relative or absolute relationship of the positions between different controls in a page, and an attribute similar to the ID of the control to correspond to the key-value of an actual content data file. The basic control elements may, for example, include container elements, text elements, image elements, table elements, etc. (all of which can be constrained by the CDT of XML); the relative or absolute relationship of the positions between different controls in a page may, for example, include the spacing between controls and the alignment of controls in a container, control text, etc. The actual content data file may, for example, include data parsed from a CDA file or data content files provided by a third party.

[0026] FIG. 2 is a flowchart of creating a template in an embodiment of the application, as shown in FIG. 2, in the embodiment, the specific process of step S1 of creating an XML template file includes:

[0027] Step S101: input the data of the XML template file to be created and the json file of the template data to the editing module;

[0028] Step S102: edit the data of the XML template file to be created by the XML template editing module of the editing module, and check whether the XML control and its attribute are valid, if yes, continue to check whether the XML attribute binding syntax is correct, if yes, input to the layout module;

[0029] Step S103: edit the json file of the template data by the json file editing module of the editing module and input to the layout module;

[0030] Step S104: the layout module dynamically calculates the control position, size and other information, and then generates a preview view;

[0031] Step S105: if the preview view meets the expectation, generate and export the XML template file and the data file.

[0032] The control elements of the embodiment are supported by the syntax rules of the controls, which include basic controls such as shown below, and also support extended custom controls:

[0033] -Page page;

[0034] -TextBlock control with text;

[0035] -Image picture control;

[0036] The container controls for arrangement may, for example, have:

[0037] -Grid container that arranges controls like a table;

[0038] -StackPanel container that arranges controls vertically or horizontally;

[0039] -ListView list control that contains multiple items;

[0040] -Table table control.

[0041] And these controls have control basic attributes that support them, for example, the following attributes possessed by general controls:

[0042] Name-Name of the control;

[0043] Uid-UID identification of the control;

[0044] Width-Width of the control;

[0045] Height-Height of the control;

[0046] Margin - the margin of the control and other controls;

[0047] Visibility - whether the control is visible or not;

[0048] HorizontalAlignment - the horizontal alignment of the control;

[0049] VerticalAlignment - the vertical alignment of the control;

[0050] Also, each control supports its own unique properties, such as:

[0051] The TextBlock control has its own properties such as Text, FontSize, FontFamily, Foreground, etc., where:

[0052] Text - the text string;

[0053] FontSize - the font size;

[0054] FontFamily - the font name;

[0055] Foreground - the font color;

[0056] The Image control has its own properties such as Source, Stretch, etc., where:

[0057] Source - the property source corresponding to the Image;

[0058] Stretch - the image stretching method of the Image;

[0059] The StackPanel control supports the unique properties of the container such as Orientation, Padding, etc., where:

[0060] Orientation - the arrangement of the controls in the container, either Vertical or Horizontal;

[0061] Padding - the margin between the container and the internal controls;

[0062] Both ListView and Table controls support the ItemsSource property:

[0063] ItemsSource - the bound data source of the multiple controls.

[0064] The syntax of the data binding of the control property is explained, and the JSON data can be dynamically updated from the data file without changing the XML template file. In this way, the template can be fixed without modification, but the data file can be modified to update the text content style, etc. The flexible modification of the data JSON file can achieve the effect of flow layout. For example, the string format of x:Bind is bound to the Text in TextBlock, such as <TextBlock Text="{x:Bind Header}">, and the format identifier of "{x:Bind Header}" binds the Text property of TextBlock to the value corresponding to the Header of the JSON data file.

[0065] The following code example shows the case where the container control contains sub-controls. The StackPanel container contains an Image and a TextBlock control:

[0066] <StackPanel Orientation="Vertical" Margin="10,10">

[0067] <Image Source="Assets\StoreLogo.png" Width="30" Height="30" VerticalAlignment="Center">

[0068] <TextBlock Text="{x:Bind Header}" Margin="10,0,0,0" VerticalAlignment="Center" Foreground="{x:Bind HeaderColor}">

[0069]

[0070] Step S2: parse and obtain the CDA document structured data content using XML parsing technology;

[0071] Step S3: obtain the document type item containing the CDA document definition from the structured data, such as medical record, diagnosis, etc. Each document type corresponds to a created XML template file, and according to the document type item, fill each data content into the XML template file. For example, the data is "name: Zhang San", and "Zhang San" is filled into the position of "name" in the template file;

[0072] Step S4: The custom data in the CDA document for exchange between different systems and devices is directly dynamically calculated according to preset XML template files for different control positions, sizes and generation sequences, and is dynamically laid out according to actual content inputted to generate a PDF document.

[0073] The embodiment directly depends on the underlying PDF interface capability, PDF text objects or form objects, etc. to directly dynamically calculate different control positions, sizes and generation sequences, and to realize dynamic layout according to inputted actual content files to generate a PDF document. It is equivalent to embedding original binary data or content into a PDF document. For example, text or binary data can be added to the dictionary of a document object. The embedding into the PDF document refers to adding data to the document structure dictionary of the PDF file.

[0074] The HL7 CDA document is a document written in an XML format, which includes a header and a body. The HL7 CDA specification has defined some common entry types. In addition, custom data needs to be added to the CDA document. The CDA document can be realized by adding or extending elements in the body part of the document. For example, a custom element "PatientCustomData" is created, and sub-elements such as "CustomDataPoint1" and "CustomDataPoint2" are added under it to store custom data. Actual data is stored in the "value" attribute of each sub-element. The data can be normal text data, or formatted text data (such as json format), or binary data base64 encoded base64 string. The data itself is contained in the structured data of the CDA document. The structured data contains all the data in the CDA document. Some of the data is unnecessary to be displayed in the PDF template file. Some data such as image data can be processed, for example, processed into a PDF image object, so that it can be directly displayed and viewed in a PDF reader. The data part that cannot be processed can be selectively embedded into the PDF document according to the needs of the user viewing the PDF document.

[0075] Step S5: The interactive elements generated in the PDF document are converted into static content.

[0076] The interactive elements in the embodiment are generally PDF form objects. The template file itself can predefine some form name fields to have a corresponding relationship with the structured data of the CDA, so the corresponding data text can be directly filled into the corresponding form.

[0077] In the embodiment, the step S5 is specifically performing a Flatten operation on the interactive elements of the PDF document, and after the Flatten operation, the elements cannot be edited or changed, but only become page content, thereby avoiding the generated PDF document from being tampered.

[0078] The "Flatten" operation is a function of a general PDF reader, which is used to convert interactive elements (such as annotations, filled forms, etc.) into static content, and after the operation, the elements have become part of the PDF page content, and thus cannot be edited or changed by user interaction input. As for which content can be subjected to the Flatten operation, whether to perform the Flatten operation can be specified in the attribute of the document root node of the XML template file, and other extended attributes such as whether to mark the control and hide can be specified.

[0079] The method for converting a CDA document into a PDF document provided by the application solves the problem of difficulty in viewing the CDA document and the security problem of the CDA document by generating a PDF document containing CDA document data from the CDA document.

[0080] Those skilled in the art can understand that the accompanying drawings are only schematic diagrams of an embodiment, and the modules or processes in the drawings are not necessarily required for implementing the application.

[0081] Those skilled in the art can understand that the modules in the device in the embodiment can be distributed in the device in the embodiment as described in the embodiment, or can be changed and located in one or more devices different from the embodiment. The modules in the above embodiment can be combined into one module, or can be further split into multiple sub-modules.

[0082] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the application, and not to limit them; although the application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements for some technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the application.

Claims

1. A method of converting a CDA document into a PDF document, characterized by, The method comprises the following steps: Step S1: creating an XML template file, which comprises information of predefined basic control elements and fields, relative or absolute relationship of positions between different controls in a page, and attributes of the controls to correspond to key-values of actual content data files; Step S2: parsing and obtaining CDA document structured data content by using an XML parsing technique; Step S3: obtaining document type items defined by the CDA document from the structured data content, each document type corresponding to the created XML template file, and filling each data content into the XML template file according to the document type items; Step S4: directly and dynamically calculating positions, sizes, and generation sequences of different controls according to a preset XML template file, and dynamically laying out according to actual content to be input, to generate a PDF document for custom data in the CDA document exchanged between different systems and devices; Step S5: converting interactive elements generated in the PDF document into static content.

2. The method of converting a CDA document to a PDF document according to claim 1, wherein, The basic control elements in step S1 comprise container elements, text elements, image elements, and table elements; the relative or absolute relationship of positions between different controls in a page comprises spacing between the controls and alignment of the controls in the container, and text attributes of the controls; and the actual content data file comprises data that can be parsed from a CDA file or data content files provided by a third party.

3. The method of converting a CDA document to a PDF document of claim 1, wherein, The specific process of step S1 of creating the XML template file comprises: Step S101: inputting data of the XML template file to be created and a json file of template data to an editing module; Step S102: editing the data of the XML template file to be created by an XML template editing module of the editing module, checking whether the XML controls and attributes are valid, if yes, checking whether an XML attribute binding syntax is correct, if yes, inputting to a layout module; Step S103: editing the json file of the template data by a json file editing module of the editing module and inputting to the layout module; Step S104: dynamically calculating control positions, sizes, and other information by the layout module, and then generating a preview view; Step S105: if the preview view meets an expectation, generating and exporting the XML template file and the data file.

4. The method of converting a CDA document to a PDF document of claim 1, wherein, The dynamic layout of step S4 is directly and dynamically calculating positions, sizes, and generation sequences of different controls according to underlying PDF interface capabilities, PDF text objects, or form objects, and dynamically laying out according to actual content files to be input, to generate a PDF document.

5. The method of converting a CDA document to a PDF document according to claim 1, wherein, Step S5 is specifically performing a Flatten operation on interactive elements of the PDF document.

Citation Information

Patent Citations

  • PDF document generation method, device and equipment and computer readable storage medium

    CN109710902A

  • Method and device for generating PDF (Portable Document Format) document

    CN112906351A

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

    CN113688619A

  • System and method for converting XML file into PDF file

    CN117933193A

  • Generating high volume accessible documents

    US20200097515A1