本文整理汇总了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();
}
示例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( );
}
示例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();
}
示例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;
}
}
示例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( );
}