SetPageDimensions
Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=642
Printed Date: 05 Jul 25 at 10:55PM Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com
Topic: SetPageDimensions
Posted By: Ingo
Subject: SetPageDimensions
Date Posted: 15 Feb 07 at 5:07PM
Hi!
I've trouble with the function SetPageDimensions. I want to convert an image to pdf. The imagesize should be the same in pdf. So i take imagewidth and height and convert it to double fields 'cause this is necessary for SetPageDimensions. I want a border (bddou), too. QP.SetPageDimensions(mmwd + bddou,mmhd + bddou); In mmwd is 2500, in bddou is 50, in mmhd is 1500. When i'm calling PageWidth now i get only 612 - i've thought i get 2500 ;-) What's wrong? What have i forget?
Best regards, Ingo
--- here's the code ---
var border : LongInt; pleft, ptop, mmwd, mmhd, iwd, ihd, bddou : Double; mmw, mmh, iw, ih, bdstr : String;
iw := IntToStr(QP.ImageWidth); // is 2500 ih := IntToStr(QP.ImageHeight); // is 1500 iwd := StrToFloat(iw); ihd := StrToFloat(ih);
bdstr := IntToStr(border); // border is 50 bddou := StrToFloat(bdstr);
QP.SetPageDimensions(mmwd + bddou,mmhd + bddou); // pagewidth shall be 2500 now
ShowMessage(FloatToStr(QP.PageWidth)); // <--- here is 612 now!
|
Replies:
Posted By: ukobsa
Date Posted: 16 Feb 07 at 3:16AM
Ingo,
I tested it on my system (5.21) and here it works fine. But some questions on your code:
1) Why that complicated (and unnecessary) Int -> Float conversion? 2) you are using MMHD and MMWS but never set it before. Shouldn't this be IWD and IHD?
try this to test:
QP := TiSEDQuickPDF.Create; try QP.UnlockKey(YOUR_KEY); QP.LoadFromFile('test.pdf');
lImage := QP.AddImageFromFile('rendered.bmp', 0); QP.SelectImage(lImage); border := 50; QP.SetPageDimensions(QP.ImageWidth + border, QP.ImageHeight + border);
ShowMessage(FloatToStr(QP.PageWidth));
QP.SaveToFile('test2.pdf'); finally QP.Free; end;
|
HTH, Ulrich
|
Posted By: Ingo
Date Posted: 16 Feb 07 at 4:12AM
Hi Uli!
What you're writing was my first try ... and it doesn't work. ImageWidth is integer and the attributes of SetPageDimensions are double so i've thought change integer to double and then it will work. But ... ;-) Thanks a lot ... I'll try again.
Best regards, Ingo
|
Posted By: Ingo
Date Posted: 18 Feb 07 at 5:40PM
Hi Uli!
I've solved it ... I want to convert very large images to pdf. When i'm doing SetPageDimension and immediately a DrawImage behind i never got the correct aspect ratio. Now i save the new file first with the new dimensions... then load it again doing DrawImage and it works with the correct aspect ratio.
Best regards, Ingo
|
|