Loading...

Load existing PDF to GdPicture object

Support for GdPicture Light Imaging Toolkit and GdPicture Pro Imaging ActiveX/SDK.

Load existing PDF to GdPicture object

Postby Slava » Wed Jun 27, 2007 4:48 pm

Hi,

i cannot open PDF with GdPicture Object in Delphi 7 with:
Code: Select all
oGdPicture.LoadFromFile('C:\1.pdf');

while GdViewer.DisplayFromFile() and GdViewer.DisplayFromPdfFile() both work fine with the same file.

May be simple but sorry i spent a few hours already on it :(

Slava
Slava
 
Posts: 66
Joined: Fri Jun 22, 2007 4:43 pm

Postby Loïc » Wed Jun 27, 2007 5:07 pm

Hi,

It's normal, you can't open a PDF file with a cGdPicture object. You can only view it with the GdViewer.

Best regards,

Loïc
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4430
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Postby Slava » Wed Jun 27, 2007 5:14 pm

oh that is bad, how do i MakeThumbnaill of a PDF then?

slava
Slava
 
Posts: 66
Joined: Fri Jun 22, 2007 4:43 pm

Postby Loïc » Wed Jun 27, 2007 5:18 pm

You can do like that:

Code: Select all
oGdViewer.DisplayFromPdfFile ("c:\test.pdf")
oGdPicture.SetNativeImage (oGdViewer.GetNativeImage)

nThumbID = oGdPicture.MakeThumbnail(300, 300)



Loïc
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4430
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Postby Slava » Thu Jun 28, 2007 9:54 am

hi Loic,

did like you said, PDF loads but I get an error on when PDF is loaded in oGdPicture when i do oGdPicture.GetHeight

says: Priveleged Instruction.

only with PDF :?

Slava
Slava
 
Posts: 66
Joined: Fri Jun 22, 2007 4:43 pm

Postby Loïc » Thu Jun 28, 2007 9:59 am

It it working for me. I didn't get any Priveleged Instruction error.

Could you write me the code you are using ?

Regards,

Loïc
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4430
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Postby Slava » Thu Jun 28, 2007 10:32 am

Hi Loic,

i have created a new delphi project to check if my code contains errors somewhere else. But i still get the same error.
Code: Select all
unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}
const PDFpassword = '';
const gdViewerLicence = '0012345678910111213141516';         //Demo license key
const gdPictureLicence = '0332966657783387670301864';        //Demo tot 30 juni 2007
const quickPDFLicence = '31393639891433D970785E579889A9F5';  //Demo tot 4 juli 2007  http://www.gdpicture.com/forum/forum.php?view=145
var   oGdPicture: Variant;



procedure TForm1.Button1Click(Sender: TObject);
var gdView: TgdViewer;
    URL: String;
begin
  URL := 'E:\Documents and Settings\chris\Bureaublad\Bex Factuur\Input\Javocom_imageonly.pdf';

  //check extention
  //if RightStr(URL, 3) = 'pdf' then
  //  begin
      gdView := TgdViewer.Create(Self);
      gdView.SetLicenceNumber(gdViewerLicence);
      gdView.SetIsedQuickPDFLicenceNumber(quickPDFLicence);
      gdView.DisplayFromPdfFile(URL, PDFpassword);
      oGdPicture.SetNativeImage(gdView.GetNativeImage);
      gdView.ClosePicture;
      gdView.Free;
  //  end
  //else oGdPicture.LoadFromFile(URL);

  if oGdPicture.GetNativeImage = 0 then Exit;
  if oGdPicture.GetHeight > oGdPicture.GetWidth then
    ShowMessage('its a vertical pdf page');
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  oGdPicture := CreateOleObject('Gdpicturepro.cGdPicture');
  oGdPicture.SetLicenceNumber(gdPictureLicence);
end;

end.


i can send the project file and the pdf.

Slava
Slava
 
Posts: 66
Joined: Fri Jun 22, 2007 4:43 pm

Postby Loïc » Thu Jun 28, 2007 10:54 am

Hi,

Your crash come from here:

You are doing

Code: Select all
gdView.ClosePicture;


and just after:


Code: Select all
if oGdPicture.GetHeight > oGdPicture.GetWidth then


At this call you are trying to get informations about an image which whas previously released.


You have many solutions:

First solution:

Call
Code: Select all
 gdView.ClosePicture;
after all the image manipulation inside the GdPicture control.


Second solution:

Replace

Code: Select all
oGdPicture.SetNativeImage(gdView.GetNativeImage);


by

Code: Select all
oGdPicture.SetNativeImage(oGdPicture.CreateClonedImageI(gdView.GetNativeImage));



Best regards,

Loïc
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4430
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Postby Slava » Thu Jun 28, 2007 11:16 am

thank you for your support, it works well now. Fine working with you, quick and professional responds.

Slava
Slava
 
Posts: 66
Joined: Fri Jun 22, 2007 4:43 pm

Postby Loïc » Thu Jun 28, 2007 11:18 am

You're welcome! :wink:

Loïc
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4430
Joined: Tue Oct 17, 2006 10:48 pm
Location: France


Return to GdPicture [Pro] ActiveX

Who is online

Users browsing this forum: No registered users and 1 guest

cron