package pdf2;
import tool.*;
public class pro {
String[] data=new String[5000];
String[] title=new String[50];
String[] subdata=new String[5000];
int subnumber,datanumber;
public static void main(String[] args) {
pro te=new pro();
}
pro(){
int tr;
for(tr=1;tr<15;tr++){
readfile sub3=new readfile();
sub3.makedata(tr+".txt","UTF-8");
subdata=sub3.data;
subnumber=sub3.datanumber;
int s,sx;
String str;
str="";
sx=0;
for(s=9;s<subnumber+1;s++){
sx=sx+1;
data[sx]=subdata[s];
}
datanumber=sx;
title[1]=subdata[7];
title[2]="犬";
makepdf sub=new makepdf();
sub.title=title;
sub.data=data;
sub.number=subnumber;
sub.makedata(tr+".pdf");
}
}
}
package pdf2;
import java.io.*;
import com.lowagie.text.*;
import com.lowagie.text.pdf.*;
public class makepdf{
String[] title=new String[50];
String[] data=new String[5000];
int number;
void makedata(String file){
FileOutputStream out = null;
BufferedOutputStream bout = null;
PdfWriter writer = null;
Document doc = null;
try {
out = new FileOutputStream(file);
bout = new BufferedOutputStream(out);
doc = new Document(new Rectangle(0,0,500,500));
writer = PdfWriter.getInstance(doc,bout);
doc.open();
Font kaku_24 = new Font(BaseFont.createFont("HeiseiKakuGo-W5","UniJIS-UCS2-H",BaseFont.NOT_EMBEDDED),18);
kaku_24.setColor(CMYKColor.BLUE);
Font mincho_12 = new Font(BaseFont.createFont("HeiseiMin-W3", "UniJIS-UCS2-HW-H",BaseFont.NOT_EMBEDDED),12);
int s;
doc.add(new Paragraph(title[1], kaku_24));
for(s=1;s<number+1;s++){
doc.add(new Paragraph(data[s], mincho_12));
}
} catch (FileNotFoundException e) { e.printStackTrace(); }
catch (DocumentException e) { e.printStackTrace(); }
catch (IOException e) {e.printStackTrace(); }
finally { doc.close(); System.out.println("ended..."); }
}
}
最終更新:2015年04月29日 03:57