ImageVerifierCode 换一换
格式:DOCX , 页数:51 ,大小:42.86KB ,
资源ID:9340487      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/9340487.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(客户端对服务器端的pdf文件进行自动打印.docx)为本站会员(b****8)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

客户端对服务器端的pdf文件进行自动打印.docx

1、客户端对服务器端的pdf文件进行自动打印需要的包有commons-codec-1.6.jarcommons-logging-1.1.3.jarhttpclient-4.3.3.jarhttpclient-cache-4.3.3.jarhttpcore-4.3.2.jarhttpmime-4.3.3.jarlog4j-1.2.15.jarojdbc6.jarpdfbox-app-1.8.5.jar代码如下:import java.sql.Connection;import java.sql.DriverManager;import java.sql.SQLException;import jav

2、ax.swing.JOptionPane;public class ConnOracle public static Connection getConnectionOracle(String user, String password, String urlIp, String sid) throws ClassNotFoundException, SQLException Connection con = null; Class.forName(oracle.jdbc.driver.OracleDriver); String url = jdbc:oracle: + thin: + url

3、Ip + : + sid; con = DriverManager.getConnection(url, user, password); return con; /* * * 中利用定数。 * * */public class Constants public static final String TYOUHYOU_ID = TYOUHYOU_ID; public static final String RIYOUKANNSYO_CD = RIYOUKANNSYO_CD; public static final String LOCAL_PDF_BASYO = LOCAL_PDF_BASY

4、O; public static final String SERVER_PDF_BASYO = SERVER_PDF_BASYO; public static final String DB_USER_ID = DB_USER_ID; public static final String DB_SID = DB_SID; public static final String DB_PASSWORD = DB_PASSWORD; public static final String DB_URL = DB_URL; public static final String TAJYUUKIDOU_

5、ERROR = 多重起動:要確認; public static final String SONOTA = sonota; public static final String SONOTA_UNCOMP = sonota_uncomp; public static final String TYOUHYOUJIDOUSYUTURYOKU = 帳票自動出力処理実行; public static final String TEYIJI = 提示; public static final String HOUTEI = houtei; public static final String HOUT

6、EI_UNCOMP = houtei_uncomp; public static final String PDF = pdf; public static final String JPG = .jpg; public static final String C_PATH_TMP = C:/batch/tmp; public static final String LOG_FILE = lastTime.txt; public static final String START_FILE = start.txt; public static final String DB_ERROR = D

7、B接続時発生; public static final String INTERNET_ERROR = 接続; public static final String PRINT_ERROR = 接続、自動印刷処理中断。; public static final String JIDOUPRINT_ERROR = 自動印刷処理中断; public static final String PDFPRINT_ERROR = PDF印刷途中発生; public static final String PRINT_IP = PRINT_IP; public static final String APP

8、_INTERVAL = APP_INTERVAL; public static final String PROFILEPATH = C:batchconfigAutoPrint.conf; public static final String STARTTXTJIKANGSETE = C:/batch/tmp配下lastTime.txt日付時間設定。(日付時間yy-MM-dd HH:mm:ss.SSSSSS);import java.sql.Connection;import java.sql.PreparedStatement;import java.sql.ResultSet;impor

9、t java.sql.SQLException;import java.sql.Timestamp;import java.util.ArrayList;import java.util.List;public class Dao public String getFirstMaxTime(Connection conn, String hoyukansho_cdStr, String chohyo_idstr) throws SQLException String firstMaxTime = null; PreparedStatement pre = null; ResultSet res

10、ult = null; String sql = select max(to_char(tazzm208.shutsuryoku_date) + from tazzm208 + where tazzm208.hoyukansho_cd in (_IN_STRING2_) .replaceFirst(_IN_STRING2_, hoyukansho_cdStr); sql = sql + and tazzm208.chohyo_id in (_IN_STRING_).replaceFirst( _IN_STRING_, chohyo_idstr); try pre = conn.prepareS

11、tatement(sql); result = pre.executeQuery(); while (result.next() firstMaxTime = result.getString(1); finally try if (result != null) result.close(); if (pre != null) pre.close(); if (conn != null) conn.close(); catch (Exception e) e.printStackTrace(); return firstMaxTime; public List getOutputpath(C

12、onnection conn, String hoyukansho_cdStr, String chohyo_idstr, String maxTimeStr, String previousTimeStr) throws SQLException PreparedStatement pre = null; ResultSet result = null; String sql = ; List outputpathList = new ArrayList(); if (previousTimeStr = null) sql = select tazzm208.outputpath, + ta

13、zzm208.chohyo_id , + to_char(tazzm208.shutsuryoku_date) + from tazzm208 + where to_char(tazzm208.shutsuryoku_date) = ? + and tazzm208.hoyukansho_cd in (_IN_STRING2_) .replaceFirst(_IN_STRING2_, hoyukansho_cdStr); sql = sql + and tazzm208.chohyo_id in (_IN_STRING_) .replaceFirst(_IN_STRING_, chohyo_i

14、dstr); else sql = select tazzm208.outputpath, + tazzm208.chohyo_id , + to_char(tazzm208.shutsuryoku_date) + from tazzm208 + where to_char(tazzm208.shutsuryoku_date) ? + and tazzm208.hoyukansho_cd in (_IN_STRING2_) .replaceFirst(_IN_STRING2_, hoyukansho_cdStr); sql = sql + and tazzm208.chohyo_id in (

15、_IN_STRING_) .replaceFirst(_IN_STRING_, chohyo_idstr); try pre = conn.prepareStatement(sql); pre.setString(1, maxTimeStr); if (previousTimeStr != null) pre.setString(2, previousTimeStr); result = pre.executeQuery(); while (result.next() String outputpath = result.getString(1); String chohyo_id = res

16、ult.getString(2); String shutsuryoku_date = result.getString(3); String record = new String3; record0 = outputpath; record1 = chohyo_id; record2 = shutsuryoku_date; outputpathList.add(record); finally try if (result != null) result.close(); if (pre != null) pre.close(); if (conn != null) conn.close(

17、); catch (Exception e) e.printStackTrace(); return outputpathList; /* * * param conn * param chohyo_idp * param shutsuryoku_date * return * throws SQLException */ public String getCheckOutputpathResult(Connection conn, String chohyo_idparam, String shutsuryoku_dateparam) throws SQLException Prepared

18、Statement pre = null; ResultSet result = null; String outputpathStr = null; String sql = select tazzm208.outputpath + from tazzm208 + where tazzm208.chohyo_id = ? + and to_char(tazzm208.shutsuryoku_date) = ? ; try pre = conn.prepareStatement(sql); pre.setString(1, chohyo_idparam); pre.setString(2, s

19、hutsuryoku_dateparam); result = pre.executeQuery(); while (result.next() String outputpath = result.getString(1); outputpathStr = outputpath; finally try if (result != null) result.close(); if (pre != null) pre.close(); if (conn != null) conn.close(); catch (Exception e) e.printStackTrace(); return

20、outputpathStr; import java.awt.image.BufferedImage;import java.io.BufferedReader;import java.io.BufferedWriter;import java.io.File;import java.io.FileInputStream;import java.io.FileNotFoundException;import java.io.FileOutputStream;import java.io.FileReader;import java.io.FileWriter;import java.io.IO

21、Exception;import java.io.InputStream;import .ConnectException;import java.sql.Connection;import java.sql.SQLException;import java.util.ArrayList;import java.util.List;import javax.imageio.ImageIO;import javax.print.Doc;import javax.print.DocFlavor;import javax.print.DocPrintJob;import javax.print.Pr

22、intException;import javax.print.PrintService;import javax.print.PrintServiceLookup;import javax.print.SimpleDoc;import javax.print.attribute.DocAttributeSet;import javax.print.attribute.HashDocAttributeSet;import javax.print.attribute.HashPrintRequestAttributeSet;import javax.print.attribute.standar

23、d.MediaPrintableArea;import javax.print.attribute.standard.MediaSizeName;import javax.print.attribute.standard.OrientationRequested;import javax.swing.JOptionPane;import org.apache.http.HttpResponse;import org.apache.http.StatusLine;import org.apache.http.client.ClientProtocolException;import org.ap

24、ache.http.client.HttpClient;import org.apache.http.client.methods.HttpPost;import org.apache.http.impl.client.DefaultHttpClient;import org.apache.log4j.Logger;import org.apache.pdfbox.pdmodel.PDDocument;import org.apache.pdfbox.pdmodel.PDPage;public class MyThread extends Thread boolean printFlag =

25、false; private static Logger logger = Logger.getLogger(MyThread.class); public void run() BufferedWriter bw = null; BufferedReader input = null; BufferedReader inputstatus = null; File status = new File(C:/batch/status); File filestatus = new File(status, status.txt); List checkoutputpathresult = ne

26、w ArrayList(); List outputpathNotNull = new ArrayList(); logger.info(二重起動); / 二重起動 / 1以下存在、存在場合二重起動見表示、処理中断 / 二重起動:【】tmpstart.txt File filepathstart = new File(Constants.C_PATH_TMP); File filestart = new File(filepathstart, Constants.START_FILE); if (filestart.exists() logger.info(*二重起動*); / 表示、処理中断

27、 / :”多重起動:要確認” Object options = OK ; JOptionPane.showOptionDialog(null, Constants.TAJYUUKIDOU_ERROR, Constants.TEYIJI, JOptionPane.OK_OPTION, JOptionPane.INFORMATION_MESSAGE, null, options, options0); System.exit(0); while (true) try try inputstatus = new BufferedReader(new FileReader(filestatus); String statusStr = ; String statusread = inputstatus.readLine(); if (statusread != null) statusStr = statusread; if (500.equals(statusStr) inputstatus.close(); logger.info(処理中断); Ob

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1