掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
GhostScriptのgsdll32.dllの使い方について (ID:48444)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
こんにちは GhostScriptのgsdll32.dllを使って、pdfから画像を取り出したいと思って、次のリンクなどを参考にしています。 http://stackoverflow.com/questions/14764652/calling-external-dll-with-array-of-pchar-as-parameter-in-xe uses gsapi; procedure PDF2PNG(input : AnsiString; output: AnsiString); var ExitCode:integer; instance: Pointer; Arg: array of PAnsiChar; begin ExitCode := gsapi_new_instance(instance, nil); if ExitCode < 0 then raise Exception.Create('Impossible to open an instance of ghostscript. Error ExitCode: '+IntToStr(ExitCode)); try SetLength(Arg, 11); Arg[0] := PAnsiChar('ps2pdf'); Arg[1] := PAnsiChar('-dNOPAUSE'); Arg[2] := PAnsiChar('-dBATCH'); Arg[3] := PAnsiChar('-dSAFER'); Arg[4] := PAnsiChar('-sDEVICE=pngalpha'); Arg[5] := PAnsiChar('-r300'); Arg[6] := PAnsiChar('-dTextAlphaBits=4'); Arg[7] := PAnsiChar('-sOutputFile='+output+' Page-%02d.png'); Arg[8] := PAnsiChar('-c'); Arg[9] := PAnsiChar('.setpdfwrite'); Arg[10]:= PAnsiChar('-f'+ input); ExitCode := gsapi_init_with_args(instance, Length(Arg), @Arg[0]); if ExitCode < 0 then raise Exception.Create('ERROR: init_args: '+IntToStr(ExitCode)); gsapi_exit(instance); finally gsapi_delete_instance(instance); end; end; procedure TForm1.Button4Click(Sender: TObject); var PdfPath:string; begin PdfPath:= 'C:\tmp\'; pdf2tif(PdfPath+'test.pdf',PdfPath+'test.png'); end; 「Impossible to open an instance of ghostscript. Error code: -100.」が出て出力できません。 どこが悪いのかどなたか、教えてください。 よろしくお願いします。 Ghostscript 9.20 https://ghostscript.com/download/ Win10とDelphi 10 Seattleを使っています。
←解決時は質問者本人がここをチェックしてください。
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.