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!
![]() |
Newbe Question |
Post Reply
|
| Author | |
RhoTu
Beginner
Joined: 29 Jun 09 Location: Minnesota Status: Offline Points: 12 |
Post Options
Thanks(0)
Quote Reply
Topic: Newbe QuestionPosted: 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
|
|
![]() |
|
Ingo
Moderator Group
Joined: 29 Oct 05 Status: Offline Points: 3530 |
Post Options
Thanks(0)
Quote Reply
Posted: 06 Jul 09 at 10:08PM |
|
Hi What's in dpi?
|
|
![]() |
|
RhoTu
Beginner
Joined: 29 Jun 09 Location: Minnesota Status: Offline Points: 12 |
Post Options
Thanks(0)
Quote Reply
Posted: 06 Jul 09 at 10:11PM |
|
Screen.PixelsPerInch=96
|
|
![]() |
|
Ingo
Moderator Group
Joined: 29 Oct 05 Status: Offline Points: 3530 |
Post Options
Thanks(0)
Quote Reply
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 |
|
![]() |
|
DELBEKE
Debenu Quick PDF Library Expert
Joined: 31 Oct 05 Location: France Status: Offline Points: 151 |
Post Options
Thanks(0)
Quote Reply
Posted: 07 Jul 09 at 7:26AM |
|
You should also set the orgin with
Qp.SetOrigin(1); //Origin at top/left
|
|
![]() |
|
RhoTu
Beginner
Joined: 29 Jun 09 Location: Minnesota Status: Offline Points: 12 |
Post Options
Thanks(0)
Quote Reply
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; |
|
![]() |
|
Ingo
Moderator Group
Joined: 29 Oct 05 Status: Offline Points: 3530 |
Post Options
Thanks(0)
Quote Reply
Posted: 07 Jul 09 at 4:07PM |
|
Perhaps you should check if the value in dpi is the correct one?
|
|
![]() |
|
ukobsa
Senior Member
Joined: 29 May 06 Location: Germany Status: Offline Points: 115 |
Post Options
Thanks(0)
Quote Reply
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 |
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store