1. Field of the Invention
The present invention relates to a printing device and a medium type setting method. More specifically the invention pertains to a printing device that analyzes a document, which describes printable objects in a hierarchical manner, and prints the objects on a medium, such as paper, as well as to a medium type setting method that sets the type of a medium, such as paper, in the process of analyzing a document, which describes printable objects in a hierarchical manner, and printing the objects on the medium.
2. Description of the Prior Art
One proposed printer system includes a printer that analyzes and prints an SVG document and a formatting server that converts an HTML document into the SVG document (see, for example, Reference 1: Japanese Patent Laid-Open Gazette No. 2002-91726). In this proposed printer system, the formatting server converts a received HTML document into an SVG document, and the printer analyzes and prints the converted SVG document.
The prior art printer system including the printer and the formatting server is, however, undesirably large in size and is unsuitable for a restricted space, such as a living room in a house. This printer system converts the received HTML document into the SVG document and analyzes and prints the converted SVG document. Such conversion and analysis take a relatively long time and undesirably interfere with prompt printing. This prior art printer system, however, performs printing regardless of the type of the printing paper currently set in the printer. The printing paper may thus be unsuitable for the specified print contents, for example, photographs printed on plain papers and texts printed on photo papers.
The printing device of the invention thus aims to adequately analyze and print a document, such as an XHTML document or an extended XHTML document. The printing device of the invention also aims to set the type of a printing medium suitable for specified print contents in the process of analyzing and printing a document, such as an XHTML document or an extended XHTML document. The medium type setting method of the invention aims to set the type of a printing medium suitable for specified print contents in the process of analyzing and printing a document, such as an XHTML document or an extended XHTML document.
At least part of the above and the other related objects is attained by a printing device and a medium type setting method of the invention having the configurations discussed below.
A first printing device of the invention is a printing device that analyzes a document, which describes printable objects in a hierarchical manner, and prints the objects on a medium, such as paper, and the printing device includes: a structural analysis module that analyzes the document to identify a type of each object and a hierarchical tree structure of the objects in the document; a layout setting module that specifies a layout of the objects in each page on the medium, based on the identified tree structure; a medium type setting module that sets a type of the medium according to the types of the objects in the identified tree structure; and a print execution module that actually lays out and prints the objects in each page on the medium according to the specified layout.
The first printing device of the invention analyzes a document, which describes printable objects in a hierarchical manner, to identify the type of each object and the hierarchical tree structure of the objects in the document. The first printing device specifies the layout of the objects in each page on the medium based on the identified tree structure, and sets the type of the medium according to the types of the objects in the identified tree structure. The objects are laid out and printed in each page on the medium according to the specified layout. This arrangement appropriately analyzes and prints each document and sets the adequate type of the printing medium corresponding to the identified type of major objects, that is, the print contents.
In the first printing device of the invention, the medium type setting module may set the type of the medium according to the layout specified by the layout setting module. In this case, the medium type setting module may set the type of the medium according to an image object ratio in the specified layout. Further, in this case, the medium type setting module may select a photo medium corresponding to the image object ratio of not less than a preset level, while selecting a plain medium corresponding to the image object ratio of less than the preset level.
The first printing device of the invention may further include a medium feeder module that has an attachment unit for separately setting multiple different types of media in the printing device, and the medium feeder module selects a certain type of medium identical with the type of the medium set by the medium type setting module and feeds the selected type of medium to said print execution module. The first printing device may further include a medium type output module that has an output unit for outputting a type of medium in an identifiable manner, and the medium type output module outputs the type of the medium set by the medium type setting module in an identifiable manner to the output unit.
A second printing device of the invention is a printing device that analyzes a document, which describes printable objects, and prints the objects on a medium, such as paper, and the printing device includes: an object type identification module that analyzes the document to identify a type of each object described in the document; and a medium type setting module that sets a type of the medium according to the identified types of the objects.
The second printing device of the invention analyzes a document, which describes printable objects, to identify the type of each object in the document, and sets the type of the medium according to the identified types of the objects. This arrangement ensures adequate setting of the printing medium corresponding to the identified type of major objects, that is, the print contents.
In the second printing device of the invention, the medium type setting module may set the type of the medium according to a ratio of image objects to all the objects of the identified types. In this case, the medium type setting module may select a photo medium corresponding to the image object ratio of not less than a preset level, while selecting a plain medium corresponding to the image object ratio of less than the preset level.
The second printing device of the invention may further include a medium feeder module that has an attachment unit for separately setting multiple different types of media in the printing device, and the medium feeder module selects a certain type of medium identical with the type of the medium set by the medium type setting module and feeds the selected type of medium to said print execution module. The second printing device may further include a medium type output module that has an output unit for outputting a type of medium in an identifiable manner, and the medium type output module outputs the type of the medium set by the medium type setting module in an identifiable manner to the output unit.
The technique of the present invention is not restricted to the first printing device or the second printing device described above, but is also actualized by a medium type setting method that sets the type of a medium, such as paper, in the process of analyzing a document, which describes printable objects in a hierarchical manner, and printing the objects on the medium.
One mode of carrying out the invention is described below as a preferred embodiment.
The signal processing unit 24 outputs immediately-printable print data to the image buffer 46 of the print execution unit 48, RGB data to a printing image storage area of the memory 50, and a file of the XHTML document to the analyzer unit 30.
The analyzer unit 30 includes a core 32 that gives an analysis command for analysis of the XHTML document to create the DOM tree, an XML parser 34 that analyzes the XHTML document in response to the analysis command given by the core 32, and a CSS plug-in (hereafter referred to as CSSPI) 36 that analyzes the CSS document in response to a request given by an initialization process in a link tag of the created DOM tree.
An operation unit 60 has a liquid crystal display 61 located on the front of the printer 20 and two operation buttons 62 provided by the side of the liquid crystal display 61. The operation unit 60 internally has a one-chip microcomputer including a CPU 63, a ROM 64, a display controller (hereafter referred to as LCDC) 65, and a memory 66. The operation unit 60 is manipulated to set, for example, the type and the size of printing paper and the type of inks currently set in the printer 20. In response to the user's press of the operation button 62, a processing program stored in advance in the ROM 64 is activated to display a menu for settings on the liquid crystal display 61. For example, in the case of setting the paper type, the user selects a paper type setting option in the displayed menu and chooses a desired paper type among available options, such as ‘Plain Paper’ and ‘Photo Paper’, displayed in toggle on the liquid crystal display 61. In the case of setting the paper size, the user selects a paper size setting option in the displayed menu and chooses a desired paper size among available options, such as ‘A4 Portrait’ and ‘B5 Portrait’, displayed in toggle on the liquid crystal display 61. The selected settings are written into the memory 66. In the structure of this embodiment, prior to the user's individual settings through manipulation of the operation unit 60, there are default settings, for example, ‘Plain Paper’ as the paper type, ‘A4 Portrait’ as the paper size, and ‘Pigment’ as the ink type. The user's settings with the operation unit 60 are not characteristic of the present invention and are thus not described in detail.
The following describes operations of the color inkjet printer 20 of the embodiment constructed as discussed above, especially a series of operations to print an XHTML document.
The analyzer unit 30 subsequently determines whether any URL is present in the URL storage buffer area of the memory 50 (step S120) and whether any XHTML document is currently being analyzed (step S130). The analyzing status of an XHTML document is detected, for example, by determining whether the analyzer unit 30 is currently analyzing any XHTML document, simultaneously with and in parallel with this analysis layout instruction process. One concrete procedure may set and reset a flag at the start and the end of analysis. When any URL is present in the URL storage buffer area and no XHTML document is currently being analyzed, the analyzer unit 30 reads out a 1st URL stored in the URL storage buffer area of the memory 50 and starts analysis of an XHTML document specified by the read out URL (step S140). When no URL is present in the URL storage buffer area or when any URL is present but an XHTML document is currently being analyzed, on the other hand, the program proceeds to a next step. Analysis of the XHTML document is carried out according to an analysis process shown in
The analyzer unit 30 then determines whether the layouter 38 is currently making a layout (step S150). When the layouter 38 is not currently making a layout, the analyzer unit 30 specifies a 1st DOM tree with the DOM tree ID among DOM trees stored in the DOM tree storage area of the memory 50 and outputs a layout start command to the layouter 38 (step S160), before terminating this analysis layout instruction process. When the layouter 38 is currently making a layout, on the other hand, the analyzer unit 30 terminates the analysis layout instruction process without outputting a layout start command. The layout execution status of the layouter 38 is determined, for example, by detection of input of a layout end signal from the layouter 38. The input of the layout end signal will be described later as part of the processing by the layouter 38.
The analysis layout instruction process is executed in a repeated manner as mentioned above. Every time a specified URL is given, the analyzer unit 30 stores the specified URL into the URL storage buffer area of the memory 50, whether or not an XHTML document is being analyzed. When any URL is present in the URL storage buffer area of the memory 50, the analyzer unit 30 successively analyzes XHTML documents, whether or not the layouter 38 is currently making a layout. This may result in storage of multiple URLs in the URL storage buffer area, storage of multiple DOM trees in the DOM tree storage area, and storage of multiple style objects in the style object storage area of the memory 50. In the structure of this embodiment, the URL storage buffer area, the DOM tree storage area, and the style object storage area are respectively set to have the capacities for storing the multiple URLs, the multiple DOM trees, and the multiple style objects.
The description regards the analysis process executed by the analyzer unit 30. The analysis process is carried out according to the flowchart of
After creation of the DOM tree, the analyzer unit 30 reads a CSS document specified by the XHTML document (step S220) and analyzes the CSS document to create a style object (step S230). According to the concrete procedure, the CSSPI 36 reads the specified CSS document in response to a request given in an initialization process in a link tag of the created DOM tree, sequentially analyzes the CSS document from the top to create rules as a style object, and stores the created style object into the style object storage area of the memory 50.
After creation of the DOM tree and the style object, the analyzer unit 30 correlates the DOM tree with the style object (step S240) and deletes the URL as the object of analysis from the URL storage buffer area (step S250), before terminating the analysis process.
The description regards the series of processing executed by the layouter 38.
In the layout process, the layouter 38 first creates element boxes according to the characteristics of the respective elements included in the DOM tree (step S400). For example, the layouter 38 creates an image box corresponding to an image element, while creating a text box corresponding to a text element. The layouter 38 subsequently creates a page box corresponding to one page (step S410) and sequentially lays out element boxes in a body tag under the page box until prohibition of further layout (steps S420 to S440). The layout of an image box reads an image size, sets lines corresponding to the image size, and registers the image box on the lines. When the image size suggests an insufficient space for layout of the image box, further layout is prohibited at step S430. The layouter 38 accordingly creates another page box corresponding to a next page (step S410). The layout of text boxes creates a 1st text box corresponding to a first part of a text receivable in one line, registers the 1st text box on the line, creates a next text box corresponding to a next part of the text receivable in a next line, and registers the next text box on the next line. Such creation and registration are repeated to register all the text. In the event of failed registration of all the text to a last text box registered on a last line of one page, further layout is prohibited at step S430. The layouter 38 accordingly creates another page box corresponding to a next page and successively creates text boxes corresponding to the remaining text and registers the text boxes on respective lines in the above manner.
Referring back to the layout drawing instruction process (
The paper type setting flow first calculates a sum of areas of images (total image area) S among the elements laid out on the 1st page (step S306), and computes an image area ratio ρ of the total image area S to a total paper area A of the currently set paper size (ρ=100×S/A) (step S308). The calculated image area ratio ρ is compared with a preset reference value ρref (step S310). In the example of
On completion of the paper type setting flow or when the layout is completed for a 2nd or subsequent page and it is determined at step S304 that the paper type has been set previously, the layouter 38 specifies the layout page and outputs a drawing start command to the RPI 40 (step S322). The RPI 40 receives the drawing start command and executes a drawing process shown in the flowchart of
After output of the drawing start command, the layouter 38 waits for completion of drawing on the specified page (step S324) and deletes the page box corresponding to the processed page (step S326). The page box as the object of drawing is deleted on completion of drawing on the corresponding page. This arrangement desirably prevents unnecessary storage of the processed page box in the limited space of a box storage area. After deletion of the processed page box, the layouter 38 determines whether there is a next page to be processed (step S328). When there is a next page to be processed, the processing flow goes back to step S302 to wait for completion of layout in the next page, specify the next layout page, and output a drawing start command to the RPI 40. When drawing has been completed on all the pages and there is no other page to be processed, the layouter 38 outputs a layout end signal to the analyzer unit 30 (step S330) and terminates the layout drawing instruction process. The output of the layout end signal from the layouter 38 to the analyzer unit 30 enables the analyzer unit 30 to determine whether the layouter 38 is currently making a layout.
As described above, the color inkjet printer 20 of the embodiment sets the paper type according to the image area ratio ρ of the images printed on the 1st page. This ensures setting of the suitable paper type for the print contents. When the paper type set according to the image area ratio ρ is inconsistent with the paper type currently set in the color inkjet printer 20, the inconsistency is shown for the user's confirmation on the liquid crystal display 61 of the operation unit 60. This arrangement effectively prevents printing on the inadequate type of printing paper. The color inkjet printer 20 reads, analyzes, and prints an XHTML document identified by a specified URL.
The analyzer unit 30 including the core 32, the XML parser 34, and the CSSPI 36 in the color inkjet printer 20 of the embodiment corresponds to the structural analysis module of the invention. The layouter 38 corresponds to the layout setting module of the invention. The processing of steps S306 to S320 in the layout drawing instruction process of
The color inkjet printer 20 of the embodiment sets the paper type according to the layout of only the 1st page and does not change the setting of the paper type corresponding to the 2nd and subsequent pages. One possible modification may set the paper type according to the layout of each page.
When the paper type set according to the image area ratio ρ is inconsistent with the paper type currently set in the color inkjet printer 20, the color inkjet printer 20 of the embodiment shows the inconsistency for the user's confirmation on the liquid crystal display 61 of the operation unit 60. The display of the inconsistency on the liquid crystal display 61 of the operation unit 60 for the user's confirmation may be omitted when not required.
The color inkjet printer 20 of the embodiment allows setting of only one type of printing paper. The color inkjet printer may be designed to allow simultaneous setting of two or more different types of printing papers. In this modified structure, the type of printing paper identical with the paper type set according to the image area ratio ρ is automatically selected and fed. Such modification ensures printing on the adequate type of printing paper automatically selected corresponding to the print contents.
The color inkjet printer 20 of the embodiment sets the paper type according to the image area ratio ρ after layout of the 1st page. One possible modification may set the paper type prior to layout. For example, the paper type may be set according to a ratio of image elements to all elements created in a DOM tree. In this case, a modified analysis process shown in the flowchart of
Analysis of the element type enables setting of the paper type. A further possible modification may directly count up the number of image elements Nimg and the number of all elements Nail from the identified XHTML document prior to creation of a DOM tree, and calculate the image element ratio ρ2 (ρ2=100×Nimg/Nall) from the counted number of image elements Nimg and the counted number of all elements Nall. The paper type is then set according to the calculated image element ratio ρ2. This modification enables the paper type to be set prior to even creation of a DOM tree.
When any URL is present in the URL storage buffer area of the memory 50, the color inkjet printer 20 of the embodiment successively analyzes XHTML documents, regardless of the number of DOM trees stored in the DOM tree storage area of the memory 50. When the number of DOT trees stored in the DOM tree storage area of the memory 50 reaches a preset number, analysis of a next XHTML document may be sustained until the number of the stored DOM trees decreases below the preset number. The preset number is, for example, 2. This arrangement desirably reduces the required capacity of the DOM tree storage area in the memory 50.
When any URL is present in the URL storage buffer area of the memory 50, the color inkjet printer 20 of the embodiment starts analysis of a next XHTML document immediately after completion of analysis of one XHTML document. Analysis of a next XHTML document may start at any desirable timing after completion of analysis of one XHTML document.
The color inkjet printer 20 of the embodiment analyzes and prints XHTML documents described in XHTML language. The technique of the invention is also applicable to analyze and print documents described in another markup language, as well as documents described in any language other than the markup language.
In the configuration of the embodiment, the computer 10, the digital TV receiver 12, and the digital camera 14 are connected to the input interface 22 of the color inkjet printer 20. Any other suitable devices may be connected with the color inkjet printer 20.
The above embodiment regards the color inkjet printer that analyzes and prints XHTML documents as the printing device of the invention. The technique of the invention is also applicable to diversity of other printers, for example, color laser printers, monochromatic inkjet printers, and monochromatic laser printers.
The above embodiment regards the printing device as one application of the invention. The technique of the invention may otherwise be actualized by a method of setting the type of printing paper.
The embodiment and its modified examples discussed above are to be considered in all aspects as illustrative and not restrictive. There may be many other modifications, changes, and alterations without departing from the scope or spirit of the main characteristics of the present invention.
Number | Date | Country | Kind |
---|---|---|---|
2004-11713 | Jan 2004 | JP | national |