Getting the width of a string?

A forum for questions or concerns related to the PDF-XChange Core API SDK

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
omascia
User
Posts: 48
Joined: Thu Mar 11, 2010 7:07 pm

Getting the width of a string?

Post by omascia »

More or less along the lines of the old PXC_GetStringWidth() ?
Sasha - Tracker Dev Team
User
Posts: 5522
Joined: Fri Nov 21, 2014 8:27 am
Contact:

Re: Getting the width of a string?

Post by Sasha - Tracker Dev Team »

Hello omascia,

The equivalent is the CalcTextSize method:
https://sdkhelp.pdf-xchange.com/vie ... lcTextSize
Though there is much more versatile method:
https://sdkhelp.pdf-xchange.com/vie ... wTextBlock

Don't forget to initialize the content creator:

Code: Select all

PDFXEdit.IPXC_ContentCreator CC = pdfCtl.Doc.CoreDoc.CreateContentCreator();
CC.SetFontSize(14.0f);
PDFXEdit.IColor color = auxInst.CreateColor(PDFXEdit.ColorType.ColorType_RGB);
color.SetRGB(0.0f, 0.0f, 1.0f);
CC.SetFillColorRGB(color.RGB);
color.SetRGB(1.0f, 0.0f, 0.0f);
CC.SetStrokeColorRGB(color.RGB);
PDFXEdit.IPXC_Font fnt = pdfCtl.Doc.CoreDoc.CreateNewFont2("ArialMT");
CC.SetFont(fnt);
Cheers,
Alex
Subscribe at:
https://www.youtube.com/channel/UC-TwAMNi1haxJ1FX3LvB4CQ
Post Reply