A kind of e-book manufacture method based on SWF
Technical field
The present invention relates to information digitalization processing technology field, and in particular to a kind of to be adapted in network transmission based on SWF
High-fidelity e-book manufacture method, be particularly well-suited to be required to higher occasion to visual effect and volume.
Background technology
The use of e-book is extremely wide, and the acquisition of e-book can lead to mobile memory medium and copy to locally, such as u
Disk, portable hard drive, CD etc. are copied.But under many circumstances, e-book is downloaded by network.At one point
In the system of cloth, books are before final client is issued to, it may be necessary to be transmitted several times between multiple servers.Cause
This size for how reducing e-book just seems of crucial importance.
Under existing technology, the volume of e-book is reduced, and many situations are by the way that its definition, color is greatly lowered
Coloured silk is cost.But in many occasions, we are not intended to reduce its definition, such as teach for the electronics that students in middle and primary schools use
Material, the characteristics of based on students in middle and primary schools, it is intended that keep the fine definition of teaching material, significantly not losing the color of book.At present, respectively go out
The e-book of version society distribution, the particularly electronic teaching material (textbook) of middle and primary schools, are substantially PDF, and its feature is color
Color gorgeous, character understands, bulky.It is above-mentioned bulky for the system for needing for e-book to carry out network transmission
Electronics is undoubtedly unsuitable.
The SWF (shock wave flash) of Adobe companies) file used vector technology, under given conditions,
The volume of e-book can be substantially reduced, therefore it is a kind of preferable scheme that PDF is switched to into SWF.Support that PDF turns on the market at present
The software for being changed to SWF is a lot, such as gpdf2swf, PDFZilla, FlashPaper2, macromedia flashpaper etc.,
But support program is not called these softwares, can only manual operations.So, it is generally difficult to which these switching softwares are integrated into into oneself
In e-book Software for producing.PDF conversions SWF, can there is two schemes used in books manufacturing system:1) due to PDF
All it is file disclosed in form with SWF files, also there is more parsing storehouse of increasing income, such as XPdfLib etc., but oneself is literary to PDF
Part is parsed, and is produced by SWF file format.2) some components or background program, such as PDF2SWF etc. are called.Nothing
Which kind of, by being mode, it is required for, for the different rational conversion parameters of PDF curriculum offerings, optimum efficiency could being obtained.Additionally,
At present in existing crossover tool, mostly changed using unified strategy, specific aim is also poor.
In current electronic document, word generally has several forms of expression:1) vector font library is used;2) dot-matrix is used
Storehouse;3) character is converted to into bitmap to show.
Wherein, vector font library is also referred to as font vectors, vector fonts (Vector font), and font vectors are referred to as herein.
Font vectors are a kind of forms the most widely used now.Each of which font is described by mathematic curve, and it is wrapped
The borderline key point of font, derivative information of line etc. are contained, the rendering engine of font passes through to read these mathematical vectors, so
Carry out certain mathematical operation afterwards to be rendered.The advantage of relatively this kind of font be font actual size can arbitrarily scale and
Indeformable, discoloration.For raster font, font vectors have the advantages of occupancy data are few, and scaling is not indeformable.
Raster font is that each character is divided into 16 × 16 or 24 × 24 points, and the deficiency and excess then put with each is come table
Show the profile of character.Advantage is that display speed is fast, unlike vector fonts needs to calculate;Maximum shortcoming is to amplify, once
It finds that the sawtooth at word edge after amplification.Now this kind of raster font is mainly only used as the part of " auxiliary ", using less.
Character is converted to into the form that bitmap shows, it is in fact unrelated with character.For example paper book is scanned,
Digital camera is taken pictures the e-book for becoming image and generating, and just belongs to this type.
Additionally, in some specific occasions, such as some characters in a fancy style used in advertising, also often with the shape of vectogram
Formula is designed, and its essence is not character, but a sub-picture.
In current e-book, image generally have 2 in the form of expression:1) vectogram is used;2) dot chart is used.
Also known as Polygon figures, vector diagram, Drawing image, herein referred to as Polygon schemes or Polygon vectogram.
Polygon figures are to represent image based on the geometric graphic element of math equation with point, straight line or polygon etc. in computer graphicss.
It is less that vector graphics advantage is that file takes up room, and no matter amplify, reduce or rotate etc. will not distortion;Have the disadvantage to be difficult to show
The abundant photorealism effect of gradation, and efficiency is drawn be not as high as dot chart.
Dot chart, also known as bitmap (Bitmap), grid map, pixel map, is exactly that least unit is made up of pixel briefly
Figure, scaling can distortion.The least unit for constituting bitmap is pixel, and bitmap is exactly that its display is realized by the arrangement of pel array
Effect.Its advantage is can to produce image beautiful in colour, complicated and changeable;Have the disadvantage bulky.
Can be seen that from above-mentioned discussion, from the angle for reducing electron number volume, it is contemplated that by the word vector in e-book
Character library is represented (font vectors);Image is showed preferably in the form of vectogram.But in practical situation, final volume also with content
It is related.For example, vectogram is adapted to the simple figure of expression, therefore for simple graph, vector map data is than data bitmap volume
It is much smaller.But if original image is bitmap, and bitmap is comprising complicated shape and many colors, the then vectogram after changing
The volume of shape can be bigger than original bitmap!Therefore to the e-book comprising complicated image, without exception by vector quantization and improper.
To complicated bitmap, the compressed formats such as jpeg are converted it to, can often obtain less volume.If necessary, by some complicated positions
Figure switchs to vector, then manually with edit tools such as Flush etc. vector is smoothed, can obtain preferable color, effect,
The balance of volume;But for some complicated contents, there can be larger gap with artwork after forcing to smooth, have lost aesthetics.
Therefore the volume reduction of e-book is the process of a complexity, needs to be designed for different situations, is aided in if necessary
With artificial, optimal effect could be obtained.
The content of the invention
For defect present in prior art, it is an object of the invention to provide a kind of e-book system based on SWF
Make method, for different PDF contents, arranged using different conversions when SWF is converted to, ensure that the file after conversion
Higher definition, while having reached less size, obtains more preferably conversion effect.
For achieving the above object, the technical solution used in the present invention is:
A kind of e-book manufacture method based on SWF, comprises the following steps:
(1) pending pdf document is opened, analyzes the content in pdf document per one page and carry out the content of every one page
Classification;Content in pdf document per one page is divided into into 5 big types:Type based on word, supplemented by image, is converted to the text of image
Type based on word, supplemented by image, image is host type, based on word, the picture and text mixing type that image is background type and synthesis;
(2) type according to pdf document per one page of content, the parameter being respectively provided with when PDF to be converted to SWF;
(3) according to the conversion parameter for arranging, pdf document is converted to into SWF files;
(4) by the SWF compressing files after conversion and plus file header, final e-book is formed.
Further, a kind of e-book manufacture method based on SWF as above, in step (2), PDF is converted to
Parameter setting during SWF is as follows:
When based on the content in pdf document is word, type supplemented by image when, word remains font vectors, and image turns
For polygon figures;
When the content in pdf document be converted to image word based on, type supplemented by image when, polygon figure keep
Scheme for polygon, other images switch to Jpeg forms;
When it is host type that the content in pdf document is image, polygon figures remain polygon figures, and other images turn
For Jpeg forms;
When the content in pdf document be word based on, image be background type when, image is switched to into Jpeg forms, word
Remain font vectors;
When the content in pdf document is comprehensive picture and text mixing type, polygon figures remain polygon figures, other
Image switchs to Jpeg forms.
Further, a kind of e-book manufacture method based on SWF as above, in step (2), in arrange parameter
When, when the content in pdf document be converted to image word based on, type supplemented by image when, switch to the image of Jpeg forms
It is set to intermediate resolution;The intermediate resolution refers to that the quality parameter scope of Jpeg is 70~80.
Further, a kind of e-book manufacture method based on SWF as above, in step (2), in arrange parameter
When, when it is host type that the content in pdf document is image, the image for switching to Jpeg forms is set to fine definition;The height
Definition refers to that Jpeg quality parameters are 95~100.
Further, a kind of e-book manufacture method based on SWF as above, in step (2), in arrange parameter
When, when based on the content in pdf document is word, image be background type when, switch to Jpeg forms image be set to it is low clear
Clear degree;The low definition refers to that Jpeg quality parameters are 60~65.
Further, a kind of e-book manufacture method based on SWF as above, in step (2), in arrange parameter
When, when the content in pdf document is comprehensive picture and text mixing type, switch to Jpeg forms image be set to it is medium clear
Degree.
Further, a kind of e-book manufacture method based on SWF as above, in step (3), pdf document is turned
After being changed to SWF files, hand inspection is carried out to the file after conversion, individual processing is carried out to the undesirable page.
Further, a kind of e-book manufacture method based on SWF as above, in step (4), is calculated using Zip
Method is compressed to the file after conversion.
Further, a kind of e-book manufacture method based on SWF as above, to the file after compression using close
Key is encrypted.
Effect of the invention is that:Method of the present invention first distinguishes the different content of PDF, and with reference to different interior
Hold and arranged using different conversions when SWF is converted to, so as to obtain optimum efficiency.Additionally, e-book tools also make
Skill is compressed with Zip etc., books size is further reduced.It is encrypted with key, obtains preferable confidentiality.This document is being protected
Demonstrate,proved higher document definition, do not reduce color bit depth, while reached less size, be particularly well-suited to imitate vision
Fruit and volume are required to higher occasion.
Description of the drawings
Fig. 1 is a kind of flow chart of the e-book manufacture method based on SWF of the present invention;
Fig. 2 is to want one page pdf document that content, image are background type in specific embodiment based on word;
Fig. 3 is the Local map that the file in Fig. 2 is adopted the SWF files generated after default parameter conversion;
Fig. 4 be the file in Fig. 2 is changed by method of the present invention after generate SWF files Local map;
Fig. 5 is the partial enlarged drawing of Fig. 4.
Specific embodiment
With reference to Figure of description, the present invention is described in further detail with specific embodiment.
Fig. 1 shows a kind of flow chart of the e-book manufacture method based on SWF of the present invention, by finding out the method in figure
Mainly include the following steps that:
Step S11:By every one page classifying content of pending pdf document;
Pending pdf document is opened, the content in pdf document per one page is analyzed and is carried out the content of every one page point
Class;Content in pdf document per one page is divided into into 5 big types:Based on word (embed/connecting outward)+image supplemented by type, be converted to
Based on the word of image+image supplemented by type, image is host type, based on word+image be background type and synthesis picture and text
Mixing type.
Step S12:Conversion parameter is arranged according to the type of every page of PDF content;
In step s 11 by every one page classifying content of pdf document after, according to the type of every page of content of pdf document, respectively
PDF is converted to parameter during SWF for setting.Specific set-up mode is as follows:
1) based on word (embed/connecting outward), type supplemented by image;
In parameter setting, word remains font vectors, converts the image into polygon figures.
2) word has been converted into type based on image, supplemented by image;
In parameter setting, polygon figures keep polygon figures, other images to be converted to Jpeg forms, Jpeg format charts
As being set to intermediate resolution.
3) image is main contents, the less type of word;
In parameter setting, polygon figures keep polygon figures, image to switch to Jpeg forms, and by the figure of Jpeg forms
As being set to fine definition.
4) type that word is main contents, image is background;
In parameter setting, image switchs to Jpeg forms, and is set to low definition, and word keeps font vectors.
5) comprehensive picture and text mixing type.
In parameter setting, Polygon figures keep polygon images, image to switch to Jpeg forms, and Jpeg format-patterns set
It is set to intermediate resolution.
5 kinds is relatively common type in this specific embodiment.Certainly, for the classification of PDF document content, Yong Huke
According to needs in practice, to carry out different classification.In for 5 kinds of common types, set intermediate resolution, high-resolution
Degree and low definition refer to the difference of image quality parameter.The image of Jpeg forms is a kind of lossy compression method image, its compression
Rate generally uses quality parameter (abbreviation quality), also referred to as Q factor, compressibility factor representing.The value of quality factor is from 1 to 100.Value
Less, the degree of compression is higher, namely pixel qualities lose also bigger.The quality of common Jpeg images is in 60-80%.Switching to
During Jpeg, the quality of jpeg can be set according to different situation, such as when to image being unessential Background, can
Its quality is arranged into relatively low quality;When being main, important content to image, its quality can be arranged higher quality etc..This
Intermediate resolution refers to that the quality range of Jpeg is 70~80 in specific embodiment, and fine definition refers to the quality range of Jpeg
It is 95~100, and the quality range of low definition Jpeg is 60~65.
Step S13:Pdf document is converted to SWF files by the conversion parameter according to arranging;
According to the different switching parameter in step S12 according to set by different content types, pdf document is converted to
SWF files.PDF is converted to into SWF and belongs to existing technology, user can as needed select required switching software.By PDF
File carries out SWF vector quantizations, exactly pdf document is converted to into SWF files, can be using gpdf2swf or other existing softwares
Carry out;Further, since PDF and SWF file format are all disclosed, therefore voluntarily can also read and write conversion by coding
Process.
If necessary, hand inspection is carried out after converting, unsatisfied page can be individually processed again, adopted
The method combined with hand inspection with this program interpretation, can obtain more preferable effect.
To adopt the method for the invention in practical application in following table, for per page of different types of PDF content SWF is carried out
Different parameters during conversion are arranged, and the file size contrast before and after conversion.By finding out in table, changed using the method for the present invention
Afterwards, the file size after conversion significantly reduces compared with original document, and for rear three types, using of the present invention
Compared to default parameter conversion method, its effect is also it will be apparent that the size of file is also apparent diminishing to method.
Table 1
Step S14:SWF files are formed into final e-book plus data head.
By the SWF compressing files after conversion and plus file header, final e-book is formed.In actual application,
After being compressed to the SWF after conversion, after being such as compressed using Zip algorithms, the data after compression can be entered using key
Row encryption, obtains preferable confidentiality, then adds data head for file, forms final e-book.
When carrying out e-book using the above-mentioned method of the present invention and making, to overcome that love and respect in prior art that PDF literary
When part is converted to SWF files, especially there is the conflict of document definition, size and color more serious in the problem of specific aim difference
Problem, during general prominent wherein certain characteristic, often significantly to sacrifice problem of other characteristic as cost, the method for the present invention this
To different content types, different conversion parameters are respectively provided with, it is ensured that higher document definition, the condition of color fidelity
Under, while keeping less document size.
In order to be better understood from technical scheme, with reference to specific embodiment, the method for the present invention is entered
The further details of introduction of row.
Embodiment
Content (word is as main contents, image is as background type) in the present embodiment with the pdf document of the 4th type is
Example is illustrated.
As shown in Fig. 2 the original PDF document is apparent from, its size is 683k.If to this page of document using default
Configuration is changed, and the local of its transformation result is as shown in Figure 3, it can be seen that the image changed out is also apparent from, but size
It is 121k than larger, for the requirement for needing to reduce volume size, the result is undesirable.
Below the PDF contents are changed using method of the present invention.
Judged first with the method for the invention, known the PDF contents, its word is main contents, image section
It is less, therefore using the setting of " image is switched to into Jpeg forms, and is set to very low definition, word keeps font vectors "
Scheme.After being configured according to above-mentioned parameter, pdf document is converted to by SWF files using prior art, the result office after conversion
Portion is as shown in Figure 4.It can be seen that in the SWF files for producing, image section is more obscured, but word segment is apparent from, and changes
File size afterwards is 45K.Obviously, in this case, reader be not relevant for aid in image section, image section show compared with
Can be acceptance to obscure.It is the emphasis of readers ' reading but word segment is extremely important, now should ensure that font vector table
Show, obtain the word of high-resolution, and size result is also highly desirable.
Fig. 5 is the situation after Fig. 4 partial enlargements, it can be seen that image section becomes fuzzyyer.But because it is from content
Angle for it is inessential, it is all that we can receive this fuzzy;And the word segment of main body, due to being converted into vector,
In the case of greatly enlarged, higher definition is still maintained.
Obviously, those skilled in the art can carry out the essence of various changes and modification without deviating from the present invention to the present invention
God and scope.So, if these modifications of the present invention and modification belong to the scope of the claims in the present invention and its equivalent technology
Within, then the present invention is also intended to comprising these changes and modification.