當前位置: 首頁>>代碼示例>>Java>>正文


Java Rectangle.setBottom方法代碼示例

本文整理匯總了Java中com.itextpdf.text.Rectangle.setBottom方法的典型用法代碼示例。如果您正苦於以下問題:Java Rectangle.setBottom方法的具體用法?Java Rectangle.setBottom怎麽用?Java Rectangle.setBottom使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.itextpdf.text.Rectangle的用法示例。


在下文中一共展示了Rectangle.setBottom方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: enhanceBy

import com.itextpdf.text.Rectangle; //導入方法依賴的package包/類
Rectangle enhanceBy(Rectangle source, Rectangle addition)
{
    Rectangle result = new Rectangle(source);
    if (addition.getLeft() < result.getLeft())
        result.setLeft(addition.getLeft());
    if (addition.getRight() > result.getRight())
        result.setRight(addition.getRight());
    if (addition.getBottom() < result.getBottom())
        result.setBottom(addition.getBottom());
    if (addition.getTop() > result.getTop())
        result.setTop(addition.getTop());
    return result;
}
 
開發者ID:mkl-public,項目名稱:testarea-itext5,代碼行數:14,代碼來源:UnifiedPagesizeMerging.java

示例2: calculateScaledRectangle

import com.itextpdf.text.Rectangle; //導入方法依賴的package包/類
private static Rectangle calculateScaledRectangle(List<Rectangle> boxes, Float[] ratios, int rotation) {
	if (ratios == null || boxes.size() == 0)
		return null;
	Rectangle smallestBox = null;
	// find smallest box
	float smallestSquare = Float.MAX_VALUE;
	for (Rectangle box : boxes) {
		if (box != null) {
			if (smallestBox == null) {
				smallestBox = box;
			}
			if (smallestSquare > box.getWidth() * box.getHeight()) {
				// set new smallest box
				smallestSquare = box.getWidth() * box.getHeight();
				smallestBox = box;
			}
		}
	}
	if (smallestBox == null)
		return null; // no useable box was found

	// rotate the ratios according to the rotation of the page
	float[] rotRatios = rotateRatios(ratios, rotation);

	// use smallest box as basis for calculation
	Rectangle scaledBox = new Rectangle(smallestBox);

	scaledBox.setLeft(smallestBox.getLeft() + (smallestBox.getWidth() * rotRatios[0]));
	scaledBox.setBottom(smallestBox.getBottom() + (smallestBox.getHeight() * rotRatios[1]));
	scaledBox.setRight(smallestBox.getLeft() + (smallestBox.getWidth() * (1 - rotRatios[2])));
	scaledBox.setTop(smallestBox.getBottom() + (smallestBox.getHeight() * (1 - rotRatios[3])));

	return scaledBox;
}
 
開發者ID:mbaeuerle,項目名稱:Briss-2.0,代碼行數:35,代碼來源:CropManager.java

示例3: calculateScaledRectangle

import com.itextpdf.text.Rectangle; //導入方法依賴的package包/類
public static Rectangle calculateScaledRectangle(final List<Rectangle> boxes, final Float[] ratios, final int rotation) {
	if (ratios == null || boxes.size() == 0)
		return null;
	Rectangle smallestBox = null;
	// find smallest box
	float smallestSquare = Float.MAX_VALUE;
	for (Rectangle box : boxes) {
		if (box != null) {
			if (smallestBox == null) {
				smallestBox = box;
			}
			if (smallestSquare > box.getWidth() * box.getHeight()) {
				// set new smallest box
				smallestSquare = box.getWidth() * box.getHeight();
				smallestBox = box;
			}
		}
	}
	if (smallestBox == null)
		return null; // no useable box was found

	// rotate the ratios according to the rotation of the page
	float[] rotRatios = rotateRatios(ratios, rotation);

	// use smallest box as basis for calculation
	Rectangle scaledBox = new Rectangle(smallestBox);

	scaledBox.setLeft(smallestBox.getLeft() + (smallestBox.getWidth() * rotRatios[0]));
	scaledBox.setBottom(smallestBox.getBottom() + (smallestBox.getHeight() * rotRatios[1]));
	scaledBox.setRight(smallestBox.getLeft() + (smallestBox.getWidth() * (1 - rotRatios[2])));
	scaledBox.setTop(smallestBox.getBottom() + (smallestBox.getHeight() * (1 - rotRatios[3])));

	return scaledBox;
}
 
開發者ID:mbaeuerle,項目名稱:Briss-2.0,代碼行數:35,代碼來源:RectangleHandler.java

示例4: cleanUpContent

import com.itextpdf.text.Rectangle; //導入方法依賴的package包/類
/**
 * <a href="http://stackoverflow.com/questions/32448118/issue-in-removing-header-and-footer-in-pdf-using-itext-pdf">
 * Issue in Removing Header and Footer in PDF using iText PDF
 * </a>
 * <br/>
 * <a href="https://www.dropbox.com/s/xznwx4ogemsgd42/spec.pdf?dl=0">
 * spec.pdf
 * </a>
 * <p>
 * removes header and footer based on the configuration
 * </p>
 * <p>
 * This is the original code by the OP whith minor changes to render it runnable
 * in this testarea project.
 * </p>
 * <p>
 * Issues observed on landscape pages of the test file can be prevented by using
 * <code>stamper.setRotateContents(false)</code>, see below.
 * </p>
 */
public static void cleanUpContent(PdfReader reader,String targetPDFFile, float upperY, float lowerY, boolean highLightColor) throws Exception
{
    OutputStream outputStream = new FileOutputStream(targetPDFFile);
    PdfStamper stamper = new PdfStamper(reader, outputStream);
    //stamper.setRotateContents(false);
    List<PdfCleanUpLocation> cleanUpLocations = new ArrayList<PdfCleanUpLocation>();

    for (int i = 1; i <= reader.getNumberOfPages(); i++)
    {
        Rectangle pageRect = reader.getCropBox(i);  
        Rectangle headerRect= new Rectangle(pageRect);
        headerRect.setBottom(headerRect.getTop()-upperY);               
        Rectangle footerRect= new Rectangle(pageRect);
        footerRect.setTop(footerRect.getBottom()+lowerY);   

        if(highLightColor)
        {
            cleanUpLocations.add(new PdfCleanUpLocation(i, headerRect,BaseColor.GREEN));
            cleanUpLocations.add(new PdfCleanUpLocation(i, footerRect,BaseColor.GREEN));
        }
        else
        {
            cleanUpLocations.add(new PdfCleanUpLocation(i, headerRect));
            cleanUpLocations.add(new PdfCleanUpLocation(i, footerRect));
        }
    }   
    PdfCleanUpProcessor cleaner = new PdfCleanUpProcessor(cleanUpLocations, stamper);
    try
    {
        cleaner.cleanUp();
    }
    catch(Exception e)
    {
         e.printStackTrace();
    }

    stamper.close();
    reader.close();
    outputStream.flush();
    outputStream.close();
}
 
開發者ID:mkl-public,項目名稱:testarea-itext5,代碼行數:62,代碼來源:RemoveHeaderFooter.java


注:本文中的com.itextpdf.text.Rectangle.setBottom方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。