Method suitable for reading and displaying file content according to page number in whiteboard software
By intelligently identifying file types, format conversion and dynamic page management, the problem that whiteboard software cannot directly display multiple document formats is solved, efficient processing and editing of documents is achieved, user experience and work efficiency is improved, and suitable for teaching and office scenarios. .
Patent Information
- Application Number
- CN202411774566.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-05
- Publication Date
- 2025-01-10
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional whiteboard software cannot effectively support the direct display of multiple document formats, resulting in poor user experience and inefficiency in teaching and office scenarios.
By intelligently identifying file types, using external scripting programs to convert files in different formats into a unified format, using database software to manage page information, extract and insert content page by page, and achieve seamless display and editing of documents.
The document processing process has been optimized, the convenience and functionality of the whiteboard software has been improved, the work efficiency of users in teaching and office scenarios has been improved, and the compatibility needs of various file formats has been met.
Smart Images

Figure CN119294367A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of data recognition, and in particular relates to a method for reading and displaying file contents by page number in whiteboard software. Background Art
[0002] In modern education and office environments, whiteboard software is an important digital tool that is widely used in classroom teaching and conference presentations. With the rapid development of information technology, users' functional requirements for whiteboard software are constantly increasing, especially in document processing and content presentation. Traditional whiteboard software often cannot effectively support the direct presentation of multiple document formats, which limits the user experience and work efficiency.
[0003] In the field of education, teachers need to flexibly use various teaching resources, such as textbooks, courseware, reference materials, etc., which usually exist in different file formats. Teachers need to quickly call these resources for demonstrations in class, but traditional whiteboard software often cannot achieve seamless switching or direct display when processing Word, PDF and other documents, resulting in time waste and reduced teaching efficiency.
[0004] In office meetings, participants need to share and discuss documents in various formats, such as reports, proposals, and presentations. If the software cannot recognize and display these documents in a timely manner, it will affect the fluency and efficiency of the meeting and lead to poor information communication. Summary of the invention
[0005] In view of the above problems, the present invention provides a method for reading and displaying file contents by page number in whiteboard software, which method specifically comprises the following steps:
[0006] Step S1, start the whiteboard software, and the user selects the file to be read through the interface;
[0007] Step S2, using the QFileInfo class to determine the type of the file being read, and checking whether the file format is a supported category; if the file format conforms to the supported category, executing step S3, if the file format does not conform to the supported category, prompting the user to change the file;
[0008] Step S3, calling the libreofficeprogress tool through an external script program to convert the read different files into a unified format, and obtaining the converted files;
[0009] Step S4, using database software to read the converted file, obtain page number information, and create blank pages corresponding to the number of document pages;
[0010] Step S5, traverse each page of the converted file, extract the content in the file and insert it into the corresponding blank page;
[0011] Step S6, check whether all page contents are successfully extracted and inserted, if there are omissions, return to step S5;
[0012] Step S7: After all content is successfully inserted, the document is displayed to allow the user to edit and annotate.
[0013] According to another aspect of the present application, step S2 is specifically:
[0014] Step S21, obtaining the file path of the read file;
[0015] Step S22: Use the QFileInfo class to obtain the file name and extension information of the read file;
[0016] Step S23, check whether the file extension is in the supported file format list, the supported file formats include but are not limited to: docx, xlsx, pptx, pdf, txt;
[0017] Step S24: If the file format meets the supported category, execute step S3; otherwise, a prompt box pops up to inform the user that the file format is not supported and provides an option to change the file.
[0018] According to another aspect of the present application, step S3 is specifically:
[0019] Step S31, write an external script program to call the LibreOffice process to convert the file format;
[0020] Step S32, calling libreoffice--headless--convert-to pdf input_file output_file command in the script program to convert the selected file into PDF format;
[0021] Step S33: Check whether the conversion is successful. If successful, obtain the converted PDF file; otherwise, pop up a prompt box to inform the user that the conversion failed and provide an option to re-convert.
[0022] According to another aspect of the present application, step S4 is specifically:
[0023] Step S41, using database software SQLite to create a database connection;
[0024] Step S42: Use database software to read the converted PDF file and obtain the total number of pages of the file;
[0025] Step S43, create a corresponding number of blank pages according to the total number of pages, each blank page corresponds to a page of the PDF file; Step S44, store the blank page information in the database, the information includes: page number, page size, page content.
[0026] According to another aspect of the present application, step S5 is specifically:
[0027] Step S51, traverse each page of the PDF file and extract the page content starting from the first page;
[0028] Step S52: Use the PDF parsing library PDFBox to extract the text, pictures, and table contents of the current page;
[0029] Step S53: insert the extracted content into the corresponding blank page, keeping the original layout and format;
[0030] Step S54, updating the content information of the corresponding page in the database;
[0031] Step S55: Repeat steps S51 to S54 until the contents of all pages are extracted and inserted.
[0032] According to another aspect of the present application, step S7 is specifically:
[0033] Step S71, displaying the converted document in the whiteboard software, arranged in order of page numbers;
[0034] Step S72: Provide page thumbnails, page jumps, and page zoom functions to facilitate users to browse documents;
[0035] Step S73: Allow the user to edit and annotate the document, including: adding text, graphics, and annotations;
[0036] Step S74: Provide a save function to save the edited document as a new file in the format of PDF, PNG, or JPEG.
[0037] Beneficial effects: This solution optimizes the document processing process and improves the convenience and functionality of whiteboard software through intelligent identification of file types, format conversion, dynamic page management, and page-by-page content extraction and insertion. This innovation will enable users to use whiteboard software more efficiently in teaching and office scenarios, expand its application scope, and meet the ever-changing market needs. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 It is a schematic diagram of the overall flow of the scheme of the present invention.
[0039] Figure 2 It is a schematic flow chart of step S2 of the solution of the present invention.
[0040] Figure 3 It is a schematic flow chart of step S3 of the solution of the present invention.
[0041] Figure 4 It is a schematic flow chart of step S4 of the solution of the present invention.
[0042] Figure 5 It is a schematic diagram of the process of step S5 of the solution of the present invention.
[0043] Figure 6 It is a schematic flow chart of step S7 of the solution of the present invention. DETAILED DESCRIPTION
[0044] In the following description, a large number of specific details are provided to provide a more thorough understanding of the present invention. However, it is apparent to those skilled in the art that the present invention can be implemented without one or more of these details. In other examples, in order to avoid confusion with the present invention, some technical features well known in the art are not described.
[0045] The applicant believes that whiteboard software has been widely used in teaching and office scenarios, and existing whiteboard software generally supports the import and display of multiple file formats, but the processing methods of different file formats are different, resulting in cumbersome document processing procedures and poor user experience.
[0046] To this end, the applicant proposed a method for reading files by page in whiteboard software. This method optimizes the document processing flow and improves the convenience and functionality of whiteboard software through steps such as intelligent identification of file types, format conversion, dynamic page management, and page-by-page content extraction and insertion. This innovation will enable users to use whiteboard software more efficiently in teaching and office scenarios, expand its application scope, and meet the ever-changing market needs.
[0047] like Figure 1 As shown, the method specifically comprises the following steps:
[0048] Step S1, start the whiteboard software, and the user selects the file to be read through the interface;
[0049] Step S2, using the QFileInfo class to determine the type of the file being read, and checking whether the file format is a supported category; if the file format conforms to the supported category, executing step S3, if the file format does not conform to the supported category, prompting the user to change the file;
[0050] Step S3, calling the libreofficeprogress tool through an external script program to convert the read different files into a unified format, and obtaining the converted files;
[0051] Step S4, using database software to read the converted file, obtain page number information, and create blank pages corresponding to the number of document pages;
[0052] Step S5, traverse each page of the converted file, extract the content in the file and insert it into the corresponding blank page;
[0053] Step S6, check whether all page contents are successfully extracted and inserted, if there are omissions, return to step S5;
[0054] Step S7: After all content is successfully inserted, the document is displayed to allow the user to edit and annotate.
[0055] By calling external scripts and the LibreOfficeProgress tool, this solution can uniformly convert files of various different formats into a format supported by the whiteboard software, thereby achieving compatibility support for multiple file types; the entire process from file selection, format judgment, file conversion, page extraction to content insertion is automatically completed by the program, reducing manual intervention and improving work efficiency; by reading the converted files through the database software and creating blank pages corresponding to the number of document pages, multi-page documents can be efficiently managed to ensure that the content of each page can be correctly inserted into the corresponding blank page; in step S6, a check mechanism is set to ensure that all page contents are successfully extracted and inserted. If there are omissions, it will automatically return to step S5 for reprocessing to ensure the integrity of the content; the final displayed document allows users to edit and annotate, providing a good user interaction experience, and is suitable for use in various scenarios such as teaching and meetings; this solution uses external scripts and database software for file conversion and page management, which is convenient for future function expansion and performance optimization.
[0056] In summary, this solution not only improves the efficiency and accuracy of file processing, but also provides users with convenient editing and annotation functions, and has high practical value and promotion potential.
[0057] According to another aspect of the present application, step S2 is specifically:
[0058] Step S21, obtaining the file path of the read file;
[0059] Step S22: Use the QFileInfo class to obtain the file name and extension information of the read file;
[0060] Step S23, check whether the file extension is in the supported file format list, the supported file formats include but are not limited to: docx, xlsx, pptx, pdf, txt;
[0061] Step S24: If the file format meets the supported category, execute step S3; otherwise, a prompt box pops up to inform the user that the file format is not supported and provides an option to change the file.
[0062] This step obtains the MIME type of the file through the QMimeType class, then determines the specific type of the file based on the MIME type and returns the corresponding Chinese description. For example, if it is a Microsoft Word document, it returns "Word document"; if it is a PDF file, it returns "PDF document", and so on.
[0063] Specifically, first use the mimeTypeForFile() function of QMimeDatabase to get the MIME type of the file according to the QFileInfo object fileInfo; then, determine the type of the file by checking the name of the MIME type: if the MIME type is "application / msword" or "application / vnd.wordprocessingml.document", indicating that it is a Word document, it returns "Word document"; if it is "application / pdf", it returns "PDF document"; if it is "text / plain", it returns "text file"; if it is "application / vnd.ms-excel" or "application / vnd.spreadsheetml.sheet", it returns "Excel document"; if it is "application / vnd.powerpoint" or "application / vnd.presentationml.presentation", it returns "PowerPoint document".
[0064] According to another aspect of the present application, step S3 is specifically:
[0065] Step S31, write an external script program to call the LibreOffice process to convert the file format;
[0066] Step S32, calling libreoffice--headless--convert-to pdf input_file output_file command in the script program to convert the selected file into PDF format;
[0067] Step S33: Check whether the conversion is successful. If successful, obtain the converted PDF file; otherwise, pop up a prompt box to inform the user that the conversion failed and provide an option to re-convert.
[0068] The function of this step is to call an external script program and use the libreofficeprogress tool to convert the file into a format (PDF) supported by the whiteboard software. The specific steps are as follows:
[0069] Modify the output file path:
[0070] Replace doc in the output file path with pdf, ignoring case.
[0071] Build command line parameters:
[0072] Use the libreOfficeArgs list to construct command line parameters. The specific parameters are as follows:
[0073] --headless: Run LibreOffice in headless mode, that is, without displaying the user interface;
[0074] --convert-to: specifies the target format of the conversion to pdf;
[0075] mFilePath: specifies the file path to be converted;
[0076] --outdir: Specify the directory for the output file, using the absolute path of the input file.
[0077] In summary, the main function of this step is to build a command line parameter list to call the libreofficeprogress tool to convert the specified file (doc format) to PDF format and save the converted file to the same directory as the input file.
[0078] According to another aspect of the present application, step S4 is specifically:
[0079] Step S41, using database software SQLite to create a database connection;
[0080] Step S42: Use database software to read the converted PDF file and obtain the total number of pages of the file;
[0081] Step S43, create a corresponding number of blank pages according to the total number of pages, each blank page corresponds to a page of the PDF file; Step S44, store the blank page information in the database, the information includes: page number, page size, page content.
[0082] The function of this step is to use the appropriate library to read the converted document, obtain the number of pages in the document, and create a corresponding number of blank pages based on the number of pages. The specific steps are as follows:
[0083] Get the number of document pages:
[0084] Call the getPageCount(path) function, pass in the converted document path path, get the number of pages in the document, and store it in the pageCount variable.
[0085] To create a blank page:
[0086] Call the createBlankPages(pageCount) function, pass in the document's page count, and create a corresponding number of blank pages based on the number of pages.
[0087] In summary, the main function of this step is to read the converted document, obtain the number of pages of the document, and create a corresponding number of blank pages based on the number of pages.
[0088] According to another aspect of the present application, step S5 is specifically:
[0089] Step S51, traverse each page of the PDF file and extract the page content starting from the first page;
[0090] Step S52: Use the PDF parsing library PDFBox to extract the text, pictures, and table contents of the current page;
[0091] Step S53: insert the extracted content into the corresponding blank page, keeping the original layout and format;
[0092] Step S54, updating the content information of the corresponding page in the database;
[0093] Step S55: Repeat steps S51 to S54 until the contents of all pages are extracted and inserted.
[0094] The function of this step is to traverse a file list (fileList), process each file, and save the processed image to the specified directory. The specific steps are as follows:
[0095] Traverse the file list:
[0096] Use a for loop to iterate over each file information (QFileInfo) in fileList.
[0097] Create and add a blank page:
[0098] For each file, create a new ClassBoardView object and add it to the mDrawingBoardContainer.
[0099] Load the file:
[0100] Get the absolute path of the current file and load it using QImage to convert the file into an image.
[0101] Calculate the file size:
[0102] Calculate the target file image width targetWidth according to mDesktopWidth, and calculate the target file image height targetHeight according to the aspect ratio of the file.
[0103] Create a white background image:
[0104] Creates a new QImage object with dimensions targetWidth and targetHeight and fills it with a white background.
[0105] Center the image:
[0106] Calculate the offset (xOffset and yOffset) of the file image in the white background so that the file image is displayed in the center of the background;
[0107] Use QPainter to paint the file image into the specified position of the white background image.
[0108] Save the new image:
[0109] Save the processed file image to the specified directory with the file name single-page-<sequence number>.png, where the sequence number is generated according to the position of the file in the list.
[0110] In summary, the main function of this step is to load, resize and center each file on a white blank page, and then save the processed files to the specified directory, with the file names numbered sequentially.
[0111] According to another aspect of the present application, step S7 is specifically:
[0112] Step S71, displaying the converted document in the whiteboard software, arranged in order of page numbers;
[0113] Step S72: Provide page thumbnails, page jumps, and page zoom functions to facilitate users to browse documents;
[0114] Step S73: Allow the user to edit and annotate the document, including: adding text, graphics, and annotations;
[0115] Step S74: Provide a save function to save the edited document as a new file in the format of PDF, PNG, or JPEG.
[0116] The core steps of this method include:
[0117] Intelligent file type identification: Use QMimeType and CaseInsensitive to determine the type of the file to be processed. This step ensures that the software can support multiple document formats and improves compatibility.
[0118] Format conversion: Use the libreofficeprogress tool to adapt the file format through an external script program. This process can convert files of different formats into a format acceptable to the whiteboard software to ensure the integrity and accuracy of the document content.
[0119] Dynamic page management: After successful conversion, the program will read the converted document to obtain the page number of the current document and create a corresponding blank page in the whiteboard software. This operation provides the necessary structure for subsequent content insertion.
[0120] Content location and extraction: The program locates each page and obtains the content of each page in the document. This process ensures that users can view and edit the content page by page, enhancing interactivity.
[0121] Content insertion: Insert each page of extracted content into the corresponding blank page of the whiteboard software one by one to form a complete document display.
[0122] The implementation of the present invention enables users to conveniently open files and read each page of the file into the whiteboard software page by page, greatly improving the convenience and practicality of the whiteboard software. This method not only facilitates users to view and edit files in whiteboard applications, but also provides more resources and options for teaching and conference presentations, fully meeting the needs of modern education and office.
[0123] Although the present invention is described in detail in this embodiment, it should be understood by those skilled in the art that any modification, improvement or replacement of the present invention, as long as it does not deviate from its basic concept and creative contribution, should be regarded as the protection scope of the present invention. The protection scope of the present invention should include all equivalent technical solutions that achieve its purpose and function, regardless of whether these solutions are explicitly mentioned in the present invention.
Claims
1. A method for reading and displaying file contents by page number in whiteboard software, characterized in that: The following steps are involved: Step S1, start the whiteboard software, and the user selects the file to be read through the interface; Step S2, using the QFileInfo class to determine the type of the file being read, and check whether the file format is a supported category; If the file format conforms to the supported category, step S3 is executed; if the file format does not conform to the supported category, the user is prompted to change the file; Step S3, calling the libreofficeprogress tool through an external script program to convert the read different files into a unified format, and obtaining the converted files; Step S4, using database software to read the converted file, obtain page number information, and create blank pages corresponding to the number of document pages; Step S5, traverse each page of the converted file, extract the content in the file and insert it into the corresponding blank page; Step S6, check whether all page contents are successfully extracted and inserted, if there are omissions, return to step S5; Step S7: After all content is successfully inserted, the document is displayed to allow the user to edit and annotate.
2. A method for reading and displaying file contents by page number in whiteboard software according to claim 1, characterized in that: Step S2 is specifically as follows: Step S21, obtaining the file path of the read file; Step S22: Use the QFileInfo class to obtain the file name and extension information of the read file; Step S23, check whether the file extension is in the supported file format list, the supported file formats include but are not limited to: docx, xlsx, pptx, pdf, txt; Step S24: If the file format meets the supported category, execute step S3; Otherwise, a prompt box pops up to inform the user that the file format is not supported and provides the option to replace the file.
3. A method for reading and displaying file contents by page number in whiteboard software according to claim 1, characterized in that: Step S3 is specifically as follows: Step S31, write an external script program to call the LibreOffice process to convert the file format; Step S32, calling libreoffice--headless--convert-to pdf input_fileoutput_file command in the script program to convert the selected file into PDF format; Step S33: Check whether the conversion is successful. If successful, obtain the converted PDF file; otherwise, pop up a prompt box to inform the user that the conversion failed and provide an option to re-convert.
4. A method for reading and displaying file contents by page number in whiteboard software according to claim 1, characterized in that: Step S4 is specifically as follows: Step S41, using database software SQLite to create a database connection; Step S42: Use database software to read the converted PDF file and obtain the total number of pages of the file; Step S43: Create a corresponding number of blank pages according to the total number of pages, each blank page corresponds to a page of the PDF file; Step S44: Store the blank page information in the database, the information including: page number, page size, and page content.
5. A method for reading and displaying file contents by page number in whiteboard software according to claim 1, characterized in that: Step S5 is specifically as follows: Step S51, traverse each page of the PDF file and extract the page content starting from the first page; Step S52: Use the PDF parsing library PDFBox to extract the text, pictures, and table contents of the current page; Step S53: insert the extracted content into the corresponding blank page, keeping the original layout and format; Step S54, updating the content information of the corresponding page in the database; Step S55: Repeat steps S51 to S54 until the contents of all pages are extracted and inserted.
6. A method for reading and displaying file contents by page number in whiteboard software according to claim 1, characterized in that: Step S7 is specifically as follows: Step S71, displaying the converted document in the whiteboard software, arranged in order of page numbers; Step S72: Provide page thumbnails, page jumps, and page zoom functions to facilitate users to browse documents; Step S73: Allow the user to edit and annotate the document, including adding text, graphics, and annotations; Step S74: Provide a save function to save the edited document as a new file in the format of PDF, PNG, or JPEG.
Citation Information
Patent Citations
Method for converting document into image
CN102314470A
Method for reading Word file in white board software page by page
CN104461498A
PDF (Portable Document Format) document loading method and device and interactive panel
CN114201093A
Method for combining or merging information and file convergence whiteboard for reading and operation
CN116755593A
Device and method for clustering diversified tools on whiteboard
CN116795262A