1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  package org.seasar.tuigwaa.plugin.basic;
17  
18  import java.util.Iterator;
19  import java.util.List;
20  
21  import org.seasar.tuigwaa.cms.core.CmsRequest;
22  import org.seasar.tuigwaa.cms.core.CmsResponse;
23  import org.seasar.tuigwaa.plugin.PluginException;
24  import org.seasar.tuigwaa.plugin.PluginRequest;
25  
26  import com.lowagie.text.Chunk;
27  import com.lowagie.text.Font;
28  import com.lowagie.text.Phrase;
29  
30  public class PdfSizePlugin extends SizePlugin {
31  
32  	public Object doPDFView(CmsRequest request, CmsResponse response, PluginRequest prequest) throws PluginException {
33  				
34  		String[] array = prequest.getArgs();
35  		Object child = prequest.getChild();
36  		
37  		if(array == null) return child;
38  		
39  		if(array.length >= 1){
40  
41  			String sizestr = array[0].replaceAll("px|PX|pX|Px","");
42  			float size = Float.parseFloat(sizestr);			
43  		
44  			if(child instanceof Phrase){
45  				Phrase p = (Phrase) child;
46  				List list = p.getChunks();
47  				if(list != null){
48  					for(Iterator i = list.iterator();i.hasNext();){
49  						Chunk c = (Chunk)i.next();
50  						Font nf = new Font(c.font());
51  						nf.setSize(size);
52  						c.setFont(nf);
53  					}
54  				}
55  			}
56  		}
57  		return child;
58  	}
59  	
60  }