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


Java PdfTemplate.getHeight方法代码示例

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


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

示例1: ImgTemplate

import com.lowagie.text.pdf.PdfTemplate; //导入方法依赖的package包/类
/** Creates an Image from a PdfTemplate.
 *
 * @param template the PdfTemplate
 * @throws BadElementException on error
 */
public ImgTemplate(PdfTemplate template) throws BadElementException{
    super((URL)null);
    if (template == null)
        throw new BadElementException("The template can not be null.");
    if (template.getType() == PdfTemplate.TYPE_PATTERN)
        throw new BadElementException("A pattern can not be used as a template to create an image.");
    type = IMGTEMPLATE;
    scaledHeight = template.getHeight();
    setTop(scaledHeight);
    scaledWidth = template.getWidth();
    setRight(scaledWidth);
    setTemplateData(template);
    plainWidth = getWidth();
    plainHeight = getHeight();
}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:21,代码来源:ImgTemplate.java

示例2: drawImage

import com.lowagie.text.pdf.PdfTemplate; //导入方法依赖的package包/类
protected void drawImage( PdfTemplate image, float imageX, float imageY,
		float height, float width, String helpText )
		throws DocumentException
{
	imageY = transformY( imageY, height );
	contentByte.saveState( );
	contentByte.concatCTM( 1, 0, 0, 1, imageX, imageY );
	float w = image.getWidth( );
	float h = image.getHeight( );
	contentByte.addTemplate( image, width / w, 0f / w, 0f / h, height / h,
			0f, 0f );
	if ( helpText != null )
	{
		showHelpText( imageX, imageY, width, height, helpText );
	}
	contentByte.restoreState( );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:18,代码来源:PDFPage.java

示例3: ImgTemplate

import com.lowagie.text.pdf.PdfTemplate; //导入方法依赖的package包/类
/** Creats an Image from a PdfTemplate.
 *
 * @param template the PdfTemplate
 * @throws BadElementException on error
 */
public ImgTemplate(PdfTemplate template) throws BadElementException{
    super((URL)null);
    if (template == null)
        throw new BadElementException("The template can not be null.");
    if (template.getType() == PdfTemplate.TYPE_PATTERN)
        throw new BadElementException("A pattern can not be used as a template to create an image.");
    type = IMGTEMPLATE;
    scaledHeight = template.getHeight();
    setTop(scaledHeight);
    scaledWidth = template.getWidth();
    setRight(scaledWidth);
    setTemplateData(template);
    plainWidth = width();
    plainHeight = height();
}
 
开发者ID:MesquiteProject,项目名称:MesquiteArchive,代码行数:21,代码来源:ImgTemplate.java

示例4: drawTotalPage

import com.lowagie.text.pdf.PdfTemplate; //导入方法依赖的package包/类
public void drawTotalPage( String text, int textX, int textY, int width,
		int height, TextStyle textInfo, float scale )
{
	PdfTemplate template = pageDevice.getPDFTemplate( scale );
	if ( template != null )
	{
		PdfContentByte tempCB = this.contentByte;
		this.containerHeight = template.getHeight( );
		this.contentByte = template;
		drawText( text, textX, textY, width, height, textInfo );
		this.contentByte = tempCB;
		this.containerHeight = pageHeight;
	}
}
 
开发者ID:eclipse,项目名称:birt,代码行数:15,代码来源:PDFPage.java

示例5: drawBackgroundImage

import com.lowagie.text.pdf.PdfTemplate; //导入方法依赖的package包/类
protected void drawBackgroundImage( float x, float y, float width,
		float height, float imageWidth, float imageHeight, int repeat,
		String imageUrl, byte[] imageData, float offsetX, float offsetY )
		throws Exception
{
	contentByte.saveState( );
	clip( x, y, width, height );
	
	PdfTemplate image = null;
	if ( imageUrl != null )
	{
		if ( pageDevice.getImageCache( ).containsKey( imageUrl ) )
		{
			image = pageDevice.getImageCache( ).get( imageUrl );
		}
	}
	if ( image == null )
	{
		Image img = Image.getInstance( imageData );
		if ( imageHeight == 0 || imageWidth == 0 )
		{
			int resolutionX = img.getDpiX( );
			int resolutionY = img.getDpiY( );
			if ( 0 == resolutionX || 0 == resolutionY )
			{
				resolutionX = 96;
				resolutionY = 96;
			}
			imageWidth = img.getPlainWidth( ) / resolutionX * 72;
			imageHeight = img.getPlainHeight( ) / resolutionY * 72;
		}

		image = contentByte.createTemplate( imageWidth, imageHeight );
		image.addImage( img, imageWidth, 0, 0, imageHeight, 0, 0 );

		if ( imageUrl != null && image != null )
		{
			pageDevice.getImageCache( ).put( imageUrl, image );
		}
	}

	boolean xExtended = ( repeat & BackgroundImageInfo.REPEAT_X ) == BackgroundImageInfo.REPEAT_X;
	boolean yExtended = ( repeat & BackgroundImageInfo.REPEAT_Y ) == BackgroundImageInfo.REPEAT_Y;
	imageWidth = image.getWidth( );
	imageHeight = image.getHeight( );

	float originalX = offsetX;
	float originalY = offsetY;
	if ( xExtended )
	{
		while ( originalX > 0 )
			originalX -= imageWidth;
	}
	if ( yExtended )
	{
		while ( originalY > 0 )
			originalY -= imageHeight;
	}

	float startY = originalY;
	do
	{
		float startX = originalX;
		do
		{
			drawImage( image, x + startX, y + startY, imageWidth,
					imageHeight );
			startX += imageWidth;
		} while ( startX < width && xExtended );
		startY += imageHeight;
	} while ( startY < height && yExtended );
	contentByte.restoreState( );
}
 
开发者ID:eclipse,项目名称:birt,代码行数:74,代码来源:PDFPage.java


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