Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Newbe Question
  FAQ FAQ  Forum Search   Register Register  Login Login

Newbe Question

 Post Reply Post Reply
Author
Message
RhoTu View Drop Down
Beginner
Beginner


Joined: 29 Jun 09
Location: Minnesota
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote RhoTu Quote  Post ReplyReply Direct Link To This Post Topic: Newbe Question
    Posted: 06 Jul 09 at 9:58PM
Can anyone explain why the following code gives me a 'range check' error?  Test program has a TImage and a TButton.  If I issue the SetFillColor or the DrawBox functions the error occurs upon the RenderPageToDC(dpi,currPage,image1.Canvas.Handle) call.
 
procedure TForm1.Button1Click(Sender: TObject);
var
  qp:TMyQuickPDF;
  currPage,dpi:integer;
begin
  qp:=TMyQuickPDF.create; // unLockKey called in TMyQuickPDF.create after inherited create
  currpage:=qp.SelectedPage;
  dpi:=screen.PixelsPerInch;
  qp.SetPageDimensions(11*dpi,8.5*dpi);
//  qp.SetFillColor(0.8,0.1,0.1);
  qp.SetTextColor(0.01,0.01,0.9);
//  qp.DrawBox(1*dpi,1*dpi,4*dpi,1*dpi,0);
  qp.DrawTextBox(1*dpi,1*dpi,4*dpi,1*dpi,'This is a Test',0);
  qp.RenderPageToDC(dpi,currPage,image1.Canvas.Handle);
  freeAndNil(qp);
end;
 
TIA
 
RT
 
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3530
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 06 Jul 09 at 10:08PM
Hi What's in dpi?

Back to Top
RhoTu View Drop Down
Beginner
Beginner


Joined: 29 Jun 09
Location: Minnesota
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote RhoTu Quote  Post ReplyReply Direct Link To This Post Posted: 06 Jul 09 at 10:11PM
Screen.PixelsPerInch=96
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3530
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 07 Jul 09 at 5:47AM
Sorry... i didn't see it ;-)
What are the returning values of your functions?
result := QP.SetPageDimensions(...
result2 := QP.DrawBox(...
Perhaps then you see where's the prob.
If SetPageDimensions doesn't work then (later) your DrawBox getting out of range...
Something like this ...

Cheers, Ingo


Edited by Ingo - 07 Jul 09 at 6:41AM
Back to Top
DELBEKE View Drop Down
Debenu Quick PDF Library Expert
Debenu Quick PDF Library Expert
Avatar

Joined: 31 Oct 05
Location: France
Status: Offline
Points: 151
Post Options Post Options   Thanks (0) Thanks(0)   Quote DELBEKE Quote  Post ReplyReply Direct Link To This Post Posted: 07 Jul 09 at 7:26AM
You should also set the orgin with
Qp.SetOrigin(1); //Origin at top/left
Back to Top
RhoTu View Drop Down
Beginner
Beginner


Joined: 29 Jun 09
Location: Minnesota
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote RhoTu Quote  Post ReplyReply Direct Link To This Post Posted: 07 Jul 09 at 2:54PM
Sorry, none of the suggestions work.  I still get no '0' returns, yet I get the range check error but not all of the time.  Using D7 and VISTA64.  Can someone with Delphi see if they get the error as well?
 
 
procedure TForm1.Button1Click(Sender: TObject);
var
  qp:TMyQuickPDF;
  currPage,dpi:integer;
  i:integer;
begin
  try
    qp:=TMyQuickPDF.create; // unLockKey called in TMyQuickPDF.create after inherited create
    if 0=qp.SetOrigin(1)then
      showMessage('result: '+intToStr(i));
    currpage:=qp.SelectedPage;
    dpi:=screen.PixelsPerInch;
    if 0=qp.SetPageDimensions(11*dpi,8.5*dpi) then
      showMessage('result: '+intToStr(i));
    if 0=qp.SetTextColor(1,1,1) then
      showMessage('result: '+intToStr(i));
    if 0=qp.SetFillColor(0.2,0.4,0.1) then
      showMessage('result: '+intToStr(i));
    if 0=qp.DrawBox(1*dpi,1*dpi,4*dpi,1*dpi,2) then
      showMessage('result: '+intToStr(i));
    if 0=qp.DrawTextBox(1*dpi,1*dpi,4*dpi,1*dpi,'This is a Test',0) then
      showMessage('result: '+intToStr(i));
    if 0=qp.RenderPageToDC(dpi,currPage,image1.Canvas.Handle) then
      showMessage('result: '+intToStr(i));
  except on e:exception do
    showMessage(e.Message);
  end;
  freeAndNil(qp);
end;
 
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3530
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 07 Jul 09 at 4:07PM
Perhaps you should check if the value in dpi is the correct one?
Back to Top
ukobsa View Drop Down
Senior Member
Senior Member


Joined: 29 May 06
Location: Germany
Status: Offline
Points: 115
Post Options Post Options   Thanks (0) Thanks(0)   Quote ukobsa Quote  Post ReplyReply Direct Link To This Post Posted: 08 Jul 09 at 8:30AM

What is the first message that you get? Note that getting back zero indicates an error while not zero indicates success!

What is the value of curPage? And how is TMyQuickPDF defined? Is there any additional code in it. And what happens when after setting the page dimensions you try to read them again? Are the values right?

best regards,

Ulrich

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store