itext pdf

5827 ワード

itext pdf
単純版

<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
<style>
/* */
.active{
	background-color:red;
}
/* */
.deActive{
	background-color:gray;
}
</style>
<button class="btn1 deActive">Google1</button>
<button class="btn2 deActive">Google2</button>
<button class="btn3 deActive">Google3</button>
<script>
$(document).ready(function(){ 
	$("[class^=btn]").on("click",function(event){
		// 
		$("[class^=btn]").each(function(){	
			$(this).removeClass("active").addClass("deActive");
		})
		// 
		if( event.currentTarget === this ){
			$(this).removeClass("deActive").addClass("active");
		};
	}); 
}); 
</script>

美観ボタン版

<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
<style>
.button,.button:visited {
	background:#222 url(overlay.png) repeat-x;
	display:inline-block;
	padding:5px 10px 6px;
	color:#fff;
	text-decoration:none;
	-moz-border-radius:6px;
	-webkit-border-radius:6px;
	-moz-box-shadow:0 1px 3px rgba(0,0,0,0.6);
	-webkit-box-shadow:0 1px 3px rgba(0,0,0,0.6);
	text-shadow:0 -1px 1px rgba(0,0,0,0.25);
	border-bottom:1px solid rgba(0,0,0,0.25);
	position:relative;
	cursor:pointer
}
.button:hover {
	background-color:#111;
	c
	olor:#fff;
}
.button:active {
	top:1px;
}
.small.button,.small.button:visited {
	font-size:11px
}
.button,.button:visited,.medium.button,.medium.button:visited {
	font-size:13px;
	font-weight:bold;
	line-height:1;
	text-shadow:0 -1px 1px rgba(0,0,0,0.25);
}
.large.button,.large.button:visited {
	font-size:14px;
	padding:8px 14px 9px;
}
.super.button,.super.button:visited {
	font-size:34px;
	padding:8px 14px 9px;
}
.pink.button, .magenta.button : visited {
	background-color:#e22092;
}
.pink.button:hover {
	background-color:#c81e82;
}
.green.button,.green.button:visited {
	background-color:#91bd09;
}
.green.button:hover {
	background-color:#749a02;
}
.red.button,.red.button:visited {
	background-color:#e62727;
}
.red.button:hover {
	background-color:#cf2525;
}
.orange.button,.orange.button:visited {
	background-color:#ff5c00;
}
.orange.button:hover {
	background-color:#d45500;
}
.blue.button,.blue.button:visited {
	background-color:#2981e4;
}
.blue.button:hover {
	background-color:#2575cf;
}
.yellow.button,.yellow.button:visited {
	background-color:#ffb515;
}
.yellow.button:hover {
	background-color:#fc9200;
}

</style>
</head>
<body>
<a class="btn1 large button blue"> </a>
<a class="btn2 large button blue"> </a>
<a class="btn3 large button blue"> </a>
<script>
$(document).ready(function(){ 
	$("[class^=btn]").on("click",function(event){
		// 
		$("[class^=btn]").each(function(){	
			$(this).removeClass("red").addClass("blue");
		})
		// 
		if( event.currentTarget === this ){
			$(this).removeClass("blue").addClass("red");
		};
	}); 
}); 
</script>
</body>


import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.jsoup.Connection.Response;
import org.jsoup.Jsoup;


public class DownImage {
	public static void crawleImage(String url){
		try {
			Response resultImageResponse = Jsoup.connect(url).
					ignoreContentType(true)
					.maxBodySize(Integer.MAX_VALUE)
					.header("Referer", "http://blog.sina.com.cn/")
					.execute();
			FileOutputStream out = (new FileOutputStream(new java.io.File("sinaimgs/" + parseName(url)+".jpg")));
			out.write(resultImageResponse.bodyAsBytes());           
			out.close();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	private static String parseName(String url){
		Pattern pattern = Pattern.compile("(?<=/)[a-zA-z0-9]+(?=(?:&\\d+)?$)");
		Matcher matcher =pattern.matcher(url);
		if(matcher.find()){
			return matcher.group();
		}
		return null;
	}
	public static String rePalceLink(String content){
		return content.replaceAll("<a .*?href=\"(.*?)\".*?>(.*?)</a>", "[$2:$1]");
	}
	public static String parseImageContent(String content){
		return null;
	}
	public static void main(String[] args) {
		crawleImage("http://s8.sinaimg.cn/mw690/001y7th8ty6KSfiKNbFe7&690");
		System.out.println(rePalceLink("<a href=\"http://snowelf.iteye.com\" title=\" \" class=\"welcome\"> lan13217</a>"));
	}
}