freemark中插入图片

freemark文件中的图片格式是BASE64,

模板中的图片代码块,${(img)!}是图片变量


	  
		
		
		  
		  
		  
		  
		  
		  
		  
		  
		  
		  
		  
		  
		
		
		
	  
	  ${(img)!}                  
	                    
		                  
	                

生成${(img)!}图片变量(BASE64格式)

public String getEmpAutograph(String filePath) {
		String img =null;
		if(StringUtils.isNotEmpty(filePath)){
			InputStream in = null;
			byte[] picdata = null;
			try {
				in = new FileInputStream(filePath);
				picdata = new byte[in.available()];
				in.read(picdata);
			} catch (Exception e) {
				e.printStackTrace();
			}finally{
				try {
					in.close();
				} catch (IOException e) {
					
					e.printStackTrace();
				}
			}
			BASE64Encoder encoder = new BASE64Encoder();
			img = encoder.encode(picdata);
			return img;
		}else{
			return null;
		}
	}

 

你可能感兴趣的:(代码,freemark中插入图片,freemark导出word,java)