Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * PDFファイルを結合する
- */
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- //PDF結合処理
- baos = pdfCombine(ufilePath, filelst,sfilePath,dto.t3Savefilename);
- BufferedInputStream in = null;
- BufferedOutputStream out = null;
- 以下中略
- ・
- ・
- ・
- 以下中略
- ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
- //結合PDFをダウンロードに表示
- in = new BufferedInputStream(bais);
- out = new BufferedOutputStream(response.getOutputStream()); //レスポンスに書き込む
- byte buf[] = new byte[1024];
- int len;
- while ((len = in.read(buf)) != -1) {
- out.write(buf, 0, len);
- }
- out.flush();
- bais.close();
- } catch (UnsupportedEncodingException e) {
- // TODO 自動生成された catch ブロック
- e.printStackTrace();
- } catch (IOException e) {
- // TODO 自動生成された catch ブロック
- e.printStackTrace();
- } finally {
- if (in != null) {
- in.close();
- }
- if (out != null) {
- out.close();
- }
- }
- return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement