A method, system and storage medium for uploading slices of PDF for quick preview
Slicing and analysis through the PDF processing library realizes fast preview and partial loading of PDF files, solves the problem of low preview efficiency in the existing technology, improves user experience and simplifies file management.
Patent Information
- Application Number
- CN202410741474.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-11
- Publication Date
- 2024-09-06
- Estimated Expiration
- 2044-06-11
AI Technical Summary
The existing technology cannot preview part of the content after the PDF slices are uploaded, resulting in inefficiency for users when searching for specific content. The entire PDF file needs to be loaded to search, which affects the user experience.
By receiving and reading the original PDF file, using the PDF processing library to perform slicing operations, analyzing the content layout, rendering and saving each slice image, and assigning an implication coefficient to support partial loading and splicing, a fast preview is achieved.
It can load only the required slices, save bandwidth and resources, improve the preview efficiency of PDF files, facilitate sharing and management, and provide fine permission control and version management.
Smart Images

Figure CN118313351B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of file configuration, and in particular to a slice uploading method and system for quick preview of PDF and a storage medium thereof. Background Art
[0002] Portable Document Format, also known as PDF (Portable Document Format), is a file format that crosses operating system platforms. It can encapsulate text, fonts, graphics, images, colors, layouts, and parameters related to printing equipment in one file, keeping page elements unchanged during network transmission, printing, and plate-making output. It can also contain electronic information such as hypertext links, audio and video, and has high integration and security reliability.
[0003] However, when we use PDF, it often takes a long time to preview and load due to too many pages. In order to improve the loading speed, the PDF is sliced and uploaded. However, we found in the process of use that the existing slicing upload technology cannot preview part of the content in the PDF after uploading the PDF in slices, nor can it preview the selected content. It is still necessary to open the entire PDF and then search for related content in it. This is very inconvenient. It will be very troublesome to search for some pages with a large number of pages, which will greatly reduce the efficiency of using PDF files. Summary of the invention
[0004] The purpose of the present invention is to provide a slice uploading method, system and storage medium for quick preview of PDF, which can speed up PDF loading, reduce resource consumption, improve user experience, support partial loading and provide security, so as to solve the problems raised in the above background technology.
[0005] To achieve the above object, the present invention provides the following technical solution: a method for uploading slices of a quick preview PDF, comprising the following steps:
[0006] S1: Receive and read the original PDF file, use the PDF processing library, use the code to read the original PDF file, obtain the number of pages in the PDF file and the size of the corresponding page, and calculate the maximum and minimum number of slices for each page;
[0007] S2: Perform slicing operations, analyze the content of the PDF file and obtain the content layout, divide the page into slices according to the content and layout of each PDF page, loop through each divided slice on the page, render each slice at the same time, and save it as an image file;
[0008] S3: assigning and saving slice files, assigning an involvement coefficient to each slice image so that slice images with similar contents can be spliced together, and saving the slice images assigned with the involvement coefficient to a suitable location;
[0009] S4: Upload slice files, upload slice image files to the target platform or storage location, and update related database records at the same time.
[0010] Preferably, the analysis of the PDF file content in S2 includes determining the number of title levels according to the text volume in the PDF file. The number of title levels is proportional to the text volume. Initially, there is one level, that is, only the first-level title is divided for content. When the text volume is greater than a set threshold, the title level corresponding to the threshold is introduced. The threshold can be set manually.
[0011] Preferably, the specific steps of performing slicing in S2 are as follows:
[0012] Step 1: Classify the pages according to the analyzed PDF page content, and classify the pages with interconnected content into the same set class, and set the set to A (A1, A2, A3, ... An), where n is the page number;
[0013] Step 2: Use the lower left corner edge point of the PDF page as the coordinate origin to perform preliminary slicing of the PDF pages in the collection class, and then adjust the slicing size specifications according to the content and layout of each page;
[0014] Step 3: Assign corresponding coordinate values to each corner of the divided slices;
[0015] Step 4: Perform slice rendering and map the coordinates corresponding to the slices onto the rendered image file.
[0016] Preferably, the specific method of assigning values in S3 is as follows:
[0017] Analyze the content of each slice image and compare it with the original analyzed PDF page content;
[0018] Extract the sliced images whose contents differ from the original PDF page contents, and re-slice the sliced images until the contents of the sliced images do not differ from the original PDF page contents.
[0019] The page number on the PDF page related to the content of the slice image without difference is extracted as an involvement coefficient and assigned to the corresponding slice image.
[0020] Preferably, when performing preliminary slicing in step 2, a preliminary number of slices is determined based on the margin and direction of the page, the preliminary number of slices is between the maximum number of slices and the minimum number of slices of the corresponding page, and the size of each slice is calculated using the page size and the preliminary number of slices.
[0021] Preferably, the slices divided from pages belonging to the same collection class have the same size.
[0022] Preferably, the slice file saved in S3 saves the image data to the file through the File object, and further processes it using the BufferedImage object in the memory where the slice image file is saved.
[0023] Preferably, the S4 performs security and permission control when uploading slice files, including file permission checking, using safe file operations, avoiding code injection, data isolation and encryption, logging and monitoring.
[0024] In addition, the present invention also provides a slice uploading system for quick preview of PDF, including a memory for storing programs, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program executes the slice uploading method for quick preview of PDF when running.
[0025] In addition, the present invention also provides a storage medium, including an internally stored upgrade program, which controls a computer device to execute the slice upload method for quickly previewing a PDF when the upgrade program is running.
[0026] In summary, the beneficial effects of the present invention are:
[0027] The present invention can load only the required partial slices according to user needs, without having to load the entire PDF file, saving bandwidth and resources. At the same time, some content slices related to the selected loaded slice content will also be pulled and spliced to the periphery of the PDF page, thereby greatly facilitating people to preview part of the content in the PDF, so that people do not need to search the entire PDF for the part of the content they do not understand, which greatly improves efficiency.
[0028] 1. Convenient sharing and transfer: After splitting large PDF files into small pieces, they can be more conveniently transferred and shared via email, cloud storage or other means;
[0029] 2. Save bandwidth and time: Uploading and downloading small PDF files requires less time and bandwidth, especially when the network connection is slow or unstable;
[0030] 3. Fine-grained permission control: You can selectively share specific parts of the PDF as needed, thereby achieving more fine-grained permission control to ensure that only specific people can access specific content;
[0031] 4. Version management: By splitting PDF files, version control can be performed more easily because only the modified parts need to be uploaded or downloaded instead of the entire file;
[0032] 5. Easy to manage and organize: Splitting PDF files into logical segments can better organize and manage files, making them easier to find and use. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0034] Figure 1 A schematic diagram of an upload flow chart of a method for uploading slices of a quick PDF preview according to the present invention;
[0035] Figure 2 A schematic diagram of slice division in an embodiment of a slice uploading method for fast previewing PDF of the present invention;
[0036] Figure 3 A schematic diagram of slice division in an embodiment of a slice uploading method for fast previewing PDF of the present invention;
[0037] Figure 4 A schematic diagram of uploading in a slice uploading system for quickly previewing PDF according to the present invention;
[0038] Figure 5 A schematic diagram of an upload interface in a slice upload system for quickly previewing PDF of the present invention;
[0039] Figure 6 A schematic diagram of the upload waiting time in a slice upload system for quick PDF preview of the present invention; DETAILED DESCRIPTION
[0040] All features disclosed in this specification, or steps in all methods or processes disclosed, except mutually exclusive features and / or steps, can be combined in any manner.
[0041] Any feature disclosed in this specification (including any additional claims, abstract and drawings), unless otherwise stated, may be replaced by other equivalent or alternative features with similar purposes. That is, unless otherwise stated, each feature is only an example of a series of equivalent or similar features.
[0042] In the present invention, unless otherwise clearly defined and specified, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection, a direct connection, or an indirect connection through an intermediate medium, it can be the internal connection of at least two elements or the interaction relationship between at least two elements, unless otherwise clearly defined. For those of ordinary skill in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0043] Combine the following Figure 1-6 The present invention is described in detail. Embodiment 1 provided by the present invention: a method for uploading slices of a PDF for quick preview, comprising the following steps:
[0044] first step:
[0045] Choose a suitable PDF processing library to read the original PDF file. There are many open source PDF processing libraries in Java, such as iText, PDFBox, etc. Choose a library that suits your needs to slice PDF. Here, we choose to use Apache PDFBox, which is an open source Java tool for processing PDF (Portable Document Format) files. It provides a rich set of APIs that allow developers to perform a variety of operations, including but not limited to reading, creating, modifying, and extracting content from PDF documents;
[0046] Use the PDFTextStripper class to extract text content from the original PDF file, then use the getNumberOfPages() method to get the number of pages in the PDF document, use the getPage() method to get the PDPage object of a specific page, and then use the getMediaBox() method to get the page size. In this way, the number of pages in the original PDF file and the size of the corresponding page are extracted. Based on the page size and the text content of the corresponding page, the maximum and minimum number of page slices can be calculated while ensuring the slice content and layout.
[0047] Step 2:
[0048] To perform the slicing operation, first analyze the extracted PDF file content, and classify the pages according to the content of each page, and classify the pages with interconnected content into the same collection class. The PDF file content analysis relied on in the generation process of the collection class includes at least the following quick analysis methods: Method 1, classify the collection according to the relevance of the title text. When there is related title content in the PDF file, it belongs to the same collection classification, and the directory page is directly associated with the homepage where each title is located. At this time, the title content at the same level will be classified under the same category, and the title level is determined by the PDF text. The method is determined by the style of the content, and is automatically summarized according to the styles of the first-level title, second-level title, and third-level title in the general PDF text. In this method, the number of levels in the PDF file is first determined. The number of levels is proportional to the text volume. Generally, there is only one level by default, that is, only the first-level title is used for content division. When the text volume is greater than the set threshold value 1 (which can be set by yourself, generally 60 pages by default), the level where the second-level title is located is introduced, that is, the relevance of the second-level title is classified; when the text volume is greater than the set threshold value 2, the level where the third-level title is located is introduced, that is, the relevance of the third-level title is classified;
[0049] Method 2: Jump classification based on links. When there are a large number of links in the PDF file, the links are analyzed. When the links point to the same thing, they belong to the same set classification. The classification method is the same as method 1.
[0050] Method 3, based on Method 1 and Method 2, also has a collection classification operation in the case of paging of text and pictures. For example, if there is a link in a text paragraph, and the paragraph is distributed across pages, the related page and the page containing the link belong to the same collection classification; if the text and picture pointed to by a link have paging, the related paging belongs to the same collection classification. In addition, the analysis of the extracted PDF file content also allows manual direct specification of which specific paging belongs to the same collection classification;
[0051] Through the above method, the collection class can be set to A (A1, A2, A3, ... An), where n is the page number of the page. The page contents in the A collection are connected to each other, and the total collection of the entire PDF file is (An, Bn, ... Zn). In the total collection, repeated numbers such as A1 and B1 can be allowed, or repeated numbers such as A1 and B1 can be set not to be allowed. If repeated numbers are not allowed, specific pages that belong to the same collection classification can be directly specified manually, and the link classification is the second priority, and the collection classification is performed according to the relevance of the title text. Allowing repeated numbers such as A1 and B1 in the total collection can improve the relevance between each page, so that as many pages with connected content as possible are classified into the same collection class, and the same collection class will not miss important pages. If you choose to not allow duplicate numbers such as A1 and B1, you can eliminate the problem of duplicate resource loading when previewing related pages, and try to control the number of pages loaded in each preview within a reasonable range. Generally speaking, duplicate numbers such as A1 and B1 are not allowed in PDFs with more text pages, but are allowed in PDFs with fewer text pages.
[0052] Use the lower left corner of the PDF page as the coordinate origin to perform preliminary slicing of the PDF pages in the collection class. Figure 2 and Figure 3 For example, when slicing an A1 page, the edge point o (0,0) at the lower left corner is used as the coordinate origin. A preliminary number of slices is determined according to the margin and direction of the A1 page. A1 is initially divided into 9 slices. The preliminary number of slices is between the maximum and minimum number of slices of the corresponding page. Then, the size of each slice can be calculated using the size of the A1 page. The slice size is used to adapt the page content and layout of A1 to see if the size has an impact on the page layout. If so, it is adjusted. In most cases, there will be no impact, except for the case where images account for a large proportion of the page content.
[0053] It should be noted that the slices divided from pages belonging to the same collection class have the same size, which makes it easier to use the slices for splicing and display when previewing is needed later, thus facilitating preview without having to search everywhere;
[0054] After dividing the A1 page, assign corresponding coordinate values to each corner of the divided slices, which are:
[0055] After A1 is divided, each divided slice is looped on the page, and each slice is rendered using PDFRenderer. The coordinates corresponding to the slice are mapped on the rendered image file and saved as an image file. Then, each slice image has a corresponding coordinate position.
[0056] Step 3:
[0057] Assign a value to each slice image, first analyze the content of each slice image, and compare it with the original analyzed PDF page content, take out the slice image with different content from the original PDF page content, and re-slice this part until there is no difference between the slice image content and the original PDF page content, and take out the page number on the PDF page related to the slice image content with no difference as the involvement coefficient and assign it to the corresponding slice image, so that when people need to preview a certain content in the PDF file, the main PDF page slice with the content will be first spliced to form a preview, and then the slice image with the page number of the page will be gradually pulled to the periphery of the page, and spliced around the periphery of the PDF page. It should be noted that if the slice images spliced on the periphery of the page have the same coordinates, they will be spliced first according to the coordinates, and then pulled together to the periphery of the PDF page, which greatly facilitates people's preview of part of the content in the PDF, so that people do not need to search the entire PDF for the part of the content they do not understand, and the efficiency is greatly improved;
[0058] Finally, save the slice image with the convolution coefficient to a suitable location, save the image data to the file through the File object, and use the BufferedImage object in the memory where the slice image file is saved for further processing:
[0059] First, create a BufferedImage object based on the actual width and height of the sliced image. If the sliced data already exists in a BufferedImage, you can use that object directly; otherwise, you need to create it from the original data or file, and then copy the sliced data to the BufferedImage, so that you can perform various image processing operations on the bufferedImage object, such as adjusting brightness, contrast, applying filters, etc.
[0060] Using BufferedImage objects in memory allows for flexible and efficient processing of sliced images.
[0061] Step 4:
[0062] Upload slice files, refer to Figure 4 , Figure 5 and Figure 6 , upload the sliced image file to the target platform or storage location, and update the relevant database records at the same time. For example, use the SDK or API using OSS to upload the content image to OSS. During the upload process, make sure to save the URL or OSS object key (Key) of each image so that you can get them later as needed. OSS is Alibaba Cloud Object Storage, an Internet storage solution provided by Alibaba Cloud, suitable for storing various types of files such as pictures, audio and video, documents, etc. It should be noted that uploading using SDK is more convenient and easy to manage, especially in terms of processing signatures and error handling, while directly using API is more suitable for scenarios with special needs or where you do not want to introduce additional dependencies;
[0063] Security and permission control is performed when uploading slice files to ensure that appropriate security and permission control is in place when uploading and accessing these slice files to prevent unauthorized access, which can effectively ensure that image processing and file operations are both efficient and secure, including:
[0064] File permission check
[0065] Read permissions: Before attempting to read an image file, ensure that your application has sufficient permissions to access the file. If you are using a server environment, ensure that the service account has appropriate file system permissions.
[0066] Write permissions: Similarly, when saving processed images or any files, make sure the destination directory is writable by the application and avoid trying to write to directories that require special permissions, such as the system root directory.
[0067] Use safe file operations
[0068] Use the try-with-resources statement: When processing file input and output streams, use the try-with-resources statement to ensure that resources are closed correctly and reduce the risk of resource leakage.
[0069] Path Sanitization: Perform strict validation and sanitization on file paths entered by users to prevent path traversal attacks (for example, by using Paths.get().normalize() to normalize the path).
[0070] Avoid code injection
[0071] Do not directly execute user-supplied scripts or commands: When processing images or file names, make sure not to directly splice user input to execute system commands to prevent command injection attacks.
[0072] Use secure libraries and APIs: Choose well-reviewed and widely used image processing libraries and avoid using third-party libraries that may have security vulnerabilities.
[0073] Data Isolation and Encryption
[0074] Sensitive data handling: If images contain or are associated with sensitive data (e.g., user personal information), ensure that the data is encrypted during storage and transmission.
[0075] Sandbox Environment: Whenever possible, run image processing tasks in a restricted or sandbox environment to reduce the impact on the rest of the system.
[0076] Logging and Monitoring
[0077] Logging operations: Image processing operations and potential anomalies are logged, which helps track down problems and audit security incidents.
[0078] Performance and resource monitoring: Monitor application resource usage when processing images to avoid security risks or performance degradation caused by resource exhaustion. Embodiment 2:
[0079] This embodiment is basically the same as the embodiment 1, except that in the embodiment 2, the text is a PDF file that is not fully typeset and is directly converted from a picture or other text. Such PDF files lack appropriate titles, links and other contents for content classification. Therefore, when performing a slicing operation on such PDF files, the extracted PDF file content is first analyzed, and the pages are still classified according to the contents of each page at the same time, and the pages with mutually connected contents are classified into the same collection class. However, at this time, it is necessary to first call the classification word library in the server, and the classification word library stores a pre-set classification word table. All words stored in the classification word table are nouns. The classification word table is pre-classified according to manual operation. For example, motors, motors, rotors, etc. are one classification, and chips, single-chip microcomputers, CPUs, etc. are another classification. The source of this classification can refer to the classification word libraries of various Chinese and English input methods, and a classification dictionary is established according to the classification word library of the input method. When analyzing the content of the PDF file, text recognition is first performed, and the nouns in the PDF text are divided according to the strength of the association between the nouns in the classification dictionary and the nouns in the classification dictionary. For example, if the first page contains 20 Class A nouns and 10 Class B nouns in the classification dictionary, but no Class C nouns, then the first page of the PDF can be classified as A1 (20) and B1 (10). The value in the brackets is the strength of the association between the PDF page and the dictionary classification. If the second page contains 10 Class A nouns and 8 Class B nouns in the classification dictionary, and 3 Class C nouns, then the second page of the PDF can be classified as A2 (10), B2 (8) and C1 (3), and so on.
[0080] Then, when classifying the content, different methods are selected according to different settings. The default classification method is the association strength numerical classification method. The association strength numerical classification method takes out all the categories of all pages including the association strength values, arranges them, and then automatically classifies them.
[0081] If you want to improve the preview speed of each page and reduce the number of pages associated with a certain category, you can choose the preset quota limit. If the number of PDF pages associated with category A is greater than the quota, then sort them from large to small according to the association strength value within the quota until the quota of category A is allocated, then delete all category A association values, and continue automatic classification. For example, if there are only 9 quotas for category A, then only 9 pages can be allocated to category A, and other pages cannot be allocated to category A no matter how high their association with category A is. This setting can prevent too many associated pages of a certain category, resulting in too many preview loading pages, which reduces the technical effect of improving the preview speed of this embodiment.
[0082] In addition to the above classification methods, direct classification can also be set. The direct classification method is aimed at the situation where repeated classification of A1 and B1 is not allowed and the number of PDF documents is small. For example, during content analysis, classification is performed directly according to the highest value of the association strength value of the page where the PDF is located. For example, the first page of the PDF in this embodiment is directly classified as A1, and the second page is directly classified as A2.
[0083] In addition, an embodiment of the present invention also provides a storage medium, including an internally stored upgrade program, which controls a computer device to execute a slice upload method for quickly previewing a PDF in the above-mentioned embodiment when the upgrade program is running. The storage medium can be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group.
[0084] In addition, an embodiment of the present invention also provides a slice uploading system for quickly previewing PDF, including a memory for storing programs, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed, the slice uploading method for quickly previewing PDF is executed. The processor and the memory may be connected via a bus or other means.
[0085] A person skilled in the art can understand that all or part of the steps in the various methods of the above-mentioned embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium. The computer-readable medium may include computer storage media (or non-transitory media) and communication media (or temporary media). As known to a person skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer storage media include but are not limited to RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is known to a person skilled in the art that communication media typically contain computer-readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier or other transmission mechanism, and may include any information delivery medium.
[0086] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0087] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0088] In summary, the beneficial effects of the present invention are as follows: only the required partial slices can be loaded according to user needs, without having to load the entire PDF file, thus saving bandwidth and resources, and at the same time, some content slices related to the selected loaded slice content will also be pulled and spliced to the periphery of the PDF page, thereby greatly facilitating people to preview part of the content in the PDF, thereby eliminating the need for people to search the entire PDF for the parts of the content they do not understand, and greatly improving efficiency;
[0089] 1. Convenient sharing and transfer: After splitting large PDF files into small pieces, they can be more conveniently transferred and shared via email, cloud storage or other means;
[0090] 2. Save bandwidth and time: Uploading and downloading small PDF files requires less time and bandwidth, especially when the network connection is slow or unstable;
[0091] 3. Fine-grained permission control: You can selectively share specific parts of the PDF as needed, thereby achieving more fine-grained permission control to ensure that only specific people can access specific content;
[0092] 4. Version management: By splitting PDF files, version control can be performed more easily because only the modified parts need to be uploaded or downloaded instead of the entire file;
[0093] 5. Easy to manage and organize: Splitting PDF files into logical segments can better organize and manage files, making them easier to find and use.
[0094] The above is only a specific implementation of the invention, but the protection scope of the invention is not limited to it. Any changes or substitutions that are not conceived through creative work should be included in the protection scope of the invention. Therefore, the protection scope of the invention should be based on the protection scope defined in the claims.
Claims
1. A method for uploading slices of a PDF for quick preview, characterized by: The following steps are involved: S1: Receive and read the original PDF file, use the PDF processing library, use the code to read the original PDF file, obtain the number of pages in the PDF file and the size of the corresponding page, and calculate the maximum and minimum number of slices for each page; S2: Perform slicing operations, analyze the content of the PDF file and obtain the content layout, classify pages with interconnected contents into the same collection class, divide the page slices according to the content and layout of each PDF page, and perform preliminary slicing on the PDF pages in the collection class with the lower left corner edge point of the PDF page as the coordinate origin, and then adjust the slice size specifications according to the content and layout of each page, assign corresponding coordinate values to each corner of the slice, loop through each divided slice on the page, render each slice at the same time, and save it as an image file, and map the coordinates corresponding to the slice on the rendered image file; S3: assign and save slice files, assign an involvement coefficient to each slice image so that slice images with similar contents can be spliced together, first analyze the content of each slice image, and compare it with the original analyzed PDF page content, extract the slice images with different contents from the original PDF page content, and re-slice this part until there is no difference between the slice image content and the original PDF page content, extract the page number on the PDF page related to the slice image content with no difference as the involvement coefficient and assign it to the corresponding slice image, and save the slice image with the involvement coefficient to a suitable location; S4: Upload slice files, upload slice image files to the target platform or storage location, and update related database records at the same time.
2. A method for uploading slices of a quick PDF preview according to claim 1, characterized in that: The analysis of the PDF file content in S2 includes determining the number of title levels according to the text volume in the PDF file. The number of title levels is proportional to the text volume. Initially, there is one level, that is, only the first-level title is divided for content. When the text volume is greater than a set threshold, the title level corresponding to the threshold is introduced. The threshold can be set manually.
3. The method for uploading slices of a quick PDF preview according to claim 1, characterized in that: When performing preliminary slicing, determine a preliminary number of slices based on the margin and direction of the page. The preliminary number of slices is between the maximum number of slices and the minimum number of slices of the corresponding page. Use the page size and the preliminary number of slices to calculate the size of each slice.
4. The method for uploading slices of a quick PDF preview according to claim 1, characterized in that: The slices divided from pages belonging to the same collection class have the same size.
5. The method for uploading slices of a quick PDF preview according to claim 1, characterized in that: The slice file saved in S3 uses the File object to save the image data to the file, and uses the BufferedImage object in the memory that saves the slice image file for further processing.
6. The method for uploading slices of a quick PDF preview according to claim 1, characterized in that: The S4 performs security and permission control when uploading slice files, including file permission checks, using safe file operations, avoiding code injection, data isolation and encryption, logging and monitoring.
7. A slice upload system for quick preview of PDF, characterized by: It includes a memory for storing programs, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed, a method for uploading slices of a quick preview PDF as described in any one of claims 1 to 6 is executed.
8. A storage medium, characterized in that: It includes an internally stored upgrade program, which controls the computer device to execute a slice upload method for quickly previewing PDF as described in any one of claims 1 to 6 when running.
