Abstract:
A method and apparatus are described for automatically converting documents from a first hypertext format that supports multi-layered backgrounds to a second hypertext format that does not support multi-layered backgrounds, such as HyperText Markup Language (HTML). According to the method, a target file is generated that stores all non-background elements of the document in the second hypertext format. A mechanism that reads the first hypertext format is used to display a current page of the document. A screen dump is made of the displayed page after removing or hiding the non-background elements. This process is repeated for all of the pages of the document. References to the graphics files generated by the screen dumps are embedded in the target file. The references cause the background elements of a page to be displayed behind non-background elements of the page when the document is displayed based upon the target file by a mechanism that reads the second hypertext format.

Description:
BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     The present invention relates to generating Hypertext Markup Language (HTML) documents from hypertext documents created in non-HTML publishing systems. More particularly, the present invention relates to a method and apparatus for automatically generating HTML documents with single-layered backgrounds from corresponding hypertext documents with multi-layered backgrounds. 
     2. Background Information 
     Numerous powerful publishing systems have been developed to assist in the creation of structured hypertext documents. A document produced in a structured hypertext authoring system typically consists of a set of pages. Each page typically has foreground elements, such as text and graphical user interface components (e.g. buttons), superimposed over a backdrop. The backdrop is typically constructed from object-oriented graphics, with multiple elements on each page. Examples of publishing systems that support multi-layered backgrounds include HyperCard™ available from Apple Computer™ of Cupertino, Calif. and Frame Maker™ available from Adobe™, Inc. of Mountain View, Calif. 
     Backdrop elements may overlap with other backdrop elements. When backdrop elements overlap, only the front-most backdrop element is visible in the region of overlap. Each hypertext page also inherits further backdrop graphics from &#34;background pages&#34;. Typically, each page is assigned to a background page, and the graphic elements from the background page are used to form the backdrop for the page in combination with the graphic elements from the page itself, with the graphic elements from the page considered to be in front of the elements from the background. 
     The World Wide Web (the Web) has become one of the most popular forums for disseminating hypertext documents. The Web is a network of computers, interconnected by the Internet, that provides access to many thousands of hypermedia files. HTML files are transmitted from HTTP servers to Web browsers via the HyperText Transfer Protocol (HTTP). Upon receiving an HTML file, Web browsers construct and display a &#34;page&#34; of hypertext. Exemplary Web browsers include HotJava™ available from JavaSoft™ of Mountain View, Calif. and Navigator™ available from Netscape™ of Mountain View, Calif. 
     Currently, the Web only supports documents written in HTML. Consequently, documents developed in the hypertext authoring systems described above must be rewritten or translated into HTML. However, HTML supports only single-layered, or flat, backgrounds. The failure of HTML to support the multiple-layered backgrounds of other hypertext systems presents a significant obstacle to translation and dissemination of the vast amounts of pre-existing hypertext documents originally created in non-HTML authoring systems. 
     Not only does HTML&#39;s failure to support layered backgrounds obstruct the translation of pre-existing documents, it also discourages the use of non-HTML authoring systems for creating new documents intended for dissemination on the Web. Thus, authors that intend to publish their hypertext works on the Web are forced to select between powerful hypertext publishing systems with which they are already familiar, but which would involve an onerous task of translation, and HTML-specific authoring systems which may be less powerful and less familiar. 
     Based on the foregoing, it is desirable to have a method and apparatus that automatically generates HTML documents having single layered backgrounds based on a corresponding documents having multi-layered backgrounds. Such a method and apparatus would increase the portability of hypertext material that has already been developed in non-HTML publishing systems. Further, such a conversion tool will allow hypermedia authors to take advantage of the power of advanced hypertext publishing environments even when creating documents that are ultimately intended for the Web. 
     SUMMARY OF THE INVENTION 
     The present invention discloses a method and apparatus for automatically generating a plurality of original documents having single-layered backgrounds from a corresponding plurality of documents having multi-layered backgrounds. 
     According to the method, each page of a non-HTML hypertext document is processed by removing or hiding all non-background elements of the page, leaving only the multi-layered background. A screen dump is then made of the multi-layered background to generate a single-layered graphics file having the same appearance as the multi-layered background. The graphics file, an identifier, and the non-background elements are then used to generate a HyperText Markup Language (HTML) page having a single-layered background that appears identical to the original document. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a block diagram of a computer system on which the present invention may be implemented. 
     FIG. 2 is a diagram showing the process of generating HTML documents with single-layered backgrounds based on original documents having multi-layered backgrounds, according to one embodiment of the present invention. 
     FIG. 3 is a flow diagram of the process of automatically generating a plurality of documents having single-layered backgrounds based on a corresponding plurality of original documents having multi-layered backgrounds, according to one embodiment of the present invention. 
     FIG. 4 shows an exemplary document having a multi-layered background. 
     FIG. 5 shows the exemplary multi-layered document of FIG. 4 with all non-background elements removed. 
    
    
     DETAILED DESCRIPTION 
     A method and apparatus for automatically generating documents with single-layered, or flat, backgrounds from documents having multi-layered backgrounds is disclosed. In the following description, for the purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the present invention. It will be apparent, however, to one skilled in the art that the present invention may be practiced without these specific details. In other instances, well-known structures and devices are shown in block diagram form in order to avoid unnecessarily obscuring the present invention. 
     Referring to FIG. 1, the computer system upon which the preferred embodiment of the present invention can be implemented is shown as 100. Computer system 100 comprises a bus or other communication means 101 for communicating information, and a processing means 102 coupled with bus 101 for processing information. System 100 further comprises a random access memory (RAM) or other dynamic storage device 104 (referred to as main memory), coupled to bus 101 for storing information and instructions to be executed by processor 102. Main memory 104 also may be used for storing temporary variables or other intermediate information during execution of instructions by processor 102. Computer system 100 also comprises a read only memory (ROM) and/or other static storage device 106 coupled to bus 101 for storing static information and instructions for processor 102. Data storage device 107 is coupled to bus 101 for storing information and instructions. 
     A data storage device 107 such as a magnetic disk or optical disc and its corresponding drive can be coupled to computer system 100. Computer system 100 can also be coupled via bus 101 to a display device 121, such as a cathode ray tube (CRT), for displaying information to a computer user. An alphanumeric input device 122, including alphanumeric and other keys, is typically coupled to bus 101 for communicating information and command selections to processor 102. Another type of user input device is cursor control 123, such as a mouse, a trackball, or cursor direction keys for communicating direction information and command selections to processor 102 and for controlling cursor movement on display 121. This input device typically has two degrees of freedom in two axes, a first axis (e.g., x) and a second axis (e.g., y), which allows the device to specify positions in a plane. 
     Alternatively, other input devices such as a stylus or pen can be used to interact with the display. A displayed object on a computer screen can be selected by using a stylus or pen to touch the displayed object. The computer detects the selection by implementing a touch sensitive screen. Similarly, a light pen and a light sensitive screen can be used for selecting a displayed object. Such devices may thus detect selection position and the selection as a single operation instead of the &#34;point and click,&#34; as in a system incorporating a mouse or trackball. Stylus and pen based input devices as well as touch and light sensitive screens are well known in the art. Such a system may also lack a keyboard such as 122 wherein all interface is provided via the stylus as a writing instrument (like a pen) and the written text is interpreted using optical character recognition (OCR) techniques. 
     The present invention is related to the use of computer system 100 to automatically generate documents having single-layered backgrounds from corresponding documents having multi-layered backgrounds. According to one embodiment, automatic generation of single-layered backgrounds from multi-layered backgrounds is performed by computer system 100 in response to processor 102 executing sequences of instructions contained in memory 104. Execution of the sequences of instructions contained in memory 104 causes processor 102 to automatically generate documents with single-layered backgrounds from documents having multi-layered backgrounds, as will be described hereafter. In alternative embodiments, hard-wired circuitry may be used in place of or in combination with software instructions to implement the present invention. Thus, the present invention is not limited to any specific combination of hardware circuitry and software. 
     FIG. 2 is a diagram showing a process for generating HTML files having single-layered backgrounds from original structured documents having multi-layered backgrounds. Original documents 200 are input to text converter 250, which generates HTML documents 202. Text converter 250 may be any text-to-HTML converter. For example, Frame Maker™ has text-to-HTML conversion ability. Original documents 200 are also used as inputs to background converter 255, which outputs graphics files 204. A method and apparatus for implementing the background converter will be discussed in greater detail below. HTML documents 202 and graphics files 204 are then combined to generate HTML files having single-layered backgrounds 210, which are appropriate format for use on the Web. 
     FIG. 3 is a flow diagram for automatic generation of a multi-page document with single-layered backgrounds from a multi-page document with multi-layered backgrounds according to one embodiment of the present invention. For the purposes of explanation, specific commands and sequences will be given hereafter with reference to the HyperTalk™ scripting language, which is associated with HyperCard™. However, HyperTalk™ and HyperCard™ are merely exemplary scripting and authoring systems. The present invention is not limited to any particular scripting language, programming language, or hypertext authoring system. 
     In step 300, a backup copy is made of the hypertext document to be converted to HTML. While step 300 is not required, making a backup copy allows the backup document to be processed and modified without the worry of corrupting the original document. By maintaining the original document, the author may use the original authoring environment to perform later revisions to the document. For example, the original authoring environment may be used to modify the layered backgrounds rather than attempting to modify the single-layered backgrounds of the corresponding HTML document. 
     In step 310, the original structured document having one or more pages is opened. FIG. 4 shows a page of an exemplary HyperCard™ document that may be converted to an HTML document using the techniques described herein. Starting with the first page, an identifier that identifies the current page is stored for later use (step 220). The page identifier may be, for example, the name or number of the page. If the original document is a HyperCard™ document, the Page Identifier command may be used to retrieve an identifier associated with the current page. In hypertext environments that do not supply their own page identifiers, a page identifier may be created. For example, sequential page numbers may be generated and stored in step 320. 
     In step 330, all non-backdrop elements on the current page of the structured document are either hidden or deleted. After step 330 is performed on the exemplary page of FIG. 4, the page will appear as shown in FIG. 5. Step 330 may be performed by using, for example, the HyperCard™ commands &#34;hide card field&#34; and &#34;hide card button&#34;. Specifically, the text on the current page of a HyperCard™ document can be hidden by executing the &#34;hide card field i&#34; command, where &#34;i&#34; goes from 1 to the number of text fields on the current page. Similarly, the buttons on the current page can be hidden by executing the &#34;hide card button i&#34; command, where &#34;i&#34; goes from 1 to the number of buttons on the current page. 
     Once all non-backdrop elements are either hidden or deleted, a screen dump of the region of the screen that displays the current page is performed at step 350. Specifically, the interapplication control system of the underlying operating system (e.g. AppleScript, OLE and/or VisualBasic) is used to send a message to a screen dump program. Capture™, available from Mainstay of Agoura Hills, Calif., and Snapshot™, available from SunSoft of Mountain View, Calif. are two of many available screen dump programs that may be used to perform the screen dump at step 340. 
     The screen dump program generates and stores a single-layered graphical image of the multi-layered background in a target graphics format. For example, the screen dump program may store the image in JPEG or any other appropriate graphics format. 
     In step 360, the graphics file generated in step 350 is renamed based on the page identifier determined in step 320. According to one embodiment, the graphics file is renamed &lt;PAGENAME&gt; --  BKG.XXX, where &#34;&lt;PAGENAME&gt;&#34; represents page identifier determined in step 320 and XXX represents a file extension that identifies the format of the graphics file. For example, if the page identifier stored in step 220 were &#34;1,&#34; step 360 and the graphics file was stored in the GIF file format, the graphics file would be given the name &#34;1 --  BKG.GIF&#34;. Alternately, the desired name may be sent to screen dump program to cause the screen dump program to initially save the graphics file under the selected name. 
     In step 370, the graphics file created in step 350 is associated with the HTML page for which the graphics file will be a background. The HTML page includes the HTML code to display the text that was on the original hypertext page. To associate the graphics file with the HTML page, a line is inserted in the HTML file with reference to the background graphics file. For example, the line &#34;&lt;BODY BACKGROUND=PAGENAME --  BKG.GIF&gt;&#34; may be inserted. 
     If the graphics file generated in steps 320-370 is based on the last page of the original document, the generation process is complete. Otherwise, steps 320 through 380 are repeated for each page in the original document. The next page can be accessed, for example, by using the &#34;go next page&#34; HyperCard™ command. Once all pages in the original file are processed according to steps 320 through 370, the generation process for the original file is complete. The copy of the original hypertext document in which all non-background elements have been deleted or hidden may then be deleted. 
     The particular sequence of steps described above is merely exemplary. The sequence of the steps may vary from implementation to implementation. For example, references to the single layer graphics files may be inserted into the appropriate HTML pages after all of the pages have been processed. In addition, a step of restoring the non-background elements may be performed after a screen dump has been performed for a page, thus eliminating the need to make a backup of the original document before processing. 
     While embodiments of the invention have been described in which a screen dump routine is used to create a single layer graphics file of background elements, other graphics-generating mechanisms may be used. For exmaple, a program may be designed to automatically (1) read a page of a hypertext document from a file stored in a format that supports multi-layered backgrounds, and (2) remove the non-background elements of the page, and (3) generate a single layer graphics file of the page without the non-background elements. These steps may be performed with or without actually displaying the page on a screen. 
     In the foregoing specification, the invention has been described with reference to specific embodiments thereof. It will, however, be evident that various modifications and changes may be made thereto without departing from the broader spirit and scope of the invention. The specification and drawings are, accordingly, to be regarded in an illustrative rather than a restrictive sense.