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


Java TiffImage类代码示例

本文整理汇总了Java中com.lowagie.text.pdf.codec.TiffImage的典型用法代码示例。如果您正苦于以下问题:Java TiffImage类的具体用法?Java TiffImage怎么用?Java TiffImage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


TiffImage类属于com.lowagie.text.pdf.codec包,在下文中一共展示了TiffImage类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: main

import com.lowagie.text.pdf.codec.TiffImage; //导入依赖的package包/类
/**
 * Combines 2 tiff-files into 1 PDF (similar to tiffmesh).
 * 
 * @param args
 *            [0] the file with the odd pages [1] the file with the even
 *            pages [2] the resulting file
 */
public void main(String... args) throws Exception {
	if (args.length < 3) {
		System.err.println("OddEven needs 3 Arguments.");
		System.out
				.println("Usage: com.lowagie.examples.objects.images.tiff.OddEven odd_file.tif even_file.tif combined_file.pdf");
		return;
	}
	RandomAccessFileOrArray odd = new RandomAccessFileOrArray(args[0]);
	RandomAccessFileOrArray even = new RandomAccessFileOrArray(args[1]);
	Image img = TiffImage.getTiffImage(odd, 1);
	Document document = new Document(new Rectangle(img.getScaledWidth(), img.getScaledHeight()));
	PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(args[2]));
	document.open();
	PdfContentByte cb = writer.getDirectContent();
	int count = Math.max(TiffImage.getNumberOfPages(odd), TiffImage.getNumberOfPages(even));
	for (int c = 0; c < count; ++c) {

		Image imgOdd = TiffImage.getTiffImage(odd, c + 1);
		Image imgEven = TiffImage.getTiffImage(even, count - c);
		document.setPageSize(new Rectangle(imgOdd.getScaledWidth(), imgOdd.getScaledHeight()));
		document.newPage();
		imgOdd.setAbsolutePosition(0, 0);
		cb.addImage(imgOdd);
		document.setPageSize(new Rectangle(imgEven.getScaledWidth(), imgEven.getScaledHeight()));
		document.newPage();
		imgEven.setAbsolutePosition(0, 0);
		cb.addImage(imgEven);

	}
	odd.close();
	even.close();
	document.close();

}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:42,代码来源:OddEvenTest.java

示例2: addTiff

import com.lowagie.text.pdf.codec.TiffImage; //导入依赖的package包/类
private void addTiff(final File file, final Document document, final PdfWriter writer)
        throws Exception {
    RandomAccessFileOrArray randomAccess = createRamdomAccessSource(file);
   
    int pages = getPageCount(file);
    for (int i = 1; i <= pages; i++) {
        Image image = TiffImage.getTiffImage(randomAccess, i);
        addImage(image, document, writer);
    }

}
 
开发者ID:albfernandez,项目名称:joinpdf,代码行数:12,代码来源:JoinPdf.java

示例3: getPageCountTif

import com.lowagie.text.pdf.codec.TiffImage; //导入依赖的package包/类
public static int getPageCountTif(final File file) throws IOException {
    RandomAccessFileOrArray randomAccess = createRamdomAccessSource(file);
    return TiffImage.getNumberOfPages(randomAccess);
}
 
开发者ID:albfernandez,项目名称:joinpdf,代码行数:5,代码来源:JoinPdf.java


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