Skip to main content
Inspiring
November 18, 2009
Question

Picas to Points conversion

  • November 18, 2009
  • 3 replies
  • 812 views

Hi All,

I am working with InDesign CS3.

By default we have  1 picas = 12 points.

I have some value in picas like 2p3 and I want to convert it in points by using InDesign API.

I have tried following.

PMString picasStr("2p3");

InterfacePtr<IMeasurementSystem> ms(gSession, UseDefaultIID());
if( !ms )
break;

InterfacePtr<IUnitOfMeasure> currentVUnit(ms->QueryUnitOfMeasure(ms->Location(kPointsBoss)));
if( !currentVUnit )
break;

currentVUnit->Parse(picasStr, topInPt, kTrue);

But it returns false. Thus fail to convert the value.

If anybody have the solution then please let me know.

Regards,

Alam

This topic has been closed for replies.

3 replies

Inspiring
December 30, 2009

virtual bool16 Parse(const PMString & str,
PMReal & points,
const bool16 alwaysUseEnglishAbbreviations = kFalse
)[pure virtual]

Parse a string like "1 in" into points.

str IN, the string to be parsed


I think the unit abbrivation i.e in for inch is missing in PMString picasStr("2p3");.

Thanks

Inspiring
December 30, 2009

you can try

IUnitOfMeasure::UnitsToPoints

Participating Frequently
November 18, 2009

Hi,

InterfacePtr<IUnitOfMeasure> currentVUnit(ms->QueryUnitOfMeasure(ms->Location(kPicasBoss)));

Gruß,

Sergiy