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 - Pad Text To A Specific Length
  FAQ FAQ  Forum Search   Register Register  Login Login

Pad Text To A Specific Length

 Post Reply Post Reply
Author
Message
MrPopup View Drop Down
Team Player
Team Player
Avatar

Joined: 19 Dec 05
Location: New Zealand
Status: Offline
Points: 32
Post Options Post Options   Thanks (0) Thanks(0)   Quote MrPopup Quote  Post ReplyReply Direct Link To This Post Topic: Pad Text To A Specific Length
    Posted: 20 Aug 12 at 1:52AM
Using QuickPDF 8.16 ActiveX.
I am generating a document with an index page and have the index entry text on the left and the related page number of the right. How can I extend the index text (padded with '.' (periods)) to the page number? Example:
"Monthly Results...................................................................................109"
Thank you for any assistance rendered.Smile
Back to Top
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Posted: 20 Aug 12 at 12:34PM

You should be able to calculate using something based on the code below.  You will need to determine the value of totalColumWidth your self.  It assumes you have the required font currently selected.

  double left = QP.GetTextWidth("Monthly Results");
  double right = QP.GetTextWidth("109");

  double dotWidth = QP.GetTextWidth(".");

  gapToFill = totalColumWidth - left - right;
  dotsRequired = gapToFill / dotWidth;

  text = left + DotString(dotsRequired) + right;

  QP.DrawText(x, y, text);

Back to Top
MrPopup View Drop Down
Team Player
Team Player
Avatar

Joined: 19 Dec 05
Location: New Zealand
Status: Offline
Points: 32
Post Options Post Options   Thanks (0) Thanks(0)   Quote MrPopup Quote  Post ReplyReply Direct Link To This Post Posted: 20 Aug 12 at 8:19PM
Thank you AndrewC. Appreciate the help. Smile
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