從資料庫讀取流來合併pdf

2021-07-25 12:51:00 字數 4371 閱讀 4119

public static void main(string args) throws exception );

while (querytype.next())

tutil.close(querytype);

system.out.println("公告型別數量:" + typelist.size());

for (int i = 0; i < typelist.size(); i++)

}// ---------------------------------

// 查詢所有公告內容--------------------

string sql = "select * from (select f.content from tmu_tmedms.t_tmedms_tm_anno_files f where f.doc_id in"

+ " (select t.id from tmu_tmedms.t_tmedms_tm_ann_info t where t.ann_num='1526' and t.ann_type_code= ?) order by f.doc_no) where rownum<101 ";

// 查詢單個公告內容-------------------

string onesql = "select a.content from (select rownum as rn, t.* from (select * from tmu_tmedms.t_tmedms_tm_anno_files f "

+ " where f.doc_id in (select t.id from tmu_tmedms.t_tmedms_tm_ann_info t where t.ann_num = '1526'"

+ " and t.ann_type_code =?) order by f.doc_no) t) a where rn =? and a.doc_type_code='anno'";

// 查詢該型別公告總數量

string countsql = "select max(h.page_num) from tmu_tmedms.t_tmedms_tm_ann_info h where h.ann_type_code=? and h.ann_num='1526'";

// 查詢雜文公告註冊號-----------------------

/** string

* regnumsql="select h.reg_num from tmu_tmedms.t_tmedms_tm_ann_search h,"

* +* "(select t.ann_num, t.ann_type_code from tmu_tmedms.t_tmedms_tm_anno_files f,"

* +* " tmu_tmedms.t_tmedms_tm_ann_info t where f.doc_id = t.id and t.ann_num = '1526'"

* +" and f.doc_no = ? and t.ann_type_code = ? order by f.doc_no) g"+

* " where h.ann_num = g.ann_num  and h.ann_type_code = g.ann_type_code and h.page_no = ? "

* ;*/

// long state= system.currenttimemillis();

date d = new date();

system.out.println(d);

document document = null;

document = new document(com.itextpdf.text.pagesize.a4, 50, 50, 50, 50);

file f = new file("d:\\g.pdf");

//filereader filereader = new filereader("d:\\g.pdf");

// document = new document(new pdfreader(files[0]).getpagesize(1));

pdfcopy copy = new pdfcopy(document, new fileoutputstream(f, true));

// fileoutputstream outputstream = new

// fileoutputstream("d:\\g.pdf",true);

document.open();

date d2 = new date();

system.out.println("開始:" + d2);

int n = 0;

int k = 0;

listlist1 = new arraylist();

for (int i = 0; i < stlist.size(); i++) );

if (count.next())

tutil.close(count);

if(i>3)

// 加入小節內容

for (int j = 1; j <= countanno; j++)

byte content1 = null;

resultset queryanno = tutil.doquery(onesql, new object );

if (queryanno.next())

tutil.close(queryanno);

// system.out.println(stlist.get(i)+":第"+j+"個");

inputstream is = new byteinputstream(content1, 0,

content1.length);

try catch (exception e) finally

/** file f=new file("d:/pdf/test"+stlist.get(i)+j+".pdf");

* fileoutputstream fos=new fileoutputstream(f);

* fos.write(content1); fos.flush(); fos.close();

*//*

* inputstream is=new

* byteinputstream(content1,0,content1.length); pdfreader reader

* = new pdfreader(is); pdfstamper stamper = new

* pdfstamper(reader, new

* fileoutputstream("d:\\b.pdf",true),encoding,true);

* pdfcontentbyte overcontent = stamper.getovercontent(1);

* overcontent.add(overcontent); stamper.close();

*/// outputstream output = new outputstreamwriter(new

// fileoutputstream("d:/merged2.txt",true),encoding);

}// --------------------------------

// inputstream is=new byteinputstream();

// mergepdf.addsources(sourceslist)

// string folder = "d:/pdf";

// string destinationfilename = "cqs.pdf";

/** string newname=null; for (int i = 0; i <3; i++)

*/// string filesinfolder = getfiles(folder);

/** for(int i = 0; i < getfiles(folder).length; i++)

*/// system.out.println(newname);

/** mergepdf.setdestinationfilename(folder + file.separator +

* destinationfilename); mergepdf.mergedocuments(); mergepdf.get

*//*

* date d1=new date(); system.out.println(d1); long end=

* system.currenttimemillis(); //

* system.out.println((end-state)/1000+"秒");*/}

document.close();

system.out.print("done");

}

AppSettings從資料庫讀取

1 2 提供對配置資訊的訪問 3 4public static class520 2122 23 24 25 26static 27 37return38 3940 41 在啟動時以後台任務重新整理配置資訊 42 43static 4462 catch exception ex 6365 66 ta...

如何從資料庫中讀取資料

今天要用資料庫的時候,我發現我竟然忘記了怎麼從資料庫中讀取資料,而查了一圈谷歌,又是非常失望 內容基本就是摘抄了mysqldb和web.py的官方文件,實在是失望。這篇文章先介紹mysqldb和web.py,django以後補上。db mysqldb.connect cursor db.cursor...

C 從資料庫讀取資料並輸出

連線資料庫,並從資料庫中讀取資料後並輸出 using system using system.collections.generic using system.linq using system.text using system.data.sqlclient namespace login nam...