Skip to main content
Community Expert
May 6, 2024
Answered

Fit to frame

  • May 6, 2024
  • 5 replies
  • 614 views

I am typesetting a large  book with a lot  of full page images. I use a special blank master page for this with a single un-anchored frame on each. But when I import my graphics into the frame, the "the fit to frame" feature does not seem to be working. It works in anchored frames, though. Is there some sort of logic to this?

    This topic has been closed for replies.
    Correct answer FrameMaker-dk

    Thanks for all the good answers! I ended up merely creating a master page with no texflow and inserted that all the relevant places. Worked fine, but odd, though that the fit to frame feature only works on anchored frames.

    5 replies

    FrameMaker-dkCommunity ExpertAuthorCorrect answer
    Community Expert
    May 7, 2024

    Thanks for all the good answers! I ended up merely creating a master page with no texflow and inserted that all the relevant places. Worked fine, but odd, though that the fit to frame feature only works on anchored frames.

    Bjørn Smalbro - FrameMaker.dk
    Bob_Niland
    Community Expert
    Community Expert
    May 7, 2024

    How are you getting a no-flow page mapped in?

    Bob_Niland
    Community Expert
    Community Expert
    May 6, 2024

    If I had a similar requirement, with less than a couple of dozen such pages, I'd be tempted to implement them as separate Master Pages. Each MP would contain a specific full-page image (background or foreground, depending on Body page content requirements). Each Body page would need to have a unique ¶format, and all of this tied together via MasterPageMaps.

    However, workflow target plays into the selection of implementation, as the images may not flow to all output types.

    frameexpert
    Community Expert
    Community Expert
    May 6, 2024

    This will scale the selected graphic inside of its anchored frame:

     

    #target framemaker
    
    main ();
    
    function main () {
    
        var doc;
        
        doc = app.ActiveDoc;
        if (doc.ObjectValid () === 1) {
            processDoc (doc);
        }
    }
    
    function processDoc (doc) {
    
        var graphic, frame;
        
        graphic = doc.FirstSelectedGraphicInDoc;
        if (graphic.ObjectValid () === 1) {
            frame = graphic.FrameParent;
            if (frame.constructor.name === "UnanchoredFrame") {
                scaleGraphicToFrame (graphic, frame);
                centerGraphicInFrame (graphic, frame);
            }
        }
    }
    
    function scaleGraphicToFrame (graphic, frame) {
        
        var xScale, yScale;
        
        // Get the two scale factors;
        xScale = frame.Width / graphic.Width;
        yScale = frame.Height / graphic.Height;
        
        if (xScale > yScale) {
            graphic.Width = graphic.Width * yScale;
            graphic.Height = graphic.Height * yScale;
        }
        else {
            graphic.Width = graphic.Width * xScale;
            graphic.Height = graphic.Height * xScale;
        }
    }
    
    function centerGraphicInFrame (graphic, frame) {
        
        graphic.LocX = (frame.Width - graphic.Width) / 2;
        graphic.LocY = (frame.Height - graphic.Height) / 2;
    }
    Barb Binder
    Community Expert
    Community Expert
    May 6, 2024

    Hi Bjørn!

     

    Does full page mean margin to margin, or a full page bleed, covering the margins?

     

    If you mean margin to margin, couldn't you use anchored frames? We could figure out how to handle the anchor so that it doesn't disrupt the layout and you could use an object style to control all of the anchored frames.

     

    ~Barb

    ~Barb at Rocky Mountain Training
    Community Expert
    May 6, 2024

    Hi Bjørn,

    Yes, it seems that this works only with anchored frames.

    In the online help this feature is desscribed:

    Home > Graphics and objects > Anchored frames > Fill and edit anchored frames > Auto-Scale an image in a graphic frame

    "This feature scales the image proportionally to fit into its parent anchored frame while maintaining the best possible DPI."

    Best regards, Winfried