?? pdfannotation.java
字號(hào):
annot.put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE)); return annot; } public static PdfAnnotation createMarkup(PdfWriter writer, Rectangle rect, String contents, int type, float quadPoints[]) { PdfAnnotation annot = new PdfAnnotation(writer, rect); PdfName name = PdfName.HIGHLIGHT; switch (type) { case MARKUP_UNDERLINE: name = PdfName.UNDERLINE; break; case MARKUP_STRIKEOUT: name = PdfName.STRIKEOUT; break; } annot.put(PdfName.SUBTYPE, name); annot.put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE)); PdfArray array = new PdfArray(); for (int k = 0; k < quadPoints.length; ++k) array.add(new PdfNumber(quadPoints[k])); annot.put(PdfName.QUADPOINTS, array); return annot; } public static PdfAnnotation createStamp(PdfWriter writer, Rectangle rect, String contents, String name) { PdfAnnotation annot = new PdfAnnotation(writer, rect); annot.put(PdfName.SUBTYPE, PdfName.STAMP); annot.put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE)); annot.put(PdfName.NAME, new PdfName(name)); return annot; } public static PdfAnnotation createInk(PdfWriter writer, Rectangle rect, String contents, float inkList[][]) { PdfAnnotation annot = new PdfAnnotation(writer, rect); annot.put(PdfName.SUBTYPE, PdfName.STAMP); annot.put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE)); PdfArray outer = new PdfArray(); for (int k = 0; k < inkList.length; ++k) { PdfArray inner = new PdfArray(); float deep[] = inkList[k]; for (int j = 0; j < deep.length; ++j) inner.add(new PdfNumber(deep[j])); outer.add(inner); } annot.put(PdfName.INKLIST, outer); return annot; } public static PdfAnnotation createPopup(PdfWriter writer, Rectangle rect, String contents, boolean open) { PdfAnnotation annot = new PdfAnnotation(writer, rect); annot.put(PdfName.SUBTYPE, PdfName.POPUP); annot.put(PdfName.CONTENTS, new PdfString(contents, PdfObject.TEXT_UNICODE)); if (open) annot.put(PdfName.OPEN, PdfBoolean.PDFTRUE); return annot; } public void setDefaultAppearanceString(PdfContentByte cb) { byte b[] = cb.getInternalBuffer().toByteArray(); int len = b.length; for (int k = 0; k < len; ++k) { if (b[k] == '\n') b[k] = 32; } put(PdfName.DA, new PdfString(b)); } public void setFlags(int flags) { if (flags == 0) remove(PdfName.F); else put(PdfName.F, new PdfNumber(flags)); } public void setBorder(PdfBorderArray border) { putDel(PdfName.BORDER, border); } public void setBorderStyle(PdfBorderDictionary border) { putDel(PdfName.BS, border); } public void setAppearance(PdfName ap, PdfAppearance template) { PdfDictionary dic = (PdfDictionary)get(PdfName.AP); if (dic == null) dic = new PdfDictionary(); dic.put(ap, template.getIndirectReference()); put(PdfName.AP, dic); if (!form) return; if (templates == null) templates = new HashMap(); templates.put(template, null); } public void setAppearance(PdfName ap, String state, PdfAppearance template) { PdfDictionary dicAp = (PdfDictionary)get(PdfName.AP); if (dicAp == null) dicAp = new PdfDictionary(); PdfDictionary dic; PdfObject obj = dicAp.get(ap); if (obj != null && obj.type() == DICTIONARY) dic = (PdfDictionary)obj; else dic = new PdfDictionary(); dic.put(new PdfName(state), template.getIndirectReference()); dicAp.put(ap, dic); put(PdfName.AP, dicAp); if (!form) return; if (templates == null) templates = new HashMap(); templates.put(template, null); } public void setAppearanceState(String state) { if (state == null) { remove(PdfName.AS); return; } put(PdfName.AS, new PdfName(state)); } public void setColor(Color color) { putDel(PdfName.C, new PdfColor(color)); } public void setTitle(String title) { if (title == null) { remove(PdfName.T); return; } put(PdfName.T, new PdfString(title, PdfObject.TEXT_UNICODE)); } public void setPopup(PdfAnnotation popup) { put(PdfName.POPUP, popup.getIndirectReference()); popup.put(PdfName.PARENT, getIndirectReference()); } public void setAction(PdfAction action) { putDel(PdfName.A, action); } public void setAdditionalActions(PdfName key, PdfAction action) { PdfDictionary dic; PdfObject obj = get(PdfName.AA); if (obj != null && obj.type() == DICTIONARY) dic = (PdfDictionary)obj; else dic = new PdfDictionary(); dic.put(key, action); put(PdfName.AA, dic); } /** Getter for property used. * @return Value of property used. */ public boolean isUsed() { return used; } /** Setter for property used. */ void setUsed() { used = true; } HashMap getTemplates() { return templates; } /** Getter for property form. * @return Value of property form. */ public boolean isForm() { return form; } /** Getter for property annotation. * @return Value of property annotation. */ public boolean isAnnotation() { return annotation; } public void setPage(int page) { put(PdfName.P, writer.getPageReference(page)); } public void setPage() { put(PdfName.P, writer.getCurrentPage()); } /** Getter for property placeInPage. * @return Value of property placeInPage. */ public int getPlaceInPage() { return placeInPage; } /** Places the annotation in a specified page that must be greater * or equal to the current one. The first page is 1. * @param placeInPage New value of property placeInPage. */ public void setPlaceInPage(int placeInPage) { this.placeInPage = placeInPage; } }
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -