全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:3684
推到 Plurk!
推到 Facebook!

如何用指令將文件列印至檔案?

答題得分者是:william
channel
尊榮會員


發表:67
回覆:707
積分:854
註冊:2002-05-02

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-04-01 10:10:13 IP:211.21.xxx.xxx 未訂閱
各位前輩: 小弟目前使用CutePDF的Driver透過列印將文件轉成PDF,小弟希望透過程式直接指定轉出PDF的檔名及路徑,不需跳出另存新檔(PDF)的畫面,不知要如何做?…敬請指教,感激不盡… 小弟目前的作法: ShellExecute(0, 'print', 'C:\abc.doc', 'CutePDF Writer', 'C:\abc.pdf', SW_HIDE); 使用上述指令,仍然會跳出另存新檔(PDF)的畫面,希望直接將abc.doc檔案透過CutePDF Writer直接轉成abc.pdf檔,不需讓使用者選擇路徑及輸入檔名再按存檔鈕…各位大大幫幫小弟的忙吧…感激不盡…
------
~小弟淺見,參考看看~
william
版主


發表:66
回覆:2535
積分:3048
註冊:2002-07-11

發送簡訊給我
#2 引用回覆 回覆 發表時間:2004-04-01 11:35:11 IP:147.8.xxx.xxx 未訂閱
A quick search: You CANNOT bypass the dialog unless you pay for it (the Custom edition).    http://www.cutepdf.com/Support/faq.asp#Writer
領航天使
站長


發表:12216
回覆:4186
積分:4084
註冊:2001-07-25

發送簡訊給我
#3 引用回覆 回覆 發表時間:2004-04-01 11:43:57 IP:192.168.xxx.xxx 未訂閱
若真的有商業用途最好購買正式版的cutepdf 不然就考慮自己丟入鍵盤的按鍵碼給cutepdf 請參考這幾篇 http://delphi.ktop.com.tw/quicksearch.exe/quicksearch?SearchStr=Áä½L ¼ÒÀÀ ~~~Delphi K.Top討論區站長~~~
------
~~~Delphi K.Top討論區站長~~~
william
版主


發表:66
回覆:2535
積分:3048
註冊:2002-07-11

發送簡訊給我
#4 引用回覆 回覆 發表時間:2004-04-01 11:50:58 IP:147.8.xxx.xxx 未訂閱
Another method: 1) install a postscript printer (my favorite: Apple LaserWriter) 2) print to a postscript file using the printer 3) use ghostscript (command line) to convert the ps file to pdf (CutePDF is using too....) 發表人 - william 於 2004/04/01 11:55:11
channel
尊榮會員


發表:67
回覆:707
積分:854
註冊:2002-05-02

發送簡訊給我
#5 引用回覆 回覆 發表時間:2004-04-01 14:06:28 IP:211.21.xxx.xxx 未訂閱
引言: A quick search: You CANNOT bypass the dialog unless you pay for it (the Custom edition). http://www.cutepdf.com/Support/faq.asp#Writer
william大大: 感謝您的回應… 小弟了解…小弟想說可以Free使用…小弟想太多了… <>< face="Verdana, Arial, Helvetica">引言: 若真的有商業用途最好購買正式版的cutepdf 不然就考慮自己丟入鍵盤的按鍵碼給cutepdf 請參考這幾篇 http://delphi.ktop.com.tw/quicksearch.exe/quicksearch?SearchStr=Áä½L ¼ÒÀÀ 天使大大: 感謝您的回應,小弟研究看看…不過好像有點難… <>< face="Verdana, Arial, Helvetica">引言: Another method: 1) install a postscript printer (my favorite: Apple LaserWriter) 2) print to a postscript file using the printer 3) use ghostscript (command line) to convert the ps file to pdf (CutePDF is using too....) william大大: 再次感謝您的回應… 您所提供的方法,小弟不太懂耶…
------
~小弟淺見,參考看看~
william
版主


發表:66
回覆:2535
積分:3048
註冊:2002-07-11

發送簡訊給我
#6 引用回覆 回覆 發表時間:2004-04-01 14:22:19 IP:147.8.xxx.xxx 未訂閱
Ghostscript can convert postscript file into pdf, FREE. You can find a batch file 'ps2pdf.bat' in ghostscript. In order to create a postscript file, you need a postscript printer and do a print to file using that printer. Apple LaserWriter is probably the first postscript printer in the world 
channel
尊榮會員


發表:67
回覆:707
積分:854
註冊:2002-05-02

發送簡訊給我
#7 引用回覆 回覆 發表時間:2004-04-01 14:53:22 IP:211.21.xxx.xxx 未訂閱
引言: Ghostscript can convert postscript file into pdf, FREE. You can find a batch file 'ps2pdf.bat' in ghostscript. In order to create a postscript file, you need a postscript printer and do a print to file using that printer. Apple LaserWriter is probably the first postscript printer in the world >< face="Verdana, Arial, Helvetica"> william大大: 小弟真是不材…可否舉個例子…(印表機名稱是:Lexmark Color 4079 plus PS) 1)將C:\test.doc轉C:\test.ps,指令如何下? 2)將C:\test.ps轉C:\test.pdf,指令如何下? 感激不盡…
------
~小弟淺見,參考看看~
william
版主


發表:66
回覆:2535
積分:3048
註冊:2002-07-11

發送簡訊給我
#8 引用回覆 回覆 發表時間:2004-04-01 15:15:29 IP:147.8.xxx.xxx 未訂閱
1) Replace the parameter 'CutePDF Writer' with you printer name. 2) Using ShellExecute, CreateProcess, WinExec or whatever method execute ps2pdf, e.g. 'ps2pdf c:\test.ps c:\test.pdf'. BTW, ps2pdf likes the current directory being changed to its own directory before execution.
channel
尊榮會員


發表:67
回覆:707
積分:854
註冊:2002-05-02

發送簡訊給我
#9 引用回覆 回覆 發表時間:2004-04-01 15:38:43 IP:211.21.xxx.xxx 未訂閱
引言: 1) Replace the parameter 'CutePDF Writer' with you printer name. 2) Using ShellExecute, CreateProcess, WinExec or whatever method execute ps2pdf, e.g. 'ps2pdf c:\test.ps c:\test.pdf'. BTW, ps2pdf likes the current directory being changed to its own directory before execution.
感謝William大大,一直幫小弟的忙,我看我還是放棄了,因為我執行ShellExecute(0, 'print', 'E:\abc.doc', 'Lexmark Color 4079 plus PS', 'E:\abc.ps', SW_HIDE);還是一樣會出現另存新檔的畫面…又回到原先的問題,還是花點錢買一下CutePDF…
------
~小弟淺見,參考看看~
william
版主


發表:66
回覆:2535
積分:3048
註冊:2002-07-11

發送簡訊給我
#10 引用回覆 回覆 發表時間:2004-04-01 16:05:17 IP:147.8.xxx.xxx 未訂閱
Oh.. I think your ShellExecute parameter is incorrect... 'printto' instead of 'print'. Anyway it seems that word don't accept command line option for the output file. Perhaps you should use Ole to control it? By looking at the PrintOut method in word's help, it should be possible in providing the output filename.
channel
尊榮會員


發表:67
回覆:707
積分:854
註冊:2002-05-02

發送簡訊給我
#11 引用回覆 回覆 發表時間:2004-04-01 17:45:22 IP:211.21.xxx.xxx 未訂閱
引言: Oh.. I think your ShellExecute parameter is incorrect... 'printto' instead of 'print'. Anyway it seems that word don't accept command line option for the output file. Perhaps you should use Ole to control it? By looking at the PrintOut method in word's help, it should be possible in providing the output filename.
good idea… william大大:小弟已成功將word檔轉ps檔了 感激不盡… 發表人 - channel 於 2004/04/01 17:47:25
------
~小弟淺見,參考看看~
WhiteFang
一般會員


發表:9
回覆:23
積分:6
註冊:2002-11-22

發送簡訊給我
#12 引用回覆 回覆 發表時間:2004-08-18 17:35:07 IP:211.22.xxx.xxx 未訂閱
我與channel有一樣的需求,也依照上述方法修改,但我仍然會出現要求輸入檔名的視窗,我用的是BCB,語法如下: ShellExecute(0,"printto","C:\\dhtmltest.html","Lexmark4079PS","c:\\abcde.ps",SW_HIDE); 不管是DOC,TXT,html都是一樣....似乎完全不理會輸出檔名,請問該如何處理?與作業系統有關嗎?印表機的安裝是否連接阜是「檔案」? 謝謝!
系統時間:2024-05-20 3:19:06
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!