Loading...

How to instantiate Viewer object in console application

Support for GdViewer OCX and GdViewer Pro ActiveX/SDK.

How to instantiate Viewer object in console application

Postby Marcio » Mon Oct 13, 2008 3:55 pm

Hello,
I want to know how to instatiate a viewer object in a Delphi console application.

I got to do it with Imaging object.
So, why do i want to use viewer in a console application? I need to make some manipulations/convertions in the source image.
This console application will do it in a batch process and return a value to my main window application written in another language.

Below a piece of code:

Code: Select all
program GeraCertPDF;

{$APPTYPE CONSOLE}

uses
  SysUtils, Dialogs, ActiveX,
  GdPicturePro5_TLB in 'GdPicturePro5_TLB.pas';


var
  GdVw : TGdViewer;
  GdImg : CocImaging;
  GdIm : cImaging;
begin
  { TODO -oUser -cConsole Main : Insert code here }

  if System.ParamCount = 1 then
    if ParamStr(1) <> '' then
    begin
      Try
      CoInitialize(nil);

      GdIm := GdImg.Create;
      GdIm.PdfNewPdf('a.pdf', '', '', '', '');

      GdVw.Create(nil);
      GdVw.DisplayFromPdfFile(ParamStr(1), '');

      CoUnInitialize;
      except
        on E: Exception do Writeln(E.Classname, ': ', E.Message);
      end;
    end;
end.


It throws me an error:
EAccessViolation: Access violation at address 00459455 in module 'GeraCertPDF.ex
e'. Read of address 01C92D3B


I think the error above is when I try to create the viewer object.

Thanks,
Marcio.
Marcio
 
Posts: 9
Joined: Tue Mar 04, 2008 4:08 pm

Re: How to instantiate Viewer object in console application

Postby Marcio » Tue Oct 14, 2008 9:15 pm

Hello. Anyone? Thanks.
Marcio
 
Posts: 9
Joined: Tue Mar 04, 2008 4:08 pm


Return to GdViewer [Pro] ActiveX

Who is online

Users browsing this forum: Exabot [Bot] and 1 guest