CN104571978B - A kind of method that document print page is carried out based on html tag - Google Patents
A kind of method that document print page is carried out based on html tag Download PDFInfo
- Publication number
- CN104571978B CN104571978B CN201510012715.3A CN201510012715A CN104571978B CN 104571978 B CN104571978 B CN 104571978B CN 201510012715 A CN201510012715 A CN 201510012715A CN 104571978 B CN104571978 B CN 104571978B
- Authority
- CN
- China
- Prior art keywords
- paging
- page
- height
- container
- html tag
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
- 238000000034 method Methods 0.000 title claims abstract description 38
- 235000013399 edible fruits Nutrition 0.000 claims 2
- 230000009286 beneficial effect Effects 0.000 description 2
- 230000001788 irregular Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 1
- 230000000750 progressive effect Effects 0.000 description 1
Landscapes
- Pile Receivers (AREA)
- Labeling Devices (AREA)
Abstract
本发明公开了一种基于HTML标签进行文档分页打印的方法,涉及移动执法文档打印技术领域。本发明提供的技术方案,首先将笔录内容填充到HTML标签中,将笔录内容完整的显示在HTML页面中,然后,通过计算分页页面中能够填充内容的分页容器的高度,设置分页容器的隐藏属性和位置属性,从而在每个分页页面的分页容器中显示相应的HTML标签的部分内容,而将其他内容进行隐藏,从而通过利用HTML标签的隐藏属性实现了对笔录内容的分页打印,并且将每个分页页面均填充满,使分页页面更加美观,而不会出现空白的情况,解决了现有技术中分页打印文件不整齐的问题。
The invention discloses a method for document page-by-page printing based on HTML tags, and relates to the technical field of mobile law enforcement document printing. In the technical solution provided by the present invention, firstly, the content of the transcript is filled into HTML tags, and the content of the transcript is completely displayed in the HTML page, and then, by calculating the height of the paging container that can be filled with content in the paging page, the hidden attribute of the paging container is set and position attributes, so that part of the content of the corresponding HTML tag is displayed in the paging container of each paging page, and other content is hidden, so that the page-by-page printing of the transcript content is realized by using the hidden attribute of the HTML tag, and each All the paging pages are fully filled, so that the paging pages are more beautiful without blanking, and solve the problem that the paging printing files are not neat in the prior art.
Description
技术领域technical field
本发明涉及移动执法文档打印技术领域,尤其涉及一种基于HTML标签进行文档分页打印的方法。The invention relates to the technical field of mobile law enforcement document printing, in particular to a method for page-by-page printing of documents based on HTML tags.
背景技术Background technique
执法人员进行现场执法的过程中,需要根据现场执法情况进行笔录,并将笔录内容保存在移动端的本地,然后可以将移动端连接打印机,将该内容打印出来,作为归档或者立案证据。In the process of on-site law enforcement, law enforcement officers need to take notes according to the on-site law enforcement situation, and save the contents of the notes locally on the mobile terminal, and then connect the mobile terminal to a printer to print out the content as evidence for filing or filing a case.
目前,一般将现场执法情况的笔录内容保存在HTML页面中,通过设定每个HTML页面的高度和行数,以及每行的字数,将笔录内容保存在一页或多页HTML页面中。具体为,如果现场执法情况的字符数小于一页能够容纳的字符数,则笔录内容会显示在一页;如果笔录内容的字符数大于一页能够容纳的字符数,则前一页填充的内容满足设定的高度、行数和每行的字数后,继续在后一页填充,从而实现分页。At present, the transcript content of on-site law enforcement is generally stored in HTML pages, and the transcript content is stored in one or more HTML pages by setting the height and number of lines of each HTML page, as well as the number of words in each line. Specifically, if the number of characters of the on-site law enforcement situation is less than the number of characters that can be accommodated in one page, the content of the transcript will be displayed on one page; After satisfying the set height, number of lines and number of words per line, continue to fill in the next page, thus realizing pagination.
但是,由于现场执法笔录内容是根据现场执法的实际情况进行填写的,所以对字数的多少或字符的类型没有规定和限制,在同一份执法笔录中,可能会涉及多种不同类型的字符,而由于不同类型的字符的占位大小不同,所以,采用上述方法,按照设定好的页面高度、行数和字数,满足条件后进行分页,分页时如果打印文本中包含较多的数字或字符,那么每行还按固定的字数计算,就会出现一行无法填满的情况,导致排在前面的页面中某些位置处出现空白,不显示字符,从而导致分页打印后的文件不整齐。However, since the content of the on-site law enforcement transcript is filled in according to the actual situation of the on-site law enforcement, there are no regulations or restrictions on the number of words or the type of characters. In the same law enforcement transcript, many different types of characters may be involved. Since different types of characters have different occupancy sizes, use the above method to perform pagination after the conditions are met according to the set page height, number of lines and words. If the printed text contains more numbers or characters during pagination, Then each line is still calculated according to the fixed number of words, and there will be a situation where one line cannot be filled, resulting in blanks in some positions on the front pages, and no characters are displayed, resulting in irregular pages after printing.
发明内容Contents of the invention
本发明的目的在于提供一种基于HTML标签进行文档分页打印的方法,从而解决现有技术中存在的前述问题。The purpose of the present invention is to provide a method for page-by-page printing of documents based on HTML tags, so as to solve the aforementioned problems in the prior art.
为了实现上述目的,本发明采用的技术方案如下:In order to achieve the above object, the technical scheme adopted in the present invention is as follows:
一种基于HTML标签进行文档分页打印的方法,包括如下步骤:A method for page-by-page printing of documents based on HTML tags, comprising the following steps:
S1,将待打印文档的内容填充到HTML标签中;S1, filling the content of the document to be printed into the HTML tag;
S2,在每个分页页面中设置分页容器,根据每个分页页面中能够显示的HTML标签的高度,设置所述分页容器的高度,且所述分页容器的高度与所述分页页面中能够显示的HTML标签的高度相同;S2, setting a paging container in each paging page, setting the height of the paging container according to the height of the HTML tags that can be displayed in each paging page, and the height of the paging container is the same as that of the displayable HTML tags in the paging page HTML tags have the same height;
S3,设置每个分页页面中的所述分页容器的OverFlow属性和Position属性;S3, setting the OverFlow attribute and the Position attribute of the paging container in each paging page;
S4,根据所述分页容器的OverFlow属性和Position属性,将所述HTML标签填充到所有的所述分页页面中。S4. According to the OverFlow property and the Position property of the paging container, fill the HTML tags into all the paging pages.
进一步地,S1之后,还包括步骤,计算所述HTML标签的高度。Further, after S1, a step of calculating the height of the HTML tag is also included.
更进一步地,S3和S4之间,还包括步骤,根据所述HTML标签的高度和所述分页容器的高度,计算所述分页页面的数量。Furthermore, between S3 and S4, there is also a step of calculating the number of paging pages according to the height of the HTML tag and the height of the paging container.
其中,所述根据所述HTML标签的高度和所述分页容器的高度,计算所述分页页面的数量,具体包括如下步骤:Wherein, the calculation of the number of paging pages according to the height of the HTML tag and the height of the paging container specifically includes the following steps:
比较所述HTML标签的高度与第一页分页页面中的所述分页容器的高度,如果所述HTML标签的高度小于第一页分页页面中的所述分页容器的高度,则所述分页页面的数量为1;如果所述HTML标签的高度大于第一页分页页面中的所述分页容器的高度,则计算所述分页页面的数量。Compare the height of the HTML tag with the height of the paging container in the first paging page, if the height of the HTML tag is less than the height of the paging container in the first paging page, then the paging page The number is 1; if the height of the HTML tag is greater than the height of the paging container in the first paging page, then count the number of the paging pages.
其中,所述如果所述HTML标签的高度大于第一页分页页面中的所述分页容器的高度,则计算所述分页页面的数量,具体为,如果所有的所述分页页面中的分页容器的高度均相等,则利用所述HTML标签的高度除以一个所述分页容器的高度,即可得到所述分页页面的数量;如果所述分页页面中的分页容器的高度不相等,则从第一页分页页面的分页容器开始,计算出分页页面的数量。Wherein, if the height of the HTML tag is greater than the height of the paging container in the first paging page, then calculate the number of the paging pages, specifically, if all the paging containers in the paging page If the heights are all equal, divide the height of the HTML tag by the height of one paging container to obtain the number of paging pages; if the heights of the paging containers in the paging pages are not equal, start from the first The pagination container starts with the pagination page and counts the number of pagination pages.
具体地,对于执法文书的HTML文档的分页打印,所述分页容器的高度,采用如下方法获得:Specifically, for page-by-page printing of HTML documents of law enforcement documents, the height of the page-by-page container is obtained by the following method:
获取所述分页容器所在分页页面的高度;Obtain the height of the paging page where the paging container is located;
获取所述分页页面中固定模板的高度;Obtain the height of the fixed template in the pagination page;
利用所述分页页面的高度减去所述固定模板的高度,得到所述分页容器的高度。The height of the paging container is obtained by subtracting the height of the fixed template from the height of the paging page.
优选地,所述分页页面的高度为A4打印纸的高度。Preferably, the height of the paginated pages is the height of A4 printing paper.
优选地,第一页分页页面中的固定模板包括顶部固定模板和底部固定模板;第二页至第n页分页页面中的固定模板为底部固定模板。Preferably, the fixed templates in the first paginated page include a top fixed template and a bottom fixed template; the fixed templates in the second to nth paginated pages are bottom fixed templates.
优选地,所述HTML标签为TR、TD或div。Preferably, the HTML tag is TR, TD or div.
优选地,所述分页容器为div。Preferably, the paging container is div.
本发明的有益效果是:本发明实施例提供的基于HTML标签进行文档分页打印的方法,首先将笔录内容填充到HTML标签中,将笔录内容完整的显示在HTML页面中,然后,通过计算分页页面中能够填充内容的分页容器的高度,设置分页容器的隐藏属性和位置属性,从而在每个分页页面的分页容器中显示相应的HTML标签的部分内容,而将其他内容进行隐藏,从而通过利用HTML标签的隐藏属性实现了对笔录内容的分页打印,并且将每个分页页面均填充满,使分页页面更加美观,而不会出现空白的情况,解决了现有技术中分页打印文件不整齐的问题。The beneficial effects of the present invention are: the method for page-by-page document printing based on HTML tags provided by the embodiment of the present invention firstly fills the transcript content into the HTML tag, completely displays the transcript content in the HTML page, and then, by calculating the page-by-page The height of the paging container that can be filled with content, set the hidden attribute and position attribute of the paging container, so that part of the content of the corresponding HTML tag is displayed in the paging container of each paging page, and other content is hidden, so that by using HTML The hidden attribute of the label realizes page-by-page printing of the transcript content, and fills each page-by-page to make the page-by-page more beautiful without blanking, and solves the problem of irregular page-by-page printing files in the prior art .
附图说明Description of drawings
图1是本发明实施例提供的基于HTML标签进行文档分页打印的方法的流程示意图。FIG. 1 is a schematic flowchart of a method for page-by-page document printing based on HTML tags provided by an embodiment of the present invention.
具体实施方式detailed description
为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施方式仅仅用以解释本发明,并不用于限定本发明。In order to make the object, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings. It should be understood that the specific embodiments described here are only used to explain the present invention, and are not intended to limit the present invention.
如图1所示,本发明实施例提供了一种基于HTML标签进行文档分页打印的方法,包括如下步骤:As shown in Figure 1, the embodiment of the present invention provides a method for page-by-page printing of documents based on HTML tags, including the following steps:
S1,将待打印文档的内容填充到HTML标签中。在实际操作时,为了能够在一个HTML页面中显示完整的待打印文档,设置HTML标签的属性为不隐藏,使能够显示完整的待打印文档,而不会只显示一部分,隐藏一部分。S1, filling HTML tags with the content of the document to be printed. In actual operation, in order to be able to display the complete document to be printed in one HTML page, set the attribute of the HTML tag to not hide, so that the complete document to be printed can be displayed instead of only displaying a part and hiding a part.
对于执法文书而言,本申请中,待打印文档为根据执法现场情况生成的笔录内容。而执法文书中的顶部固定模板和底部固定模板均为模板设置好的,也可以直接显示在HTML页面中。For law enforcement documents, in this application, the document to be printed is the transcript content generated according to the situation of the law enforcement scene. Both the top fixed template and the bottom fixed template in the law enforcement document are set as templates, and can also be directly displayed in the HTML page.
S2,在每个分页页面中设置分页容器,根据每个分页页面中能够显示的HTML标签的高度,设置所述分页容器的高度,且所述分页容器的高度与所述分页页面中能够显示的HTML标签的高度相同;。S2, setting a paging container in each paging page, setting the height of the paging container according to the height of the HTML tags that can be displayed in each paging page, and the height of the paging container is the same as that of the displayable HTML tags in the paging page HTML tags have the same height; .
本发明中,由于分页页面需要通过打印机进行打印,所以分页页面的高度根据所使用的打印纸的高度设置,如本领域技术人员可以理解的,该高度可以是默认的,也可以是根据需求设置的。但是,HTML页面的高度,是根据其标签中填充的现场情况笔录内容决定的,笔录内容多,则HTML标签的高度大,反之,HTML标签的高度小。In the present invention, since the paginated pages need to be printed by the printer, the height of the paginated pages is set according to the height of the printing paper used. As those skilled in the art can understand, the height can be default or set according to requirements of. However, the height of the HTML page is determined according to the on-site record content filled in its tags. If there is more content, the height of the HTML tag will be larger, and vice versa, the height of the HTML tag will be smaller.
分页容器也是HTML标签的一种,可以通过设置其OverFlow属性,来实现标签的分页,并在不同的分页页面中用于显示页面内容,通过设置其Position属性,来实现分页容器中内容的定位。The pagination container is also a kind of HTML tag. By setting its OverFlow property, the paging of the label can be realized, and it can be used to display the content of the page in different paging pages. By setting its Position property, the positioning of the content in the paging container can be realized.
如本领域技术人员可以理解的,如果分页页面的高度内没有其他内容,则分页容器的高度即为分页页面的高度,如果分页页面的高度内还要显示其他内容,则分页容器的高度即为分页页面的高度减去其他内容所占的高度。As those skilled in the art can understand, if there is no other content within the height of the paging page, the height of the paging container is the height of the paging page, and if other content is to be displayed within the height of the paging page, the height of the paging container is The height of the paginated page minus the height occupied by other content.
S3,设置每个分页页面中的所述分页容器的OverFlow属性和Position属性;S3, setting the OverFlow attribute and the Position attribute of the paging container in each paging page;
S4,根据所述分页容器的OverFlow属性和Position属性,将所述HTML标签填充到所有的所述分页页面中。S4. According to the OverFlow property and the Position property of the paging container, fill the HTML tags into all the paging pages.
本发明中,通过设置HTML标签的隐藏属性和位置属性,将HTML标签中的待打印文档的内容,显示在不同的分页页面中。具体工作时,首先要计算每个不同的分页页面中设置的分页容器的高度,根据分页容器的高度,计算该分页页面中能够显示的HTML标签的内容,通过设置HTML标签的隐藏属性,在该分页容器中显示与其高度对应的HTML标签的高度的内容,而其他的内容则被隐藏起来,如本领域技术人员可以理解的,HTML标签的隐藏属性是其本身具有的,本发明中,比较巧妙的将该隐藏属性用于文档分页打印中;并且通过设置HTML标签的位置属性,使不同的分页页面可以显示对应高度的HTML标签的内容,而将其他的内容隐藏,从而实现分页。由于在分页的过程中,是根据不同分页页面中分页容器的高度,利用HTML标签的隐藏属性,将相应高度的内容进行显示,而将其他高度的内容进行隐藏实现的,所以,在分页过程中,不涉及根据行数和每行的字数固定每页的字符数,满足字符数后进行分页的过程,所以,会将分页容器填满,而不会出现空白页面的情况。In the present invention, by setting the hidden attribute and position attribute of the HTML tag, the content of the document to be printed in the HTML tag is displayed on different paging pages. When working specifically, first calculate the height of the paging container set in each different paging page, calculate the content of the HTML tags that can be displayed in the paging page according to the height of the paging container, and set the hidden attribute of the HTML tag. The content of the height of the HTML tag corresponding to its height is displayed in the paging container, while other content is hidden. As those skilled in the art can understand, the hidden attribute of the HTML tag itself has. In the present invention, it is more ingenious The hidden attribute is used in document paging printing; and by setting the position attribute of the HTML tag, different paging pages can display the content of the HTML tag of the corresponding height, and hide other content, so as to realize pagination. In the process of paging, according to the height of the paging container in different paging pages, the hidden attribute of the HTML tag is used to display the content of the corresponding height and hide the content of other heights. Therefore, in the paging process , does not involve the process of fixing the number of characters per page according to the number of lines and the number of words in each line, and paging after the number of characters is satisfied, so the paging container will be filled without blank pages.
本发明实施例中,S1之后,还包括步骤,计算所述HTML标签的高度。In the embodiment of the present invention, after S1, a step is further included to calculate the height of the HTML tag.
通过该步骤,可以获知现场执法笔录内容的多少,如果笔录内容比较多,则可以设置较大的分页页面的高度值,反之,可以设置较小的分页页面的高度值。Through this step, it is possible to know the amount of on-site law enforcement transcripts. If there are many transcripts, a larger height value of the pagination page can be set; otherwise, a smaller height value of the pagination page can be set.
本实施例中,S3和S4之间,还包括步骤,根据所述HTML标签的高度和所述分页容器的高度,计算所述分页页面的数量。具体可以采用如下方法,包括如下步骤:In this embodiment, between S3 and S4, a step is further included to calculate the number of paging pages according to the height of the HTML tag and the height of the paging container. Specifically, the following methods can be adopted, including the following steps:
比较所述HTML标签的高度与第一页分页页面中的所述分页容器的高度,如果所述HTML标签的高度小于第一页分页页面中的所述分页容器的高度,则所述分页页面的数量为1;如果所述HTML标签的高度大于第一页分页页面中的所述分页容器的高度,则计算所述分页页面的数量。Compare the height of the HTML tag with the height of the paging container in the first paging page, if the height of the HTML tag is less than the height of the paging container in the first paging page, then the paging page The number is 1; if the height of the HTML tag is greater than the height of the paging container in the first paging page, then count the number of the paging pages.
其中,本实施例中,如果所述HTML标签的高度大于第一页分页页面中的所述分页容器的高度,则计算所述分页页面的数量,具体可以为,如果所有的所述分页页面中的分页容器的高度均相等,则利用所述HTML标签的高度除以一个所述分页容器的高度,即可得到所述分页页面的数量;如果所述分页页面中的分页容器的高度不相等,则从第一页分页页面的分页容器开始,计算出分页页面的数量。比如,所述HTML标签的高度为200,第一页分页页面的分页容器的高度为50,第二页分页页面至第n页分页页面的分页容器的高度为100,则将HTML标签的内容填充到分页页面中,需要(200-50)/100再加1,即3页分页页面。Wherein, in this embodiment, if the height of the HTML tag is greater than the height of the paging container in the first paging page, then calculate the number of the paging pages, specifically, if all the paging pages The heights of the paging containers are all equal, then divide the height of the HTML tag by the height of one paging container to obtain the number of the paging pages; if the heights of the paging containers in the paging pages are not equal, Then start from the paging container of the first paging page to calculate the number of paging pages. For example, the height of the HTML tag is 200, the height of the paging container of the first pagination page is 50, and the height of the paging container of the second paging page to the nth paging page is 100, then the content of the HTML tag is filled To the paging page, you need to add 1 to (200-50)/100, that is, 3 paging pages.
本发明实施例中,对于执法文书的HTML文档的分页打印,所述分页容器的高度,采用如下方法获得:In the embodiment of the present invention, for the page-by-page printing of the HTML document of law enforcement documents, the height of the page-by-page container is obtained by the following method:
获取所述分页容器所在分页页面的高度;Obtain the height of the paging page where the paging container is located;
获取所述分页页面中固定模板的高度;Obtain the height of the fixed template in the pagination page;
利用所述分页页面的高度减去所述固定模板的高度,得到所述分页容器的高度。The height of the paging container is obtained by subtracting the height of the fixed template from the height of the paging page.
执法文书具有固定的格式,比如,在执法文书的开头,需要记录执法时间、地点、执法人信息和被执法人信息,执法说明等,形成其顶部固定模板,而在执法文书的末尾,需要执法人签名和被执法人签名等,形成其底部固定模板。Law enforcement documents have a fixed format. For example, at the beginning of the law enforcement document, it is necessary to record the time and place of law enforcement, the information of the law enforcement person and the person subject to law enforcement, and the description of law enforcement to form a fixed template at the top. At the end of the law enforcement document, law enforcement documents need to be The person's signature and the person's signature, etc., form a fixed template at the bottom.
如果在分页页面中,存在顶部固定模板和底部固定模板,或,底部固定模板,则需要将其高度除去后,得到分页容器的高度,利用该分页容器的高度显示相应高度的HTML标签的内容。If there is a top fixed template and a bottom fixed template, or a bottom fixed template in the paging page, its height needs to be removed to obtain the height of the paging container, and the height of the paging container is used to display the content of the HTML tag of the corresponding height.
本发明实施例中,第一页分页页面中的固定模板包括顶部固定模板和底部固定模板;第二页至第n页分页页面中的固定模板为底部固定模板。In the embodiment of the present invention, the fixed templates in the first paginated page include a top fixed template and a bottom fixed template; the fixed templates in the second to nth paginated pages are bottom fixed templates.
为了使执法文书更加规范,使每页分页页面都具有法律效益,本实施例中,在每个分页页面中都设置有底部固定模板;而为了简化执法文书,本实施例中,只在第一页分页页面中显示顶部固定模板。In order to make the law enforcement documents more standardized and make each pagination page have legal benefits, in this embodiment, a bottom fixed template is set in each pagination page; and in order to simplify the law enforcement documents, in this embodiment, only the first The top pinned template is displayed in the pagination page.
则,在第一页分页页面中为分页页面的高度减去顶部固定模板的高度和底部固定模板的高度;第二页至第n页分页页面中,分页容器的高度为分页页面的高度减去底部固定模板的高度,分页容器的高度。Then, in the first paging page, the height of the paging page is subtracted from the height of the top fixed template and the height of the bottom fixed template; in the second to nth paging pages, the height of the paging container is the height of the paging page minus The height of the bottom fixed template, the height of the pagination container.
其中,所述分页页面的高度为A4打印纸的高度。Wherein, the height of the pagination page is the height of A4 printing paper.
使用A4打印纸,可以使执法文书更加规范和美观。Using A4 printing paper can make law enforcement documents more standardized and beautiful.
本发明实施例中,所述HTML标签为TR、TD或div。In the embodiment of the present invention, the HTML tag is TR, TD or div.
本发明实施例中,所述分页容器为div。In the embodiment of the present invention, the paging container is div.
如本领域技术人员可以理解的,div可以设置高度,并根据高度设置Overflow属性,设置这两个属性后,超过这个高度的文本就会隐藏。As those skilled in the art can understand, the height of the div can be set, and the Overflow property can be set according to the height. After these two properties are set, the text exceeding this height will be hidden.
执法文书分页打印的过程具体可以为:The specific process of paging printing of law enforcement documents can be as follows:
(一)获取第1页分页容器的高度:根据A4纸张大小,减去表头和表尾,得到分页页面的分页容器的高度。(1) Obtain the height of the paging container on the first page: subtract the header and footer according to the size of the A4 paper to obtain the height of the paging container of the paging page.
(二)获取第2页到第N页的分页容器的高度:第2页到第N页分页容器高度为A4纸张高度减去表尾高度。(2) Obtain the height of the paging container from page 2 to page N: the height of the paging container from page 2 to page N is the height of the A4 paper minus the height of the footer.
(三)计算分页的页数:将现场执法笔录内容填充到无隐藏属性的HTML标签中,获取HTML标签的高度,如果获取HTML标签的高度小于第一页的分页容器的高度,则显示一页内容,不需要分页;如果大于第一页的分页容器的高度,通过大于部分高度除以第2页到第N页的分页容器的高度,来获取除第1页以外的页数,近而得到分页总数。(3) Calculate the number of pages for paging: fill the content of the on-site law enforcement transcripts into HTML tags without hidden attributes, and obtain the height of the HTML tags. If the height of the obtained HTML tags is smaller than the height of the paging container on the first page, then display one page The content does not need to be paginated; if it is greater than the height of the paging container of the first page, the number of pages other than the first page is obtained by dividing the height of the greater part by the height of the paging container from the second to the Nth page. Total number of pages.
(四)每页分页页面显示内容的控制:分页容器中填充HTML标签中的所有内容,通过分页容器的高度和OverFlow属性来控制超出内容的隐藏,显示相应高度的内容,并通过分页容器的属性Position来确定分页容器内的内容显示位置,来控制不同页面的显示内容。(4) Control of the display content of each paging page: fill all the content in the HTML tag in the paging container, control the hiding of the excess content through the height of the paging container and the OverFlow property, display the content of the corresponding height, and pass the property of the paging container Position is used to determine the content display position in the paging container to control the display content of different pages.
采用本发明实施例提供的基于HTML标签进行文档分页打印的方法,当现场情况内容过多时,进行分页,每页都具有法律效益,对于执法人员来说,这个笔录具有真实性、便携性;而且可以使现场笔录的界面更加美观,内容充实;使整个执法过程更加规范化,正式化。Adopt the method for page-by-page printing of documents based on HTML tags provided by the embodiment of the present invention, when the scene content is too much, page-by-page is performed, and each page has legal benefits. For law enforcement personnel, this record has authenticity and portability; and It can make the interface of the on-site record more beautiful and enrich the content; make the whole law enforcement process more standardized and formalized.
通过采用本发明公开的上述技术方案,得到了如下有益的效果:本发明实施例提供的基于HTML标签进行文档分页打印的方法,首先将笔录内容填充到HTML标签中,将笔录内容完整的显示在HTML页面中,然后,通过计算分页页面中能够填充内容的分页容器的高度,设置分页容器的隐藏属性和位置属性,从而在每个分页页面的分页容器中显示相应的HTML标签的部分内容,而将其他内容进行隐藏,从而通过利用HTML标签的隐藏属性实现了对笔录内容的分页打印,并且将每个分页页面均填充满,使分页页面更加美观,而不会出现空白的情况,解决了现有技术中分页打印文件不整齐的问题。By adopting the above-mentioned technical solution disclosed in the present invention, the following beneficial effects are obtained: the method for page-by-page printing of documents based on HTML tags provided by the embodiment of the present invention firstly fills the transcript content into the HTML tag, and completely displays the transcript content in the In the HTML page, then, by calculating the height of the paging container that can be filled with content in the paging page, setting the hidden attribute and the position attribute of the paging container, thereby displaying part of the content of the corresponding HTML tag in the paging container of each paging page, and Hide other content, so that the page-by-page printing of the transcript content is realized by using the hidden attribute of the HTML tag, and each page-by-page is filled to make the page-by-page more beautiful without blanking, which solves the problem There is a problem that the pagination printing file is not neat in the technology.
本说明书中的各个实施例均采用递进的方式描述,每个实施例重点说明的都是与其他实施例的不同之处,各个实施例之间相同相似的部分互相参见即可。Each embodiment in this specification is described in a progressive manner, each embodiment focuses on the difference from other embodiments, and the same and similar parts of each embodiment can be referred to each other.
本领域人员应该理解的是,上述实施例提供的方法步骤的时序可根据实际情况进行适应性调整,也可根据实际情况并发进行。Those skilled in the art should understand that the timing of the method steps provided in the foregoing embodiments may be adjusted adaptively according to actual conditions, or may be performed concurrently according to actual conditions.
上述实施例涉及的方法中的全部或部分步骤可以通过程序来指令相关的硬件来完成,所述的程序可以存储于计算机设备可读取的存储介质中,用于执行上述各实施例方法所述的全部或部分步骤。所述计算机设备,例如:个人计算机、服务器、网络设备、智能移动终端、智能家居设备、穿戴式智能设备、车载智能设备等;所述的存储介质,例如:RAM、ROM、磁碟、磁带、光盘、闪存、U盘、移动硬盘、存储卡、记忆棒、网络服务器存储、网络云存储等。All or part of the steps in the methods involved in the above-mentioned embodiments can be completed by instructing related hardware through a program, and the program can be stored in a storage medium readable by a computer device, and is used to execute the methods described in the above-mentioned embodiments. all or part of the steps. The computer equipment, such as: personal computer, server, network equipment, smart mobile terminal, smart home equipment, wearable smart equipment, vehicle-mounted smart equipment, etc.; the storage medium, such as: RAM, ROM, disk, tape, CD, flash memory, U disk, mobile hard disk, memory card, memory stick, network server storage, network cloud storage, etc.
最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、商品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、商品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、商品或者设备中还存在另外的相同要素。Finally, it should also be noted that in this text, relational terms such as first and second etc. are only used to distinguish one entity or operation from another, and do not necessarily require or imply that these entities or operations, any such actual relationship or order exists. Furthermore, the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus comprising a set of elements includes not only those elements, but also includes elements not expressly listed. other elements of, or also include elements inherent in, such a process, method, commodity, or apparatus. Without further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising said element.
以上所述仅是本发明的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视本发明的保护范围。The above is only a preferred embodiment of the present invention, it should be pointed out that, for those of ordinary skill in the art, without departing from the principle of the present invention, some improvements and modifications can also be made, and these improvements and modifications can also be made. It should be regarded as the protection scope of the present invention.
Claims (6)
- A kind of 1. method that document print page is carried out based on html tag, it is characterised in that comprise the following steps:S1, by the fills of document to be printed into html tag;S2, paging container is set in each paging page, according to the height for the html tag that can be shown in each paging page Degree, the height of the paging container, and the HTML that can be shown in the height of the paging container and the paging page are set The height of label is identical;S3, the OverFlow attributes and Position attributes of the paging container in each paging page are set;S4, according to the OverFlow attributes and Position attributes of the paging container, the html tag is filled into all The paging page in;After S1, in addition to step, the height of the html tag is calculated;Between S3 and S4, in addition to step, according to the height of the html tag and the height of the paging container, described in calculating The quantity of the paging page;It is described according to the height of the html tag and the height of the paging container, calculate the quantity of the paging page, tool Body comprises the following steps:Compare the height and the height of the paging container in the first page paging page of the html tag, if the HTML The height of label is less than the height of the paging container in the first page paging page, then the quantity of the paging page is 1;Such as The height of html tag described in fruit is more than the height of the paging container in the first page paging page, then calculates the paging page The quantity in face;If the height of the html tag is more than the height of the paging container in the first page paging page, calculate The quantity of the paging page, specifically, it is equal if all of the height of the paging container in the paging page, then it is sharp With the height of the html tag divided by the height of a paging container, you can obtain the quantity of the paging page;Such as The height of paging container in the paging page described in fruit is unequal, then since the paging container of the first page paging page, calculates Go out the quantity of the paging page.
- 2. the method according to claim 1 that document print page is carried out based on html tag, it is characterised in that for holding The print page of the html document of method document, the height of the paging container, is obtained with the following method:The height of the paging page where obtaining the paging container;Obtain the height of fixed form in the paging page;The height of the fixed form is subtracted using the height of the paging page, obtains the height of the paging container.
- 3. the method according to claim 2 that document print page is carried out based on html tag, it is characterised in that described point The height of the page page is the height of A4 printing papers.
- 4. the method according to claim 2 that document print page is carried out based on html tag, it is characterised in that first page Fixed form in the paging page includes top fixed form and bottom fixed form;Second page is into the nth page paging page Fixed form is bottom fixed form.
- 5. the method that document print page is carried out based on html tag according to claim any one of 1-4, its feature are existed In the html tag is TR, TD or div.
- 6. the method that document print page is carried out based on html tag according to claim any one of 1-4, its feature are existed In the paging container is div.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510012715.3A CN104571978B (en) | 2015-01-09 | 2015-01-09 | A kind of method that document print page is carried out based on html tag |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201510012715.3A CN104571978B (en) | 2015-01-09 | 2015-01-09 | A kind of method that document print page is carried out based on html tag |
Publications (2)
Publication Number | Publication Date |
---|---|
CN104571978A CN104571978A (en) | 2015-04-29 |
CN104571978B true CN104571978B (en) | 2017-11-21 |
Family
ID=53088160
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201510012715.3A Expired - Fee Related CN104571978B (en) | 2015-01-09 | 2015-01-09 | A kind of method that document print page is carried out based on html tag |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN104571978B (en) |
Families Citing this family (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107943426B (en) * | 2017-10-13 | 2021-02-19 | 用友网络科技股份有限公司 | Document paging printing method, document paging printing system and computer device |
CN108399054B (en) * | 2018-02-28 | 2021-08-06 | 北京春草软件科技有限责任公司 | Document segmentation printing method |
CN109408162A (en) * | 2018-09-03 | 2019-03-01 | 平安普惠企业管理有限公司 | A kind of method and terminal showing the page |
CN109324771A (en) * | 2018-10-26 | 2019-02-12 | 苏州浪潮智能软件有限公司 | A kind of self-service apparatus for returning-back of bills intelligence print page technology based on HTML analytic technique |
CN110221790B (en) * | 2019-05-28 | 2023-02-21 | 迈克医疗电子有限公司 | Universal printing method and apparatus, analyzer, and storage medium |
CN111126007B (en) * | 2020-03-27 | 2020-07-17 | 创业慧康科技股份有限公司 | HTM L-based medical record document paging algorithm |
CN113268209B (en) * | 2021-05-14 | 2024-08-06 | 深圳市领星网络科技有限公司 | Method, device and computer equipment for creating custom document printing template |
CN113360106B (en) * | 2021-06-30 | 2022-12-09 | 建信金融科技有限责任公司 | Webpage printing method and device |
CN113918107B (en) * | 2021-09-29 | 2025-08-19 | 北京搜狗科技发展有限公司 | Display method and device |
CN114519334B (en) * | 2022-04-19 | 2022-07-08 | 北京金堤科技有限公司 | Multi-line text display method and device with label, storage medium and electronic equipment |
CN115310406A (en) * | 2022-09-08 | 2022-11-08 | 北京幻想纵横网络技术有限公司 | Text paging method, device, equipment and storage medium |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101187850A (en) * | 2006-11-16 | 2008-05-28 | 北京书生国际信息技术有限公司 | Electronic document page-by-page printing method |
CN103136175A (en) * | 2011-11-25 | 2013-06-05 | 上海盛轩网络科技有限公司 | Page dividing method of reading materials of electronic publication (Epub) form and system using the same |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7366981B2 (en) * | 2002-10-04 | 2008-04-29 | Fuji Xerox Co., Ltd. | Image forming device and method |
-
2015
- 2015-01-09 CN CN201510012715.3A patent/CN104571978B/en not_active Expired - Fee Related
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101187850A (en) * | 2006-11-16 | 2008-05-28 | 北京书生国际信息技术有限公司 | Electronic document page-by-page printing method |
CN103136175A (en) * | 2011-11-25 | 2013-06-05 | 上海盛轩网络科技有限公司 | Page dividing method of reading materials of electronic publication (Epub) form and system using the same |
Non-Patent Citations (1)
Title |
---|
基于CSS的标准网页布局设计;刘坤彪等;《南阳理工学院学报》;20121130;第4卷(第6期);第23-28页 * |
Also Published As
Publication number | Publication date |
---|---|
CN104571978A (en) | 2015-04-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN104571978B (en) | A kind of method that document print page is carried out based on html tag | |
US12299063B2 (en) | System and method for converting the digital typesetting documents used in publishing to a device-specific format for electronic publishing | |
CN103186510B (en) | A kind of method and apparatus of convert documents form | |
US8964201B2 (en) | Assistive technology for the visually impaired | |
WO2010104906A3 (en) | Serving font glyphs | |
JP5658986B2 (en) | Electronic book display device, method and program | |
CN102789448B (en) | Electronic data typesetting method and device | |
TWI690808B (en) | Data reorganization method and device | |
CN105654022A (en) | Method and device for extracting structured document information | |
CN108090037B (en) | Automatic typesetting method and device | |
CN105468577B (en) | A kind of document method for splitting and system | |
EP2345956A3 (en) | Information processing apparatus, information processing apparatus control method, and storage medium | |
US8898561B2 (en) | Method and device for determining a display mode of electronic documents | |
CN104615587B (en) | A kind of electronic data composition method and device | |
CN103186880B (en) | Generate the method and apparatus of thumbnail | |
CN104820962B (en) | A kind of printing watermark generation method instead of artificial signature | |
CN102736819B (en) | Electronic document display method and device | |
US10063738B2 (en) | Digital content access using a machine-readable link | |
CN105373526A (en) | Blank region processing method and system for electronic document | |
US20190163351A1 (en) | System and method for processing screenshot-type note of streaming document | |
CN103034990B (en) | The method and apparatus of publication verification | |
JP2007316873A5 (en) | ||
CN105677262A (en) | Typesetting method and device for banner printing | |
CN111198664A (en) | Document printing method and device, computer storage medium and terminal | |
CN102521327A (en) | Method and system for demonstrating electronic form |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CP01 | Change in the name or title of a patent holder | ||
CP01 | Change in the name or title of a patent holder |
Address after: 100101 Beijing Chaoyang District Anxiang Beilijia 11 B Block 2 Floor Patentee after: CHINA SCIENCE MAPUNIVERSE TCHNDOGY Co.,Ltd. Address before: 100101 Beijing Chaoyang District Anxiang Beilijia 11 B Block 2 Floor Patentee before: CHINA SCIENCES MAPUNIVERSE TECHNOLOGY CO.,LTD. |
|
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20171121 |