⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 document.java

📁 iText可以制作中文PDF文件的JAVA源程序
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
 * @param	footer		the new footer */    public void setFooter(HeaderFooter footer) {        this.footer = footer;        DocListener listener;        for (Iterator iterator = listeners.iterator(); iterator.hasNext(); ) {            listener = (DocListener) iterator.next();            listener.setFooter(footer);        }    }/** * Resets the footer of this document. */    public void resetFooter() {        this.footer = footer;        DocListener listener;        for (Iterator iterator = listeners.iterator(); iterator.hasNext(); ) {            listener = (DocListener) iterator.next();            listener.resetFooter();        }    }/** * Sets the page number to 0. */    public void resetPageCount() {        pageN = 0;        DocListener listener;        for (Iterator iterator = listeners.iterator(); iterator.hasNext(); ) {            listener = (DocListener) iterator.next();            listener.resetPageCount();        }    }/** * Sets the page number. * * @param	pageN		the new page number */    public void setPageCount(int pageN) {        this.pageN = pageN;        DocListener listener;        for (Iterator iterator = listeners.iterator(); iterator.hasNext(); ) {            listener = (DocListener) iterator.next();            listener.setPageCount(pageN);        }    }/** * Returns the current page number. * * @return the current page number */    public int getPageNumber() {        return this.pageN;    }/** * Closes the document. * <P> * Once all the content has been written in the body, you have to close * the body. After that nothing can be written to the body anymore. */    public void close() {        if (! close) {            open = false;            close = true;        }        DocListener listener;        for (Iterator iterator = listeners.iterator(); iterator.hasNext(); ) {            listener = (DocListener) iterator.next();            listener.close();        }    }    // methods concerning the header or some meta information/** * Adds a user defined header to the document. * * @param	name	the name of the header * @param	content	the content of the header * @return	<CODE>true</CODE> if successful, <CODE>false</CODE> otherwise */    public boolean addHeader(String name, String content) {        try {            return add(new Header(name, content));        }        catch(DocumentException de) {            throw new ExceptionConverter(de);        }    }/** * Adds the title to a Document. * * @param	title	the title * @return	<CODE>true</CODE> if successful, <CODE>false</CODE> otherwise */    public boolean addTitle(String title) {        try {            return add(new Meta(Element.TITLE, title));        }        catch(DocumentException de) {            throw new ExceptionConverter(de);        }    }/** * Adds the subject to a Document. * * @param	subject		the subject * @return	<CODE>true</CODE> if successful, <CODE>false</CODE> otherwise */    public boolean addSubject(String subject) {        try {            return add(new Meta(Element.SUBJECT, subject));        }        catch(DocumentException de) {            throw new ExceptionConverter(de);        }    }/** * Adds the keywords to a Document. * * @param keywords adds the keywords to the document * @return <CODE>true</CODE> if successful, <CODE>false</CODE> otherwise */    public boolean addKeywords(String keywords) {        try {            return add(new Meta(Element.KEYWORDS, keywords));        }        catch(DocumentException de) {            throw new ExceptionConverter(de);        }    }/** * Adds the author to a Document. * * @param	author		the name of the author * @return	<CODE>true</CODE> if successful, <CODE>false</CODE> otherwise */    public boolean addAuthor(String author) {        try {            return add(new Meta(Element.AUTHOR, author));        }        catch(DocumentException de) {            throw new ExceptionConverter(de);        }    }/** * Adds the creator to a Document. * * @param	creator		the name of the creator * @return	<CODE>true</CODE> if successful, <CODE>false</CODE> otherwise */    public boolean addCreator(String creator) {        try {            return add(new Meta(Element.CREATOR, creator));        }        catch(DocumentException de) {            throw new ExceptionConverter(de);        }    }/** * Adds the producer to a Document. * * @return	<CODE>true</CODE> if successful, <CODE>false</CODE> otherwise */    public boolean addProducer() {        try {            return add(new Meta(Element.PRODUCER, "iText by lowagie.com"));        }        catch(DocumentException de) {            throw new ExceptionConverter(de);        }    }/** * Adds the current date and time to a Document. * * @return	<CODE>true</CODE> if successful, <CODE>false</CODE> otherwise */    public boolean addCreationDate() {        try {            return add(new Meta(Element.CREATIONDATE, new Date().toString()));        }        catch(DocumentException de) {            throw new ExceptionConverter(de);        }    }    // methods to get the layout of the document./** * Returns the left margin. * * @return	the left margin */    public float leftMargin() {        return marginLeft;    }/** * Return the right margin. * * @return	the right margin */    public float rightMargin() {        return marginRight;    }/** * Returns the top margin. * * @return	the top margin */    public float topMargin() {        return marginTop;    }/** * Returns the bottom margin. * * @return	the bottom margin */    public float bottomMargin() {        return marginBottom;    }/** * Returns the lower left x-coordinate. * * @return	the lower left x-coordinate */    public float left() {        return pageSize.left(marginLeft);    }/** * Returns the upper right x-coordinate. * * @return	the upper right x-coordinate */    public float right() {        return pageSize.right(marginRight);    }/** * Returns the upper right y-coordinate. * * @return	the upper right y-coordinate */    public float top() {        return pageSize.top(marginTop);    }/** * Returns the lower left y-coordinate. * * @return	the lower left y-coordinate */    public float bottom() {        return pageSize.bottom(marginBottom);    }/** * Returns the lower left x-coordinate considering a given margin. * * @param	margin			a margin * @return	the lower left x-coordinate */    public float left(float margin) {        return pageSize.left(marginLeft + margin);    }/** * Returns the upper right x-coordinate, considering a given margin. * * @param	margin			a margin * @return	the upper right x-coordinate */    public float right(float margin) {        return pageSize.right(marginRight + margin);    }/** * Returns the upper right y-coordinate, considering a given margin. * * @param	margin			a margin * @return	the upper right y-coordinate */    public float top(float margin) {        return pageSize.top(marginTop + margin);    }/** * Returns the lower left y-coordinate, considering a given margin. * * @param	margin			a margin * @return	the lower left y-coordinate */    public float bottom(float margin) {        return pageSize.bottom(marginBottom + margin);    }/** * Gets the pagesize. * @return the page size */    public Rectangle getPageSize()    {        return this.pageSize;    }    /** Checks if the document is open.     * @return <CODE>true</CODE> if the document is open     */    public boolean isOpen() {        return open;    }    /** Gets the iText version.     * @return iText version     */    public static String getVersion() {        return ITEXT_VERSION;    }/** * Adds a JavaScript onLoad function to the HTML body tag * * @param	code		the JavaScript code to be executed on load of the HTML page */    public void setJavaScript_onLoad(String code) {        this.javaScript_onLoad = code;    }/** * Gets the JavaScript onLoad command. * @return the JavaScript onLoad command */    public String getJavaScript_onLoad() {        return this.javaScript_onLoad;    }/** * Adds a JavaScript onUnLoad function to the HTML body tag * * @param	code		the JavaScript code to be executed on unload of the HTML page */    public void setJavaScript_onUnLoad(String code) {        this.javaScript_onUnLoad = code;    }/** * Gets the JavaScript onUnLoad command. * @return the JavaScript onUnLoad command */    public String getJavaScript_onUnLoad() {        return this.javaScript_onUnLoad;    }/** * Adds a style class to the HTML body tag * * @param	htmlStyleClass		the style class for the HTML body tag */    public void setHtmlStyleClass(String htmlStyleClass) {        this.htmlStyleClass = htmlStyleClass;    }/** * Gets the style class of the HTML body tag * * @return		the style class of the HTML body tag */    public String getHtmlStyleClass() {        return this.htmlStyleClass;    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -