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 - SetPageDimensions
  FAQ FAQ  Forum Search   Register Register  Login Login

SetPageDimensions

 Post Reply Post Reply
Author
Message
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Topic: SetPageDimensions
    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!




Edited by Ingo - 15 Feb 07 at 5:24PM
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: 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
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post 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
 
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