当前位置: 首页>>代码示例>>Java>>正文


Java Rectangle.getRight方法代码示例

本文整理汇总了Java中com.lowagie.text.Rectangle.getRight方法的典型用法代码示例。如果您正苦于以下问题:Java Rectangle.getRight方法的具体用法?Java Rectangle.getRight怎么用?Java Rectangle.getRight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.lowagie.text.Rectangle的用法示例。


在下文中一共展示了Rectangle.getRight方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: startPage

import com.lowagie.text.Rectangle; //导入方法依赖的package包/类
/**
 * Any work to start off printing a page of the document
 * m_currentPage will contain the page being printed, and
 * m_currentTemplatePage will contain the template page number to base this
 * new page on.
 * @throws FormPrintException Thrown if there is any form processing problems
 */
protected void startPage() throws FormPrintException {
    log.debug("startPage: Page=" + getCurrentPage());

    Rectangle r = m_templateReader.getPageSize(getCurrentTemplatePage());
    log.debug( "Page Size      : t="+r.getTop()+",l="+r.getLeft()+",b="+r.getBottom()+",r="+r.getRight()+", rot="+r.getRotation() );
    r = m_templateReader.getPageSizeWithRotation(getCurrentTemplatePage());
    log.debug( "Page Size w/Rot: t="+r.getTop()+",l="+r.getLeft()+",b="+r.getBottom()+",r="+r.getRight()+", rot="+r.getRotation() );

    // Get rotation quadrent 0..3
    int q = (m_templateReader.getPageSizeWithRotation(getCurrentTemplatePage()).getRotation() % 360)/90;
    float tX = (q==2?r.getTop():0)+(q==3?r.getRight():0);
    float tY = (q==1?r.getTop():0)+(q==2?r.getRight():0);
    float sX=1f, sY=1f;
    double angle = -r.getRotation()*(Math.PI/180f);
    double transformA = sX * Math.cos(angle);
    double transformB = sY * Math.sin(angle);
    double transformC = -sX * Math.sin(angle);
    double transformD = sY * Math.cos(angle);
    double transformE = tX;
    double transformF = tY;


    m_generatedDoc.setPageSize(m_templateReader.getPageSizeWithRotation(getCurrentTemplatePage()) );
    //m_generatedDoc.setPageSize(m_templateReader.getPageSize(getCurrentTemplatePage()) );
    /**
     * try {
     * m_generatedDoc.newPage();
     * } catch (DocumentException e) {
     * log.error("Error Creating New Page - " + e.getMessage() ,e);
     * throw new EngineProcessingException("Error Creating New Page - " + e.getMessage());
     * }
     **/
    m_generatedDoc.newPage();

    PdfImportedPage page = m_writer.getImportedPage(m_templateReader, getCurrentTemplatePage() );
    PdfContentByte cb = m_writer.getDirectContent();
    //cb.addTemplate(page, 1f, 0, 0, 1f, 0, 0);
    cb.addTemplate(page, (float)transformA, (float)transformB, (float)transformC,
                         (float)transformD, (float)transformE, (float)transformF);
    log.debug("Matrix = [A=" + transformA +", B=" + transformB +", C=" + transformC +
                      ", D=" + transformD +", E=" + transformE +", F=" + transformF +" ]");
}
 
开发者ID:jaffa-projects,项目名称:jaffa-framework,代码行数:50,代码来源:FormPrintEngineIText.java

示例2: onGenericTag

import com.lowagie.text.Rectangle; //导入方法依赖的package包/类
/**
 * @see com.lowagie.text.pdf.PdfPageEvent#onGenericTag(com.lowagie.text.pdf.PdfWriter, com.lowagie.text.Document, com.lowagie.text.Rectangle, java.lang.String)
 */
public void onGenericTag(PdfWriter writer, Document document,
		Rectangle rect, String text) {
	rect.setBottom(rect.getBottom() - 3);
	PdfFormField field = (PdfFormField) genericChunkFields.get(text);
	if (field == null) {
		TextField tf = new TextField(writer, new Rectangle(rect.getLeft(padding), rect.getBottom(padding), rect.getRight(padding), rect.getTop(padding)), text);
		tf.setFontSize(14);
		try {
			field = tf.getTextField();
		} catch (Exception e) {
			throw new ExceptionConverter(e);
		}
	}
	else {
		field.put(PdfName.RECT,  new PdfRectangle(rect.getLeft(padding), rect.getBottom(padding), rect.getRight(padding), rect.getTop(padding)));
	}
	if (parent == null)
		writer.addAnnotation(field);
	else
		parent.addKid(field);
}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:25,代码来源:FieldPositioningEvents.java

示例3: cellLayout

import com.lowagie.text.Rectangle; //导入方法依赖的package包/类
/**
 * @see com.lowagie.text.pdf.PdfPCellEvent#cellLayout(com.lowagie.text.pdf.PdfPCell,
 *      com.lowagie.text.Rectangle, com.lowagie.text.pdf.PdfContentByte[])
 */
public void cellLayout(PdfPCell cell, Rectangle position, PdfContentByte[] canvases) {
	float x1 = position.getLeft() + 2;
	float x2 = position.getRight() - 2;
	float y1 = position.getTop() - 2;
	float y2 = position.getBottom() + 2;
	PdfContentByte canvas = canvases[PdfPTable.LINECANVAS];
	canvas.setRGBColorStroke(0xFF, 0x00, 0x00);
	canvas.rectangle(x1, y1, x2 - x1, y2 - y1);
	canvas.stroke();
	canvas.resetRGBColorStroke();
}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:16,代码来源:FloatingBoxesTest.java

示例4: setWidthPercentage

import com.lowagie.text.Rectangle; //导入方法依赖的package包/类
/**
 * Sets the percentage width of the table from the absolute column width.
 * 
 * @param columnWidth the absolute width of each column
 * @param pageSize the page size
 * @throws DocumentException
 */    
public void setWidthPercentage(float columnWidth[], Rectangle pageSize) throws DocumentException {
    if (columnWidth.length != getNumberOfColumns())
        throw new IllegalArgumentException("Wrong number of columns.");
    float totalWidth = 0;
    for (int k = 0; k < columnWidth.length; ++k)
        totalWidth += columnWidth[k];
    widthPercentage = totalWidth / (pageSize.getRight() - pageSize.getLeft()) * 100f;
    setWidths(columnWidth);
}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:17,代码来源:PdfPTable.java

示例5: convertAnnotation

import com.lowagie.text.Rectangle; //导入方法依赖的package包/类
public static PdfAnnotation convertAnnotation(PdfWriter writer, Annotation annot, Rectangle defaultRect) throws IOException {
     switch(annot.annotationType()) {
        case Annotation.URL_NET:
            return new PdfAnnotation(writer, annot.llx(), annot.lly(), annot.urx(), annot.ury(), new PdfAction((URL) annot.attributes().get(Annotation.URL)));
        case Annotation.URL_AS_STRING:
            return new PdfAnnotation(writer, annot.llx(), annot.lly(), annot.urx(), annot.ury(), new PdfAction((String) annot.attributes().get(Annotation.FILE)));
        case Annotation.FILE_DEST:
            return new PdfAnnotation(writer, annot.llx(), annot.lly(), annot.urx(), annot.ury(), new PdfAction((String) annot.attributes().get(Annotation.FILE), (String) annot.attributes().get(Annotation.DESTINATION)));
        case Annotation.SCREEN:
            boolean sparams[] = (boolean[])annot.attributes().get(Annotation.PARAMETERS);
            String fname = (String) annot.attributes().get(Annotation.FILE);
            String mimetype = (String) annot.attributes().get(Annotation.MIMETYPE);
            PdfFileSpecification fs;
            if (sparams[0])
                fs = PdfFileSpecification.fileEmbedded(writer, fname, fname, null);
            else
                fs = PdfFileSpecification.fileExtern(writer, fname);
            PdfAnnotation ann = PdfAnnotation.createScreen(writer, new Rectangle(annot.llx(), annot.lly(), annot.urx(), annot.ury()),
                    fname, fs, mimetype, sparams[1]);
            return ann;
        case Annotation.FILE_PAGE:
            return new PdfAnnotation(writer, annot.llx(), annot.lly(), annot.urx(), annot.ury(), new PdfAction((String) annot.attributes().get(Annotation.FILE), ((Integer) annot.attributes().get(Annotation.PAGE)).intValue()));
        case Annotation.NAMED_DEST:
            return new PdfAnnotation(writer, annot.llx(), annot.lly(), annot.urx(), annot.ury(), new PdfAction(((Integer) annot.attributes().get(Annotation.NAMED)).intValue()));
        case Annotation.LAUNCH:
            return new PdfAnnotation(writer, annot.llx(), annot.lly(), annot.urx(), annot.ury(), new PdfAction((String) annot.attributes().get(Annotation.APPLICATION),(String) annot.attributes().get(Annotation.PARAMETERS),(String) annot.attributes().get(Annotation.OPERATION),(String) annot.attributes().get(Annotation.DEFAULTDIR)));
        default:
     	   return new PdfAnnotation(writer, defaultRect.getLeft(), defaultRect.getBottom(), defaultRect.getRight(), defaultRect.getTop(), new PdfString(annot.title(), PdfObject.TEXT_UNICODE), new PdfString(annot.content(), PdfObject.TEXT_UNICODE));
    }
}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:31,代码来源:PdfAnnotationsImp.java

示例6: PdfRectangle

import com.lowagie.text.Rectangle; //导入方法依赖的package包/类
public PdfRectangle(Rectangle rectangle) {
    this(rectangle.getLeft(), rectangle.getBottom(), rectangle.getRight(), rectangle.getTop(), 0);
}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:4,代码来源:PdfRectangle.java


注:本文中的com.lowagie.text.Rectangle.getRight方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。