Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > The JavaScript Library

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old November 19th, 2020, 02:00 PM
Joshua_F Joshua_F is offline
Forum n00b
 
Join Date: Oct 2017
Posts: 1
Default Issue with textHeight property of the TextMeasure Object.

We have been using the method below for years to determine whether a piece is landscape or portrait for some handouts. Testing out FP11 and so far this is the only thing that I've noticed that is causing issues with our code.
Code:
var item = CreateResource(path("_graphics") + itemNumberFD,'graphic',true);

// Determine if the item graphic is landscape or portrait
formatFD = GetOrientation(item,localOrientation);

function GetOrientation(res, fallback){
  // Text Measure doesn't run in validation so set a fall back
  // orientation to return in local dev. If the param is null
  // return 'portrait' orientation
  var fallback = fallback || "portrait";
     try{
       if (!res instanceof FusionProResource)
         throw "Not a resource: " + res;

       if (!res.exists)
         throw "Resource not found: " + res;

       var TM = new FusionProTextMeasure;
       TM.useTags = true;

      var err=TM.CalculateTextExtent(res.content);
      if (err)
        throw "Error measuring resource: " + res + ": " + TM.messages;

      Print(res + ": Width=" + TM.textWidth + ", Depth=" + TM.textHeight);
      var isLandscape = (TM.textWidth > TM.textHeight);
      return (isLandscape) ? "landscape" : "portrait";
    }
    catch(e){
      return fallback;
    }
 }
In the logs on composition, we're getting
Code:
The amount of text inserted into a flow exceeds the depth of all frames in the flow <>. Text is truncated. Text does not fit in the last frame on page 0 at (0 in, 0 in). Resource("../_graphics/BFH-059.pdf"): Width=81000, Depth=0
Running FusionPro VDP Server 11.2.1 on a Mac OS 10.13.6 High Sierra.
I've tried passing strings through that FusionProTextMeasure constructor and still get a textHeight property of 0.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 02:09 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.