Neevia Technology Sites:   www.neevia.com  |  docuPub.com  |  www.neeviaPDF.com
:: Home :: Products :: Technical Support :: About Us :: Contact Us
Technical support > Neevia Document Converter Pro code samples
Example 1: How to convert a file (submitFile method) from Delphi  Print Example 

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, 
  Controls, Forms, Dialogs, StdCtrls, ComObj;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  DC : Variant;
  rv : Integer;
  fileToConvert : string;
begin

  fileToConvert := 'c:\test.doc';

  DC := CreateOleObject('Neevia.docConverter');

  DC.setParameter('DocumentOutputFormat', 'PDF');
  DC.setParameter('DocumentOutputFolder', 'c:\');
  DC.setParameter('PDFAutoRotatePage', 'All');

  rv := DC.submitFile(fileToConvert, '');

  If (rv <> 0) then
  begin
    Application.MessageBox(' *** SubmitFile error **** ','Error', MB_OK);
    Exit;
  end;

  rv := 2;
  While (rv = 2) do
  begin
    rv := DC.checkStatus(fileToConvert, '');
    Application.ProcessMessages;
    DC.doSleep(1000);
  end;

  if (rv = 0) then
    Application.MessageBox(' Converted successfully','Success', MB_OK)
   else
    Application.MessageBox(' Error converting','Error', MB_OK);

end;

end.




Copyright © 1999-2016 Neevia Technology. All Rights Reserved. Home | Products | Technical Support | About Us | Contact Us