A PDF file synchronization method and device

By sharding PDF files and recording verification values, and only transferring or downloading fragments with different verification values, the problem of large amount of data and long time during the synchronization process is solved, and efficient and complete PDF files synchronization is achieved.

CN116846910BActive Publication Date: 2025-08-12SHANGHAI LINGUAN DATA CO LTD +3
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310782017.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-28
Publication Date
2025-08-12
Estimated Expiration
2043-06-28

AI Technical Summary

Technical Problem

In the prior art, when synchronizing PDF files between local electronic devices and servers, the data transmission volume is large and the time is long, and the integrity of the PDF files after synchronization cannot be maintained by page splitting.

Method used

The PDF file is sharded by the sharding method, recording the sequence number and verification value of each shard, and only shard data with different verification values are uploaded or downloaded, and the server stores and merges them according to shards.

Benefits of technology

Reduces the amount of data transmission and synchronization time, ensuring that the data of PDF files is not lost after synchronization, and is suitable for updated PDF files synchronization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116846910B_ABST
    Figure CN116846910B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for synchronizing PDF files. A program or APP in a local electronic device segments the PDF file based on the content stored in the memory of the local electronic device after the PDF file is read, records the serial number of each segment, and calculates the checksum of each segment. When an updated PDF file in a local electronic device needs to be uploaded to a server, and the PDF file has been uploaded to the server before, duplicate segments and new segments are first distinguished, and the program or APP in the local electronic device uploads to the server: the batch number of this upload, the segment serial number of the duplicate segment in the updated PDF file, the data of the new segment, the serial number of the new segment, and the checksum of the new segment; the server merges the new segment data corresponding to the batch number of this upload with the duplicate segment data according to the segment serial number in the updated PDF file, and thus obtains the complete updated PDF file. The present invention can significantly reduce the amount of data transmission and synchronization time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a method for efficiently synchronizing PDF files between a local computer and a server. Background Art

[0002] PDF files can be modified and edited on computers, mobile phones, tablets, and other electronic devices using specific software and apps. This includes adding pages, changing the order of pages, deleting pages, adding, modifying, or deleting annotations, and adding, modifying, or deleting bookmarks. Modifying a PDF file is also called updating a PDF file. The modified PDF file is considered an update compared to the original PDF file.

[0003] Some software and apps can upload PDF files from local electronic devices to servers in the cloud for storage, and can also download PDF files from the server to local electronic devices for storage as needed. This is called PDF file synchronization. In order to ensure that the content of the same PDF file saved in two locations is completely consistent, once the PDF file is updated on the local electronic device, the updated PDF file needs to be uploaded to the server again for storage; once the PDF file is updated on the server, the updated PDF file needs to be downloaded to the local electronic device again for storage. The existing technology is to synchronize the entire PDF file (upload or download). This method of synchronizing the entire PDF file requires a large amount of data to be transmitted and takes a long time.

[0004] The existing technology can split PDF files by page, that is, split them into multiple sub-files according to the page structure of the PDF file. For example, if a PDF file has 10 pages and is split every 2 pages, it will be split into 5 PDF sub-files, each PDF sub-file has 2 pages. This method of splitting PDF files by page has the following characteristics. First, the size of each PDF sub-file is not necessarily the same. The size of a single PDF sub-file cannot be controlled, but depends on the content contained in the PDF sub-file. Second, each PDF sub-file can be browsed and read separately. Third, a single PDF sub-file will lose attribute information such as the outline. Even if all PDF sub-files are merged, the attribute information such as the outline will still be lost, and the size of the merged PDF file may also be different from the size of the original PDF file (essentially, data loss). Therefore, this method of splitting PDF files by page is not perfectly suitable for synchronizing PDF files between local electronic devices and servers. Summary of the Invention

[0005] The technical problem to be solved by the present invention is how to synchronize PDF files, especially updated PDF files, between a local computer and a server while reducing the amount of transmitted data and shortening the synchronization time. This ensures that no matter how large or small the PDF files are, data in the synchronized PDF files is not lost.

[0006] In order to solve the above technical problems, the present invention proposes a method for synchronizing PDF files, which includes the following steps. Step S1: A program or APP in a local electronic device reads a local PDF file, and the content stored in the memory of the local electronic device after the PDF file is read is called a character string. The PDF file is segmented based on the character string, the serial number of each segment is recorded, and the check value of each segment is calculated. Step S2: When a PDF file in a local electronic device needs to be uploaded to a server, and the PDF file has never been uploaded to the server before, the program or APP in the local electronic device uploads to the server: the batch number of this upload, the fixed size of the segment, the id of the PDF file to which each segment belongs, the data of each segment, the serial number of each segment, and the check value of each segment; when the server saves the PDF file, it is stored as a single segment. Step S3: When it is necessary to upload an updated PDF file in a local electronic device to a server, and the PDF file has been previously uploaded to the server, and the server stores the PDF file before the update, the program or APP in the local electronic device first downloads the serial number of each fragment of the PDF file before the update and the check value of each fragment stored in the server to the local electronic device; if the check value of a fragment of the updated PDF file in the local electronic device is the same as the check value of a fragment of the PDF file before the update obtained by downloading, it indicates that the fragment is a duplicate fragment, and the duplicate fragment does not need to be uploaded. It is only necessary to record the fragment serial number of the duplicate fragment in the updated PDF file; if the check value of a fragment of the updated PDF file in the local electronic device is different from the check values of all fragments of the PDF file before the update obtained by downloading, it indicates that the fragment is a new fragment and the new fragment needs to be uploaded. Step S4: The program or APP in the local electronic device uploads to the server: the batch number of this upload, the fragment serial number of the duplicate fragment in the updated PDF file, the data of the new fragment, the serial number of the new fragment, and the check value of the new fragment; the server merges the new fragment data corresponding to the batch number of this upload and the duplicate fragment data according to the fragment serial number in the updated PDF file, and obtains the complete updated PDF file.

[0007] Preferably, in step S1, the program or APP in the local electronic device segments the local PDF file according to the fixed-size character string length, and if the last segment is less than the fixed size, it is split into segments according to the actual size of the segment.

[0008] Furthermore, in step S2, after verifying that all fragments belonging to the same upload batch number meet the following conditions at the same time: (1) the sizes of the fragments except the last fragment all meet the fixed size of the fragment, (2) the IDs of the PDF files to which all fragments belong are the same, (3) the serial numbers of all fragments are continuous, and (4) the check values of all fragments meet the requirements, the server determines that the PDF file of this upload batch number has been uploaded successfully, and sets all fragments corresponding to the upload batch number to a valid state.

[0009] Furthermore, in step S4, after verifying that all fragments belonging to the same upload batch number meet the following conditions at the same time: (1) the sizes of the fragments except the last fragment all meet the fixed size of the fragment, (2) the IDs of the PDF files to which all fragments belong are the same, (3) the serial numbers of all fragments are continuous, and (4) the check values of all fragments meet the requirements, the server determines that the PDF file of this upload batch number has been uploaded successfully, and sets all fragments corresponding to the upload batch number to a valid state.

[0010] Furthermore, step S5 and step S6 are added after step S1. Step S5: When it is necessary to download an updated PDF file from the server to a local device, and the local device has already saved the PDF file before the update, the program or APP in the local electronic device first downloads the serial number and check value of each fragment of the updated PDF file saved in the server to the local electronic device; if the check value of a fragment of the updated PDF file downloaded is the same as the check value of a fragment of the PDF file before the update in the local electronic device, it indicates that the fragment is a duplicate fragment, and the duplicate fragment does not need to be downloaded. It only needs to record the fragment serial number of the duplicate fragment in the updated PDF file; if the check value of a fragment of the updated PDF file downloaded is different from the check values of all fragments of the PDF file before the update in the local electronic device, it indicates that the fragment is a new fragment and the new fragment needs to be downloaded. Step S6: The program or APP in the local electronic device downloads from the server: the data of the new segment, the serial number of the new segment, and the check value of the new segment; the program or APP in the local electronic device merges the new segment data downloaded this time with the duplicate segment data according to the segment serial number in the updated PDF file, and obtains the complete updated PDF file.

[0011] Alternatively, in step S3 or step S5, the subject that performs the judgment is changed from the program or APP in the local electronic device to a remote server.

[0012] Preferably, in step S4 or step S6, the server or local electronic device stores the original version and each updated version of the same PDF file.

[0013] Preferably, in step S2, step S4, or step S6, the program or APP in the local electronic device selects a matching number of concurrent transmissions according to the performance of the local electronic device and / or network conditions.

[0014] The present invention also proposes a PDF file synchronization device, comprising a sharding unit, an original upload unit, an upload preprocessing unit, and an upload synchronization unit. The sharding unit is used to read a local PDF file, and the content stored in the memory of the local electronic device after the PDF file is read is called a string. The PDF file is sliced based on the string, the serial number of each slice is recorded, and the check value of each slice is calculated. The original upload unit is used to upload the following information from the local electronic device to the server when a PDF file in the local electronic device needs to be uploaded to the server and the PDF file has never been uploaded to the server before: the batch number of this upload, the fixed size of the slice, the ID of the PDF file to which each slice belongs, the data of each slice, the serial number of each slice, and the check value of each slice; when the server saves the PDF file, it stores it as a single slice. The upload pre-processing unit is used to compare the check value of each fragment of the updated PDF file in the local electronic device with the check value of each fragment of the PDF file before the update in the server when it is necessary to upload an updated PDF file in the local electronic device to the server, and the PDF file has been uploaded to the server before, and the server stores the PDF file before the update; if the check value of a fragment of the updated PDF file in the local electronic device is the same as the check value of a fragment of the PDF file before the update in the server, it indicates that the fragment is a duplicate fragment, and the duplicate fragment does not need to be uploaded. Only the fragment sequence number of the duplicate fragment in the updated PDF file needs to be recorded; if the check value of a fragment of the updated PDF file in the local electronic device is different from the check values of all fragments of the PDF file before the update in the server, it indicates that the fragment is a new fragment and the new fragment needs to be uploaded. The upload synchronization unit uploads from the local electronic device to the server: the batch number of this upload, the fragment sequence number of the duplicate fragment in the updated PDF file, the data of the new fragment, the sequence number of the new fragment, and the check value of the new fragment; and also merges the new fragment data corresponding to the batch number of this upload and the duplicate fragment data according to the fragment sequence number in the updated PDF file on the server to obtain the complete updated PDF file.

[0015] Furthermore, the PDF file synchronization device further includes a download pre-processing unit and a download synchronization unit. When it is necessary to download an updated PDF file from a server to a local device, and the local device has already saved the PDF file before the update, the download pre-processing unit compares the check value of each fragment of the updated PDF file in the local electronic device with the check value of each fragment of the PDF file before the update in the server; if the check value of a fragment of the updated PDF file in the server is the same as the check value of a fragment of the PDF file before the update in the local electronic device, it indicates that the fragment is a duplicate fragment and the duplicate fragment does not need to be downloaded. Only the fragment sequence number of the duplicate fragment in the updated PDF file needs to be recorded; if the check value of a fragment of the updated PDF file in the server is different from the check values of all fragments of the PDF file before the update in the local electronic device, it indicates that the fragment is a new fragment and needs to be downloaded. The download synchronization unit downloads from the server to the local electronic device: the fragment sequence number of the duplicate fragment in the updated PDF file, the data of the new fragment, the sequence number of the new fragment, and the check value of the new fragment; and also merges the new fragment data downloaded this time with the duplicate fragment data according to the fragment sequence number in the updated PDF file on the local electronic device to obtain the complete updated PDF file.

[0016] The technical effects achieved by the present invention are: ensuring that data is not lost after PDF file synchronization, reducing the amount of transmitted data for synchronizing PDF files between local electronic devices and servers, shortening the synchronization time, and being particularly suitable for synchronizing PDF files updated in a certain location to other locations. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] Figure 1 It is a flowchart of Embodiment 1 of the PDF file synchronization method proposed by the present invention.

[0018] Figure 2 This is a flow chart of a second embodiment of the PDF file synchronization method proposed by the present invention.

[0019] Figure 3 It is a structural diagram of Embodiment 1 of the PDF file synchronization device proposed by the present invention.

[0020] Figure 4 It is a structural diagram of a second embodiment of the device for synchronizing PDF files proposed by the present invention.

[0021] Explanation of the reference numerals in the figure: 1 is a fragmentation unit, 2 is an original upload unit, 3 is an upload pre-processing unit, 4 is an upload synchronization unit, 5 is a download pre-processing unit, and 6 is a download synchronization unit. DETAILED DESCRIPTION

[0022] See also Figure 1 The first embodiment of the PDF file synchronization method proposed by the present invention includes the following steps.

[0023] Step S1: The program or APP in the local electronic device reads the local PDF file and slices the PDF file based on the storage content (called a string or file data string) in the memory of the local electronic device after the PDF file is read, records the sequence number of each slice, and calculates the checksum value (such as MD5) of each slice. Preferably, the program or APP in the local electronic device slices the local PDF file according to the fixed size (i.e., the same) string length. If the last slice is less than the fixed size, it is split into a slice according to the actual size of the slice. For example, if the size of a PDF file is 10.5MB, the total length of its string in the memory of the local electronic device is also 10.5MB. If it is split into 11 slices at a size of 1MB, the size of the first 10 slices is 1MB, and the size of the 11th slice (i.e., the last slice) is 0.5MB.

[0024] After a local PDF file is read by a program or app in a local electronic device, it is stored in the memory of the local electronic device in the form of a string. The local program or app can then fragment the PDF file based on the string. This fragmentation method has the following characteristics. First, the fragmentation does not need to consider the PDF file structure, that is, the fragments are not associated with the pages of the PDF file. The size of each fragment is fully controlled and can be the same or different. Second, each fragment cannot be browsed and read individually. Because a single fragment is not a PDF file, all fragments must be merged in sequence to form a PDF file. Third, after all fragments are merged, all information of the original PDF file (including attribute information such as bookmarks and outlines) is intact and will not be lost. The size of the merged PDF file is exactly the same as the size of the original PDF file, that is, there is no data loss. Therefore, this splitting and merging will not have any impact on the PDF file.

[0025] Step S2: When a PDF file in a local electronic device needs to be uploaded to the server, and the PDF file has never been uploaded to the server before, the program or APP in the local electronic device uploads to the server: the batch number of this upload, the fixed size of the fragment (such as 1MB, not considering the size of the last fragment), the id (identification code) of the PDF file to which each fragment belongs, the data of each fragment, the serial number of each fragment, and the check value of each fragment. The upload batch number is used to distinguish different upload sources to avoid data interference when multiple sources (i.e., one server may correspond to multiple local electronic devices) upload the same PDF file at the same time. The upload process of a PDF file has the same upload batch number. The id of the PDF file is used to distinguish different PDF files. When the server saves the PDF file, it stores it according to a single fragment, and at the same time stores: the upload batch number, the fixed size of the fragment, the id of the PDF file to which each fragment belongs, the data of each fragment, the serial number of each fragment, and the check value of each fragment. Preferably, after verifying that all fragments belonging to the same upload batch number meet the following conditions at the same time: (1) the sizes of the fragments except the last fragment all meet the fixed size of the fragment, (2) the IDs of the PDF files to which all fragments belong are the same, (3) the serial numbers of all fragments are continuous, and (4) the check values of all fragments meet the requirements, the server determines that the PDF file of this upload batch number has been uploaded successfully, and sets all fragments corresponding to the upload batch number to a valid state, which can be subsequently downloaded by other devices based on the fragments.

[0026] Step S3: When an updated PDF file in a local electronic device needs to be uploaded to a server, and the PDF file has previously been uploaded to the server, and the server stores the PDF file before the update, the program or app in the local electronic device first downloads the serial number and checksum of each fragment of the PDF file before the update stored on the server to the local electronic device. If the program or app in the local electronic device and the server may use different fixed sizes for the fragments of the PDF file, it is also preferred to download the fixed size of the fragments of the PDF file before the update stored on the server to the local electronic device. If the checksum of a fragment of the updated PDF file in the local electronic device is the same as the checksum of a fragment of the PDF file before the update downloaded, it indicates that the fragment is a duplicate fragment. The duplicate fragment does not need to be uploaded. Instead, the fragment serial number of the duplicate fragment in the updated PDF file needs to be recorded. If the checksum of a fragment of the updated PDF file in the local electronic device is different from the checksum of all fragments of the PDF file before the update downloaded, it indicates that the fragment is a new fragment and needs to be uploaded. Then, the process proceeds to step S4.

[0027] Alternatively, in step S3, the subject that performs the judgment is changed from the program or APP in the local electronic device to the remote server. The program or APP in the local electronic device first uploads the serial number and check value of each fragment of the local updated PDF file to the server. If the check value of a certain fragment of the updated PDF file obtained by uploading is the same as the check value of any fragment of the PDF file before the update in the server, it indicates that the fragment is a duplicate fragment, and the duplicate fragment does not need to be uploaded. It is only necessary to record the fragment serial number of the duplicate fragment in the updated PDF file. If the check value of a certain fragment of the updated PDF file obtained by uploading is different from the check value of all fragments of the PDF file before the update in the server, it indicates that the fragment is a new fragment and the new fragment needs to be uploaded.

[0028] Step S4: The program or app in the local electronic device uploads to the server: the batch number of this upload, the fragment sequence number of the duplicate fragment in the updated PDF file, the data of the new fragment, the sequence number of the new fragment, and the checksum value of the new fragment. The server merges the new fragment data corresponding to the batch number of this upload with the duplicate fragment data according to the fragment sequence number in the updated PDF file, and then obtains the complete updated PDF file. This process can save a large number of duplicate fragment uploads, saving both data transmission volume and upload time. Preferably, the server verifies that all fragments belonging to the same upload batch number meet the following conditions: (1) the sizes of all fragments except the last fragment meet the fixed size of the fragment, (2) the IDs of the PDF files to which all fragments belong are the same, (3) the serial numbers of all fragments (the serial numbers of the duplicate fragments under the current upload batch number in the updated PDF file, as well as the serial numbers of the new fragments) are continuous, and (4) after the verification values of all fragments meet the requirements, it is determined that the PDF file of the current upload batch number has been uploaded successfully, and all fragments corresponding to the upload batch number are set to a valid state, which can be subsequently downloaded by other devices based on the fragments. Preferably, the server saves the original version and each updated version of the same PDF file to facilitate subsequent comparative analysis.

[0029] See also Figure 2 The second embodiment of the PDF file synchronization method proposed by the present invention includes the following steps.

[0030] Step S1: The same as step S1 in embodiment 1, and then proceed to step S5.

[0031] Step S5: When it is necessary to download an updated PDF file from the server to the local computer, and the local computer has already saved the PDF file before the update, the program or APP in the local electronic device first downloads the serial number and check value of each fragment of the updated PDF file saved in the server to the local electronic device. If the check value of a fragment of the updated PDF file downloaded is the same as the check value of a fragment of the PDF file before the update in the local electronic device, it indicates that the fragment is a duplicate fragment, and the duplicate fragment does not need to be downloaded. It is only necessary to record the fragment serial number of the duplicate fragment in the updated PDF file. If the check value of a fragment of the updated PDF file downloaded is different from the check values of all fragments of the PDF file before the update in the local electronic device, it indicates that the fragment is a new fragment and the new fragment needs to be downloaded. Then proceed to step S6.

[0032] Alternatively, in step S5, the subject that performs the judgment is changed from the program or APP in the local electronic device to the remote server. The program or APP in the local electronic device first uploads the serial number and check value of each fragment of the local PDF file before the update to the server. If the check value of a fragment of the updated PDF file in the server is the same as the check value of any fragment of the PDF file before the update obtained by uploading, it indicates that the fragment is a duplicate fragment, and the duplicate fragment does not need to be downloaded. It is only necessary to record the fragment serial number of the duplicate fragment in the updated PDF file. If the check value of a fragment of the updated PDF file in the server is different from the check value of all fragments of the PDF file before the update obtained by uploading, it indicates that the fragment is a new fragment and the new fragment needs to be downloaded.

[0033] Step S6: The program or APP in the local electronic device downloads from the server: the data of the new fragment, the serial number of the new fragment, and the check value of the new fragment. The program or APP in the local electronic device merges the newly downloaded fragment data with the duplicate fragment data according to the fragment serial number in the updated PDF file, and thus obtains the complete updated PDF file. This process can save the download of a large number of duplicate fragments, which not only saves data transmission volume but also reduces download time. Preferably, the original version and each updated version of the same PDF file are saved in the local electronic device to facilitate subsequent comparative analysis.

[0034] Preferably, in step S2, step S4, and step S6, the program or APP in the local electronic device selects a matching number of concurrent transmissions according to the performance of the local electronic device and / or network conditions.

[0035] See also Figure 3The first embodiment of the PDF file synchronization device proposed by the present invention includes a fragmentation unit 1, an original uploading unit 2, an upload pre-processing unit 3, and an upload synchronization unit 4.

[0036] The sharding unit 1 is used to read a local PDF file and fragment the PDF file based on the storage content (called a string or file data string) in the memory of the local electronic device after the PDF file is read, record the serial number of each fragment, and calculate the check value of each fragment.

[0037] The original uploading unit 2 is used to upload the following information to the server from the local electronic device when a PDF file in the local electronic device needs to be uploaded to the server and the PDF file has never been uploaded to the server before: the batch number of the current upload, the fixed size of the slices, the ID of the PDF file to which each slice belongs, the data of each slice, the serial number of each slice, and the checksum of each slice. When the server saves the PDF file, it stores it as a single slice and also stores the following information: the batch number of the upload, the fixed size of the slices, the ID of the PDF file to which each slice belongs, the data of each slice, the serial number of each slice, and the checksum of each slice.

[0038] The upload pre-processing unit 3 is used to compare the checksum of each fragment of the updated PDF file in the local electronic device with the checksum of each fragment of the PDF file before the update in the server when a PDF file in the local electronic device needs to be uploaded to the server, and the PDF file has been uploaded to the server before, and the server stores the PDF file before the update. If the checksum of a fragment of the updated PDF file in the local electronic device is the same as the checksum of a fragment of the PDF file before the update in the server, it indicates that the fragment is a duplicate fragment, and the duplicate fragment does not need to be uploaded. Only the fragment sequence number of the duplicate fragment in the updated PDF file needs to be recorded. If the checksum of a fragment of the updated PDF file in the local electronic device is different from the checksum of all fragments of the PDF file before the update in the server, it indicates that the fragment is a new fragment and the new fragment needs to be uploaded.

[0039] The upload synchronization unit 4 uploads the following information from the local electronic device to the server: the batch number of the current upload, the fragment sequence number of the duplicate fragment in the updated PDF file, the data of the new fragment, the sequence number of the new fragment, and the checksum of the new fragment. The upload synchronization unit 4 merges the new fragment data corresponding to the batch number of the current upload with the duplicate fragment data according to the fragment sequence number in the updated PDF file on the server, thereby obtaining the complete updated PDF file.

[0040] See also Figure 4The second embodiment of the PDF file synchronization device proposed by the present invention includes a fragmentation unit 1, a download pre-processing unit 5, and a download synchronization unit 6.

[0041] The fragmentation unit 1 is the same as that in the first embodiment, and then enters the download synchronization unit 4.

[0042] When it is necessary to download an updated PDF file from the server to the local device, and the local device has already saved the PDF file before the update, the download pre-processing unit 5 compares the checksum of each fragment of the updated PDF file in the local electronic device with the checksum of each fragment of the PDF file before the update in the server. If the checksum of a fragment of the updated PDF file in the server is the same as the checksum of a fragment of the PDF file before the update in the local electronic device, it indicates that the fragment is a duplicate fragment and the duplicate fragment does not need to be downloaded. Only the fragment sequence number of the duplicate fragment in the updated PDF file needs to be recorded. If the checksum of a fragment of the updated PDF file in the server is different from the checksum of all fragments of the PDF file before the update in the local electronic device, it indicates that the fragment is a new fragment and needs to be downloaded.

[0043] The download synchronization unit 6 downloads from the server to the local electronic device: the fragment sequence number of the duplicate fragment in the updated PDF file, the data of the new fragment, the fragment sequence number of the new fragment, and the checksum of the new fragment. The download synchronization unit 6 merges the newly downloaded fragment data with the duplicate fragment data according to the fragment sequence number in the updated PDF file on the local electronic device to obtain the complete updated PDF file.

[0044] Compared with the prior art, the PDF file synchronization method and device proposed in the present invention have the following beneficial effects. First, the present invention segments the PDF file based on the storage content (called a string, or a file data string) in the memory of the local electronic device after the PDF file is read, and can completely retain all the data of the original PDF file after all the segments are merged, without data loss. Second, the present invention performs data synchronization after the PDF file is updated in units of segments, first checks the check value of each segment, and only synchronizes the segments with different check values, and does not synchronize the segments with the same check value, thereby significantly reducing the amount of data transmission and synchronization time. The technical solution of the present invention was applied for testing. The original PDF file was saved on mobile phones A and B. After the PDF file was updated through the APP on mobile phone A, it was first synchronized and uploaded to the server, and then the updated PDF file was downloaded by the APP on mobile phone B. The synchronization time of the present invention was significantly shortened compared to that of competing products, reflecting a huge performance advantage. Moreover, the less the content of the PDF file is updated, the more obvious this performance advantage is.

[0045] The above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Those skilled in the art will appreciate that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention are intended to be within the scope of protection of the present invention.

Claims

1. A method for synchronizing a PDF file, characterized in that: The method includes the following steps: Step S1: A program or app in a local electronic device reads a local PDF file. The content stored in the memory of the local electronic device after the PDF file is read is called a string. The PDF file is fragmented based on the string, the sequence number of each fragment is recorded, and a checksum value for each fragment is calculated. Step S2: When a PDF file in a local electronic device needs to be uploaded to the server, and the PDF file has never been uploaded to the server before, the program or app in the local electronic device uploads to the server: the upload batch number, the fixed size of the slices, the ID of the PDF file to which each slice belongs, the data of each slice, the sequence number of each slice, and the checksum of each slice; When the server saves a PDF file, it stores it as a single fragment; Step S3: When an updated PDF file in a local electronic device needs to be uploaded to a server, and the PDF file has been previously uploaded to the server and the server stores the PDF file before the update, the program or app in the local electronic device first downloads the serial number of each fragment and the checksum of each fragment of the PDF file before the update stored in the server to the local electronic device; If the checksum of a fragment of the updated PDF file in the local electronic device is the same as the checksum of a fragment of the downloaded PDF file before the update, it indicates that the fragment is a duplicate fragment and does not need to be uploaded. Only the fragment sequence number of the duplicate fragment in the updated PDF file needs to be recorded. If the checksum of a fragment of the updated PDF file in the local electronic device is different from the checksum of all fragments of the downloaded PDF file before the update, it indicates that the fragment is a new fragment and needs to be uploaded. Step S4: The program or APP in the local electronic device uploads to the server: the batch number of this upload, the fragment serial number of the duplicate fragment in the updated PDF file, the data of the new fragment, the serial number of the new fragment, and the check value of the new fragment; the server merges the new fragment data corresponding to the batch number of this upload and the duplicate fragment data according to the fragment serial number in the updated PDF file, and obtains the complete updated PDF file.

2. The method for synchronizing PDF files according to claim 1, wherein: In step S1, the program or APP in the local electronic device segments the local PDF file according to the fixed-size character string length. If the last segment is less than the fixed size, it is split into a segment according to the actual size of the segment.

3. The method for synchronizing PDF files according to claim 1, wherein: In step S2, the server verifies that all fragments belonging to the same upload batch number meet the following conditions at the same time: (1) the sizes of the fragments except the last fragment all meet the fixed size of the fragment, (2) the IDs of the PDF files to which all fragments belong are the same, (3) the serial numbers of all fragments are continuous, and (4) the check values of all fragments meet the requirements. Then, the server determines that the PDF file of the upload batch number is uploaded successfully and sets all fragments corresponding to the upload batch number to a valid state.

4. The method for synchronizing PDF files according to claim 1, wherein: In step S4, the server verifies that all fragments belonging to the same upload batch number meet the following conditions at the same time: (1) the sizes of the fragments except the last fragment all meet the fixed size of the fragment, (2) the IDs of the PDF files to which all fragments belong are the same, (3) the serial numbers of all fragments are continuous, and (4) the check values of all fragments meet the requirements. Then, the server determines that the PDF file of the upload batch number is uploaded successfully and sets all fragments corresponding to the upload batch number to a valid state.

5. The method for synchronizing PDF files according to claim 1, wherein: Add steps S5 and S6 after step S1; Step S5: When it is necessary to download an updated PDF file from the server to a local device, and the local device has already saved the PDF file before the update, the program or APP in the local electronic device first downloads the serial number and check value of each fragment of the updated PDF file saved in the server to the local electronic device; if the check value of a fragment of the updated PDF file downloaded is the same as the check value of a fragment of the PDF file before the update stored in the local electronic device, it indicates that the fragment is a duplicate fragment and the duplicate fragment does not need to be downloaded. Only the fragment serial number of the duplicate fragment in the updated PDF file needs to be recorded; if the check value of a fragment of the updated PDF file downloaded is different from the check values of all fragments of the PDF file before the update stored in the local electronic device, it indicates that the fragment is a new fragment and the new fragment needs to be downloaded; Step S6: The program or APP in the local electronic device downloads from the server: the data of the new segment, the serial number of the new segment, and the check value of the new segment; the program or APP in the local electronic device merges the new segment data downloaded this time with the duplicate segment data according to the segment serial number in the updated PDF file, and obtains the complete updated PDF file.

6. The PDF file synchronization method according to claim 1 or 5, characterized in that: In step S3 or step S5, the subject that performs the judgment is changed from the program or APP in the local electronic device to the remote server.

7. The method for synchronizing PDF files according to claim 1 or 5, wherein: In step S4 or step S6, the server or local electronic device stores the original version and each updated version of the same PDF file.

8. The method for synchronizing PDF files according to claim 1 or 5, wherein: In step S2, step S4, or step S6, the program or APP in the local electronic device selects a matching number of concurrent transmissions according to the performance of the local electronic device and / or the network conditions.

9. A PDF file synchronization device, characterized in that: Includes fragmentation unit, original upload unit, upload pre-processing unit, and upload synchronization unit; The slicing unit is used to read a local PDF file, the content stored in the memory of the local electronic device after the PDF file is read is called a string, the PDF file is sliced based on the string, the sequence number of each slice is recorded, and the check value of each slice is calculated; The original uploading unit is used to upload a PDF file in the local electronic device to the server when it is necessary to upload the PDF file to the server, and the PDF file has never been uploaded to the server before, from the local electronic device to the server: the upload batch number, the fixed size of the fragments, the ID of the PDF file to which each fragment belongs, the data of each fragment, the sequence number of each fragment, and the checksum of each fragment; When the server saves a PDF file, it stores it as a single fragment; The upload pre-processing unit is used to compare the checksum of each fragment of the updated PDF file in the local electronic device with the checksum of each fragment of the PDF file in the server before the update when it is necessary to upload an updated PDF file in the local electronic device to the server, and the PDF file has been uploaded to the server before and the server stores the PDF file before the update; If the checksum of a fragment of the updated PDF file in the local electronic device is the same as the checksum of a fragment of the PDF file before the update in the server, it indicates that the fragment is a duplicate fragment and does not need to be uploaded. Only the fragment sequence number of the duplicate fragment in the updated PDF file needs to be recorded. If the checksum of a fragment of the updated PDF file in the local electronic device is different from the checksum of all fragments of the PDF file before the update in the server, it indicates that the fragment is a new fragment and needs to be uploaded. The upload synchronization unit uploads from the local electronic device to the server: the batch number of this upload, the fragment sequence number of the duplicate fragment in the updated PDF file, the data of the new fragment, the sequence number of the new fragment, and the check value of the new fragment; and also merges the new fragment data corresponding to the batch number of this upload and the duplicate fragment data according to the fragment sequence number in the updated PDF file on the server to obtain the complete updated PDF file.

10. The PDF file synchronization device according to claim 9, wherein: It also includes a download pre-processing unit and a download synchronization unit; When it is necessary to download an updated PDF file from the server to the local computer and the PDF file before the update is already stored locally, the download pre-processing unit compares the checksum of each fragment of the updated PDF file in the local electronic device with the checksum of each fragment of the PDF file before the update in the server; If the checksum of a certain fragment of the updated PDF file on the server is the same as the checksum of a certain fragment of the PDF file before the update on the local electronic device, it indicates that the fragment is a duplicate fragment and the duplicate fragment does not need to be downloaded. Only the fragment sequence number of the duplicate fragment in the updated PDF file needs to be recorded. If the checksum of a certain fragment of the updated PDF file on the server is different from the checksum of all fragments of the PDF file before the update on the local electronic device, it indicates that the fragment is a new fragment and the new fragment needs to be downloaded. The download synchronization unit downloads from the server to the local electronic device: the fragment sequence number of the duplicate fragment in the updated PDF file, the data of the new fragment, the sequence number of the new fragment, and the check value of the new fragment; and also merges the new fragment data downloaded this time with the duplicate fragment data according to the fragment sequence number in the updated PDF file on the local electronic device to obtain the complete updated PDF file.

Citation Information

Patent Citations

  • Method and system for digital rights enforcement

    CA2855308A1

  • Cloud printing method and system based on file fragmentation, printing cloud box and storage medium

    CN110825330A