Epub file format conversion method, electronic device and computer storage medium
By determining the mapping rules of resource files in Epub e-books and automatically converting pages, styles and resource package files, the problem of each application having to manually create Epub files is solved, and the intelligent conversion of Epub file format is realized, saving resources and improving efficiency.
Patent Information
- Application Number
- CN202110909112.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-09
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2041-08-09
AI Technical Summary
In the prior art, each e-book reading application developer needs to manually create e-books suitable for their Epub file format, resulting in waste of resources and inefficient conversion.
By determining the mapping rules between the original and target formats of Epub e-book resource files, the page files, style files and resource package files are automatically converted into target formats, and the intelligent conversion of Epub file format is realized.
Epub format conversion can be completed without manual participation, saving human resources, improving conversion efficiency, and reducing waste of manpower and material resources.
Smart Images

Figure CN113609073B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of electronic books, and in particular to an Epub file format conversion method, electronic equipment and computer storage medium. Background Art
[0002] With the continuous development of technology and society, e-books have gradually replaced traditional paper books. Various electronic products, such as smart phones, tablets, e-readers, etc., support the installation of e-reading applications and have e-book reading functions.
[0003] As the official standard of the International Digital Publishing Forum (IDPF), Epub has become the mainstream format for e-books because of its advantages such as supporting a variety of complex typesetting and being able to adapt to device screens. In addition, with the increase in the types of e-book reading applications, the Epub file formats corresponding to each e-book reading application are not exactly the same. Therefore, usually each e-book reading application developer needs to create an Epub e-book that suits its own Epub file format.
[0004] In the prior art, Epub e-books are usually produced manually. For the same book, each e-book reading application developer must produce an Epub e-book suitable for its own Epub file format, which requires a certain amount of manpower and material resources and is bound to cause a waste of resources. Summary of the invention
[0005] In view of the above problems, the present invention is proposed to provide an Epub file format conversion method, electronic device and computer storage medium that overcome the above problems or at least partially solve the above problems.
[0006] According to one aspect of the present invention, there is provided a method for converting an Epub file format, comprising:
[0007] Determine a mapping rule according to the original Epub format and the target Epub format of the resource file of the Epub electronic book to be converted; wherein the resource file includes a page file, a style file and a resource package file;
[0008] The resource file in the original Epub format is converted into the resource file in the target Epub format according to the mapping rule.
[0009] According to another aspect of the present invention, there is provided an electronic device, comprising: a processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus;
[0010] The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform the following operations:
[0011] Determine a mapping rule according to the original Epub format and the target Epub format of the resource file of the Epub electronic book to be converted; wherein the resource file includes a page file, a style file and a resource package file;
[0012] The resource file in the original Epub format is converted into the resource file in the target Epub format according to the mapping rule.
[0013] According to another aspect of the present invention, a computer storage medium is provided, wherein the storage medium stores at least one executable instruction, and the executable instruction enables a processor to perform operations corresponding to the above-mentioned Epub file format conversion method.
[0014] According to the Epub file format conversion method, electronic device and computer storage medium disclosed in the present invention, a mapping rule is first determined according to the original Epub format and the target Epub format of the resource file of the Epub electronic book to be converted; wherein the resource file includes a page file, a style file and a resource package file, and then the resource file in the original Epub format is converted into the resource file in the target Epub format according to the mapping rule. This solution can convert the resource file in the original Epub format into the resource file in the target Epub format, and can complete the Epub format conversion without human intervention to realize intelligent format conversion, which not only saves human resources but also improves conversion efficiency.
[0015] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0017] Figure 1 A schematic diagram of a process of converting an Epub file format provided according to Embodiment 1 of the present invention is shown;
[0018] Figure 2 A schematic diagram of a process of converting an Epub file format according to a second embodiment of the present invention is shown;
[0019] Figure 3A schematic structural diagram of an electronic device provided according to a fourth embodiment of the present invention is shown. DETAILED DESCRIPTION
[0020] The exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present invention and to enable the scope of the present invention to be fully communicated to those skilled in the art.
[0021] Embodiment 1
[0022] Figure 1 A flow chart of an Epub file format conversion method provided according to Embodiment 1 of the present invention is shown. The Epub file format conversion method provided in this embodiment is executed by an Epub file format conversion device provided in an embodiment of the present invention, and the Epub file format conversion device can be implemented in software or hardware, and the Epub file format conversion device can be integrated in a terminal device or a server, and the terminal device can be, for example, a mobile phone terminal, a computer terminal, a reader, and / or a smart wearable device, and the server can be an e-book reading application server.
[0023] like Figure 1 As shown, the method includes:
[0024] Step S110, determining a mapping rule according to the original Epub format and the target Epub format of the resource file of the Epub electronic book to be converted; wherein the resource file includes a page file, a style file and a resource package file.
[0025] The Epub e-book to be converted can be a finished Epub e-book in a certain e-book reading application, and its Epub format, i.e., the original Epub format, conforms to the reading mode of the e-book reading application. The target Epub format can be an Epub format provided by another e-book reading application developer, i.e., in order to save labor costs, for the same book, the other e-book reading application developer only needs to provide the Epub format they want, i.e., the target Epub format.
[0026] Specifically, the Epub e-book resource file of the Epub e-book to be converted in a certain e-book reading application can be obtained through the storage path. The Epub e-book resource file is usually an .Epub file. The .Epub file is decompressed to obtain resource files such as page files, style files and resource package files. Among them, the page file is usually a .HTML file, the style file is usually a .CSS file, and the resource package file is usually a .OPF file.
[0027] Each resource file has a corresponding original Epub format, and a mapping rule is determined based on each resource file according to the corresponding original Epub format and the target Epub format, and the mapping rule reflects the difference between the original Epub format and the target Epub format of various resource files. Among them, the mapping rule can have one or more copies. When the mapping rule is one copy, the difference between the original Epub format and the target Epub format of the page file, the difference between the original Epub format and the target Epub format of the style file, and the difference between the original Epub format and the target Epub format of the resource package file are all included in the mapping rule. When the mapping rule is multiple copies, the difference between the original Epub format and the target Epub format of the page file, the difference between the original Epub format and the target Epub format of the style file, and the difference between the original Epub format and the target Epub format of the resource package file are all included in the mapping rule and correspond to one copy respectively.
[0028] Step S120: converting the resource file in the original Epub format into the resource file in the target Epub format according to the mapping rule.
[0029] Specifically, according to the differences between the original Epub formats and the target Epub formats of various resource files reflected in the mapping rules, the resource files may be adjusted to complete the Epub format conversion.
[0030] It can be seen that this embodiment can convert the resource file in the original Epub format into the resource file in the target Epub format, and can complete the Epub format conversion without human intervention to realize intelligent format conversion, which not only saves human resources but also improves conversion efficiency.
[0031] Embodiment 2
[0032] Figure 2 The flowchart of an Epub file format conversion method provided in Embodiment 2 of the present invention is shown. The Epub file format conversion method provided in this embodiment is a further optimization of the method in Embodiment 1.
[0033] like Figure 2 As shown, the method includes:
[0034] Step S210, determining a mapping rule according to the original Epub format and the target Epub format of the resource file of the Epub electronic book to be converted; wherein the resource file includes a page file, a style file and a resource package file.
[0035] Step S220: determining the operations to be converted of the resource file according to the mapping rule.
[0036] The mapping rules reflect the differences between the original Epub format and the target Epub format of various resource files, and the operations to be converted can be determined based on the differences. The operations to be converted can instruct the Epub file format conversion device or the e-book reading application developer provided by the embodiment of the present invention to perform corresponding operations on the relevant resource files.
[0037] Specifically, for different types of resource files, the corresponding operations to be converted are different. For page files, the corresponding operations to be converted include: making a directory page, adjusting the page size, adjusting the image size, adjusting the display mode, adjusting the display position, and at least one of page format conversion. For style files, the corresponding operations to be converted include: adjusting the text size, adjusting the font style, and adjusting the terminal display style. For resource package files, the corresponding operations to be converted include: adding, deleting, and repairing at least one of the information in the resource package file.
[0038] Step S230: convert the format of the original Epub format resource file according to the operation items to be converted to obtain a resource file in the target Epub format.
[0039] Specifically, after determining the operations to be converted of the resource files according to the mapping rules, the Epub file format conversion device provided in the embodiment of the present invention can be directly instructed to perform format conversion on the relevant resource files based on the operations to be converted, or the operations to be converted can be sent to the e-book reading application developer, who can manually convert the resource files.
[0040] For page files, taking the iReader e-book reading application as an example, since the iReader e-book reading application does not have a table of contents page, but exists in the form of a toc.ncx table of contents file, it is necessary to create a table of contents page in the page file, and convert the cover page, copyright page, and annotation specifications according to the target Epub format during the process of creating the table of contents page. And / or, for the image content in the page file, the image width occupies 60% of the page, while the target Epub format may correspond to 40%, so the image screen ratio needs to be adjusted; for the caption, if the Epub format of the iReader e-book reading application is centered, and the target Epub format may be left-aligned, it also needs to be adjusted; for the table-like format composed of multiple images, if the Epub format of the iReader e-book reading application is parallel in the row direction, and the target Epub format is arranged up and down, it also needs to be re-made; for the chapter page, if the chapter page of the iReader e-book reading application supports editing operations, but the target Epub format may only support the image method, it is necessary to convert the chapter page screenshot into the image format. And / or, adjust the upper and lower spacing of the title according to the target Epub format, and make adaptive adjustments to the cover size, size, page code, trial reading page, and directory requirements after the directory is generated.
[0041] For style files, the main adjustments include text font size, font style, and terminal display style. For example, the text font size and font style are changed in accordance with the target Epub format within the style file, and the style name is standardized. And / or, according to the target Epub format, the phone version style or pad style is retained. And / or, the target style sheet is determined based on the style sheet in the original Epub format and the style sheet in the target Epub format, and the style of the resource file in the original Epub format is converted according to the target style sheet. Specifically, the style sheet in the original Epub format and the style sheet in the target Epub format are compared to determine a new style sheet, namely the target style sheet, which retains the common parts of the style sheet in the original Epub format and the style sheet in the target Epub format, deletes the unique parts of the style sheet in the original Epub format, and adds the unique parts of the style sheet in the target Epub format to the header or footer of the table.
[0042] Standardize resource package files. The resource package file defines the types, storage locations, and page sorting of various other resource files. Here, the various information in the resource package file is added, deleted, or repaired according to the requirements of the target Epub format. For example, the target Epub format has newly added font files and pop-up annotation icons, and this information needs to be added to the resource package file. The iReader logo image, coverpage image, phone image, etc. in the original Epub format, where the coverpage image is the cover thumbnail and the phone image is the phone version image (for example, the specific naming used by the iReader e-book reading application to distinguish between the phone version and the pad version of the loading image), all this information needs to be deleted from the resource package file, and the duplicate resources in the resource package file must also be deleted. Files that are in the resource folder but not in the resource package file need to be repaired.
[0043] It can be seen that this embodiment determines the operation items to be converted in the resource file according to the mapping rules. The operation items to be converted include specific operation behaviors. The resource file can be directly operated based on the operation items to be converted. Whether it is manual operation or machine operation, it can save conversion time and further improve conversion efficiency.
[0044] Embodiment 3
[0045] Embodiment 3 of the present invention provides a non-volatile computer storage medium, wherein the computer storage medium stores at least one executable instruction, and the computer executable instruction can execute the Epub file format conversion method in any of the above method embodiments.
[0046] The executable instructions may be specifically used to cause the processor to perform the following operations:
[0047] Determine a mapping rule according to the original Epub format and the target Epub format of the resource file of the Epub electronic book to be converted; wherein the resource file includes a page file, a style file and a resource package file;
[0048] The resource file in the original Epub format is converted into the resource file in the target Epub format according to the mapping rule.
[0049] In an optional embodiment, the executable instructions cause the processor to perform the following operations:
[0050] Determine the operations to be converted of the resource file according to the mapping rule;
[0051] The resource file in the original Epub format is converted according to the operation items to be converted to obtain a resource file in the target Epub format.
[0052] In an optional embodiment, when the resource file is the page file, the operations to be converted include: making a directory page, adjusting page size, adjusting picture size, adjusting display mode, adjusting display position, and at least one of page format conversion.
[0053] In an optional embodiment, when the resource file is the style file, the operation items to be converted include: at least one of adjusting the text font size, adjusting the font style, and adjusting the terminal display style.
[0054] In an optional embodiment, when the resource file is the style file, the executable instruction causes the processor to perform the following operations:
[0055] Determining a target style sheet according to the style sheet in the original Epub format and the style sheet in the target Epub format;
[0056] The style of the resource file in the original Epub format is converted according to the target style sheet.
[0057] In an optional embodiment, when the resource file is the resource pack file, the operation items to be converted include: at least one of adding, deleting and repairing the information in the resource pack file.
[0058] It can be seen that this embodiment can convert the resource file in the original Epub format into the resource file in the target Epub format, and can complete the Epub format conversion without human intervention to realize intelligent format conversion, which not only saves human resources but also improves conversion efficiency.
[0059] Embodiment 4
[0060] Figure 3 The structure diagram of an electronic device provided according to Embodiment 6 of the present invention is shown. The specific embodiment of the present invention does not limit the specific implementation of the electronic device.
[0061] like Figure 3 As shown, the electronic device may include: a processor (processor) 302 , a communication interface (Communications Interface) 304 , a memory (memory) 306 , and a communication bus 308 .
[0062] The processor 302, the communication interface 304, and the memory 306 communicate with each other via the communication bus 308. The communication interface 304 is used to communicate with other devices such as client or other server network elements. The processor 302 is used to execute the program 310, which can specifically execute the relevant steps in the above method embodiment.
[0063] Specifically, the program 310 may include program codes, which include computer operation instructions.
[0064] The processor 302 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present invention. The one or more processors included in the electronic device may be processors of the same type, such as one or more CPUs; or processors of different types, such as one or more CPUs and one or more ASICs.
[0065] The memory 306 is used to store the program 310. The memory 306 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0066] The program 310 may be specifically configured to enable the processor 302 to perform the following operations:
[0067] Determine a mapping rule according to the original Epub format and the target Epub format of the resource file of the Epub electronic book to be converted; wherein the resource file includes a page file, a style file and a resource package file;
[0068] The resource file in the original Epub format is converted into the resource file in the target Epub format according to the mapping rule.
[0069] In an optional embodiment, the program 310 may be specifically configured to enable the processor 302 to perform the following operations:
[0070] Determine the operations to be converted of the resource file according to the mapping rule;
[0071] The resource file in the original Epub format is converted according to the operation items to be converted to obtain a resource file in the target Epub format.
[0072] In an optional embodiment, when the resource file is the page file, the operations to be converted include: making a directory page, adjusting page size, adjusting picture size, adjusting display mode, adjusting display position, and at least one of page format conversion.
[0073] In an optional embodiment, when the resource file is the style file, the operation items to be converted include: at least one of adjusting the text font size, adjusting the font style, and adjusting the terminal display style.
[0074] In an optional embodiment, when the resource file is the style file, the program 310 may be specifically configured to enable the processor 302 to perform the following operations:
[0075] Determining a target style sheet according to the style sheet in the original Epub format and the style sheet in the target Epub format;
[0076] The style of the resource file in the original Epub format is converted according to the target style sheet.
[0077] In an optional embodiment, when the resource file is the resource pack file, the operation items to be converted include: at least one of adding, deleting and repairing the information in the resource pack file.
[0078] It can be seen that this embodiment can convert the resource file in the original Epub format into the resource file in the target Epub format, and can complete the Epub format conversion without human intervention to realize intelligent format conversion, which not only saves human resources but also improves conversion efficiency.
[0079] The algorithm or display provided herein is not inherently related to any particular computer, virtual system or other equipment. Various general purpose systems can also be used together with the teachings based on this. According to the above description, it is obvious to construct the structure required for this type of system. In addition, the embodiment of the present invention is not directed to any specific programming language yet. It should be understood that various programming languages can be utilized to realize the content of the present invention described herein, and the description made to specific languages above is for disclosing the best mode of the present invention.
[0080] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.
[0081] Similarly, it should be understood that in order to streamline the present invention and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, the various features of the embodiments of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed method should not be interpreted as reflecting the following intention: that the claimed invention requires more features than the features explicitly recited in each claim. More specifically, as reflected in the claims below, inventive aspects lie in less than all the features of the individual embodiments disclosed above. Therefore, the claims that follow the specific embodiment are hereby expressly incorporated into the specific embodiment, with each claim itself serving as a separate embodiment of the present invention.
[0082] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition they may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this manner may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.
[0083] In addition, those skilled in the art will appreciate that, although some embodiments herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present invention and form different embodiments. For example, in the claims below, any one of the claimed embodiments may be used in any combination.
[0084] The various component embodiments of the present invention can be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that a microprocessor or digital signal processor (DSP) can be used in practice to implement some or all functions of some or all components according to embodiments of the present invention. The present invention can also be implemented as a device or apparatus program (e.g., computer program and computer program product) for executing part or all of the methods described herein. Such a program implementing the present invention can be stored on a computer-readable medium, or can have the form of one or more signals. Such a signal can be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.
[0085] It should be noted that the above embodiments illustrate the present invention rather than limit it, and that those skilled in the art may devise alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets shall not be construed as a limitation on the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of a plurality of such elements. The present invention may be implemented by means of hardware comprising a number of different elements and by means of a suitably programmed computer. In a unit claim enumerating a number of devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc. does not indicate any order. These words may be interpreted as names. The steps in the above embodiments, unless otherwise specified, should not be understood as limitations on the order of execution.
Claims
1. A method for converting Epub file format, comprising: Determine a mapping rule according to the original Epub format and the target Epub format of the resource file of the Epub electronic book to be converted; wherein the resource file includes a page file, a style file and a resource package file; Determine the operations to be converted of the resource file according to the mapping rule; The resource file in the original Epub format is formatted according to the operations to be converted to obtain the resource file in the target Epub format; wherein, for the page file, a table of contents page is created in the page file, and in the process of creating the table of contents page, the cover page, the copyright page, and the annotation specifications are converted according to the target Epub format; for the style file, a target style sheet is determined according to the style sheet in the original Epub format and the style sheet in the target Epub format, the target style retains the common parts in the style sheet in the original Epub format and the style sheet in the target Epub format, deletes the unique parts in the style sheet in the original Epub format, and adds the unique parts in the style sheet in the target Epub format to the header or footer of the table.
2. The method according to claim 1, wherein: When the resource file is the page file, the operations to be converted include: at least one of making a directory page, adjusting the page size, adjusting the image size, adjusting the display mode, adjusting the display position, and converting the page format.
3. The method according to claim 1, wherein: When the resource file is the style file, the operations to be converted include: at least one of adjusting the font size, adjusting the font style, and adjusting the terminal display style.
4. The method according to claim 1, wherein: When the resource file is the resource pack file, the operations to be converted include: at least one of adding, deleting and repairing the information in the resource pack file.
5. An electronic device comprising: A processor, a memory, a communication interface and a communication bus, wherein the processor, the memory and the communication interface communicate with each other via the communication bus; The memory is used to store at least one executable instruction, and the executable instruction enables the processor to perform the following operations: Determine a mapping rule according to the original Epub format and the target Epub format of the resource file of the Epub electronic book to be converted; wherein the resource file includes a page file, a style file and a resource package file; Determine the operations to be converted of the resource file according to the mapping rule; The resource file in the original Epub format is formatted according to the operations to be converted to obtain the resource file in the target Epub format; wherein, for the page file, a table of contents page is created in the page file, and in the process of creating the table of contents page, the cover page, the copyright page, and the annotation specifications are converted according to the target Epub format; for the style file, a target style sheet is determined according to the style sheet in the original Epub format and the style sheet in the target Epub format, the target style retains the common parts in the style sheet in the original Epub format and the style sheet in the target Epub format, deletes the unique parts in the style sheet in the original Epub format, and adds the unique parts in the style sheet in the target Epub format to the header or footer of the table.
6. The electronic device according to claim 5, wherein: When the resource file is the page file, the operations to be converted include: at least one of making a directory page, adjusting the page size, adjusting the image size, adjusting the display mode, adjusting the display position, and converting the page format.
7. The electronic device according to claim 5, wherein: When the resource file is the style file, the operations to be converted include: at least one of adjusting the font size, adjusting the font style, and adjusting the terminal display style.
8. The electronic device according to claim 5, wherein: When the resource file is the resource pack file, the operations to be converted include: at least one of adding, deleting and repairing the information in the resource pack file.
9. A computer storage medium, wherein at least one executable instruction is stored in the storage medium, and the executable instruction enables a processor to execute operations corresponding to the Epub file format conversion method according to any one of claims 1 to 4.
Citation Information
Patent Citations
E-book file making method, electronic device, server, and storage medium
CN109062880A