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

將PDF轉TIF檔

尚未結案
woodss
一般會員


發表:13
回覆:24
積分:17
註冊:2003-07-24

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-08-11 11:50:54 IP:61.64.xxx.xxx 未訂閱
請問有人會將PDF轉成TIF檔ㄇ 請用Adobe 的SDK 功能如下 var AcroApp : Variant; AVDoc : Variant; PDDoc : Variant; IsSuccess : Boolean; infile : String; outfile: String; begin OpenDialog1.Filter :='*.PDF|*.PDF'; if not OpenDialog1.Execute Then exit; infile:=OpenDialog1.FileName; outfile:= Copy(infile,1,length(infile )-3) 'tif'; screen.Cursor := -11; AcroApp := CreateOleObject('AcroExch.App'); AVDoc := CreateOleObject('AcroExch.AVDoc'); AVDoc.Open(infile, ''); //在來如何寫
pgdennis
資深會員


發表:41
回覆:526
積分:443
註冊:2002-05-23

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-08-12 15:39:30 IP:218.163.xxx.xxx 未訂閱
只能幫你一半的忙,經我測試,只有一頁的 class="code"> procedure TForm1.Button1Click(Sender: TObject); var AcroApp,AVDoc,PDDoc,Tempdoc:variant; NUM,i:integer; begin try AcroApp := CreateoleObject('AcroExch.App'); AVDoc := CreateoleObject('AcroExch.AVDoc'); Tempdoc := CreateOleObject('AcroExch.PDDoc'); AVDoc:= AcroApp.GetActiveDoc ; AVDoc.Open('D:\longhorn.pdf',''); If AVDoc.IsValid Then begin PDDoc:=AVDoc.GetPDDoc; NUM:=PDDoc.GetNumPages; for i:=0 to NUM-1 do begin Tempdoc.create; Tempdoc.InsertPages(-1,PDDoc,i,1,false); If Tempdoc.Save( 1 ,'d:\longhorn' inttostr(i) '.tif') <> True Then showmessage( 'Impossible '); Tempdoc.close; end; end; finally PDDoc.close; AVDoc.Close(True); AcroApp.Exit; Tempdoc := null; PDDoc := null; AVDoc := null; AcroApp := null; end; end; 永遠追不上技術更新的速度
------
星期一,二...無窮迴圈@@
qoo1234
版主


發表:256
回覆:1167
積分:659
註冊:2003-02-24

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-08-12 16:37:32 IP:61.216.xxx.xxx 未訂閱
元件下載: http://groups.yahoo.com/group/delphimagick/files/ImageMagick%20Classes/ http://groups.yahoo.com/group/delphimagick/message/34    program PdfToTif; {$APPTYPE CONSOLE}    { This commandline tool shows how to use MagickImage for conversion from PDF to TIF }    uses SysUtils, MagickImage;    var i, NumPages: integer; AFileName: string; Img: TMagickImage; S, T: string;    begin Img := TMagickImage.Create; if ParamCount > 0 then begin    AFileName := ParamStr(1); T := ExtractFileName(AFileName); S := Copy(T, 1, Pos('.', T) - 1);    // Determine number of pages in PDF Img.ImageInfo.Ping := True; Img.LoadFromFile(AFilename); NumPages := Img.FrameCount;    // Page numbers start at 0 for i := 0 to NumPages - 1 do with Img do begin    // Remove old picture / info Clear;    // Set defaults Resolution := 200; // The resolution at which to read    // Set the page number (and just one page to load) ImageInfo.Scene := i; ImageInfo.NumberScenes := 1;    // Load the images LoadFromFile(AFileName);    // And save the result to TIF SaveToFile('C:\Temp\Tif\' + S + IntToStr(i + 1) + '.tif'); end;    end; Img.Free; end.    網海無涯,學無止境!
woodss
一般會員


發表:13
回覆:24
積分:17
註冊:2003-07-24

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-08-12 17:10:23 IP:61.64.xxx.xxx 未訂閱
pgdennis兄 感謝你的回答 你提供的程式碼應該沒有轉成Tif檔案 還是PDF的格式 只是變成一頁一檔的PDF 你可以用UltraEdit 開轉好的Tif檔 如果前三碼為49 49 2A 表示是tif檔 如是25 50 44 46 就還是PDF檔 不果我覺得只差一點點了 可能還要有個轉換動作ㄅ qoo1234兄 你提供連接下載的元件無法連接ㄝ 另外此元件要付費ㄇ
qoo1234
版主


發表:256
回覆:1167
積分:659
註冊:2003-02-24

發送簡訊給我
#5 引用回覆 回覆 發表時間:2003-08-12 17:18:17 IP:61.216.xxx.xxx 未訂閱
引言: qoo1234兄 你提供連接下載的元件無法連接ㄝ<--必須加入先yahoo會員 另外此元件要付費ㄇ
http://www.simdesign.nl/components/imagemagick.html You can download this component wrapper archive here. By downloading you must agree to the license in the source files (MPL) and to the disclaimer in the readme.txt. 網海無涯,學無止境!
pgdennis
資深會員


發表:41
回覆:526
積分:443
註冊:2002-05-23

發送簡訊給我
#6 引用回覆 回覆 發表時間:2003-08-12 20:16:19 IP:211.74.xxx.xxx 未訂閱
引言: pgdennis兄 感謝你的回答 你提供的程式碼應該沒有轉成Tif檔案 還是PDF的格式 只是變成一頁一檔的PDF 你可以用UltraEdit 開轉好的Tif檔 如果前三碼為49 49 2A 表示是tif檔 如是25 50 44 46 就還是PDF檔 不果我覺得只差一點點了 可能還要有個轉換動作ㄅ qoo1234兄 你提供連接下載的元件無法連接ㄝ 另外此元件要付費ㄇ
我說過只有PDF檔只有一頁的情形才可以正常轉成tif..我有用ACDSEE開來看.只要PDF檔大於二頁..就沒辦法了..不知哪裡有錯誤..找不出來 PS:剛回家試了一下..竟然全都不能轉成TIF檔了..有鬼了... 永遠追不上技術更新的速度 發表人 -
------
星期一,二...無窮迴圈@@
系統時間:2024-05-20 3:55:42
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!