[gs-devel] PS to PDF convertion : problem using ghostscript gsdll32.dll

Mário Pinto Monteiro mpinto at cnpq.br
Thu Feb 5 12:13:19 PST 2004


Im a Delphi develloper and i trying to use the gsdll32.dll to convert ps
files to pdf.

The application works fine, but the original header/footer margins in the
pdf file is lost in the convertion.

In ghostview the "convert" options makes the convertion to work without lost
the header/footer margins.

Whats wrong with my app?

Follow the implementation of convertion:

procedure TF_Main.Button2Click(Sender: TObject);
var
   minst : Pgs_main_instance;
   code:integer;
   instance:Pointer;
   argv:PPChar;
begin
  new(instance);
  setlength(argv,10);
  code:=gsapi_new_instance(@instance,nil);
  if code<>0 then
  begin
    raise Exception.Create('Impossible to open an instance of ghostscript.
Error code: '+IntToStr(code));
  end;

  try

    argv[0] := 'ps2pdf';
    argv[1] := '-dNOPAUSE';
    argv[2] := '-dBATCH';
    argv[3] := '-dSAFER';
    argv[4] := '-sDEVICE=pdfwrite';
    argv[5] := '-sOutputFile=file1.pdf';
    argv[6] := '-c';
    argv[7] := '.setpdfwrite';
    argv[8] := '-f';
    argv[9] := 'file1.ps';

    code := gsapi_init_with_args(instance,length(argv),argv);
    if code<0 then
      raise Exception.Create('ERROR: init_args: '+IntToStr(code));
    gsapi_exit(minst);
    gsapi_delete_instance(minst);
  finally
  end;
end;


TIA
--
Mário Pinto Monteiro  - mpinto at cnpq.br




More information about the gs-devel mailing list