pdftotif.dpr

来自「ImageMagick library of image with Visua」· DPR 代码 · 共 55 行

DPR
55
字号
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.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?