Beenden
  • Globale Community
    • Sprache:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티

Import SVG images at actual size

Community Expert ,
Jul 02, 2024 Jul 02, 2024

Hi All, I have a custom structured application in FrameMaker 2020 and the XML references SVG files to import. I have a two-column layout and the images always import and scale to the column width. I want the images to stay at 100% or to the text frame width (not the column width). I can't figure out what attribute values on the image that will give me what I want. Thanks in advance.

843
Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community Expert ,
Jul 02, 2024 Jul 02, 2024

Hi Rick,

I do not know, if this fits to your structured application.

There is an option in the Preferences in the Graphics section:

Auto-Scale Image Along Width (on Insertion)

Possibly this option is activated in your template.

Best regards, Winfried

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community Expert ,
Jul 02, 2024 Jul 02, 2024

In some of the SVGs, what's a typical

‹svg … x="#u" y="#u" … viewBox="# # ### ###" … width="###u" height="###u" …
look like?

Unlike EPS, which could specify absolute dimensional units, SVG dimensions may be completely abstract (no units), or follow HTML/CSS conventions, like 123px, which are likewise meaningless in a dimensioned page layout context.

 

I haven't used SVG in FM enough to even have a guess as to how FM default-sizes various viewBox and/or width:height declarations.

 

All of which is by way of suggesting that with SVG, there may be no "actual size".

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community Expert ,
Jul 02, 2024 Jul 02, 2024

FrameMaker is scaling them to the column width on import and it shows the scaling in the Object Properties dialog; for example, 88.35%. There has to be an attribute that I can use to scale them to the text frame width on import, but I can't figure out what it is.

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community Expert ,
Jul 02, 2024 Jul 02, 2024

RQ: There has to be an attribute that I can use to scale them to the text frame width on import, but I can't figure out what it is.

The investigation might need to start with what FM thinks the size is, which is why I asked about typical ‹svg declarations.

 

I just did a couple of basic tests in FM2020 unstruc, using SVGs from Illustrator (that got generated with dimensionless units for the art, a 4×4in rectangle with 1mm stroke).

FM is ignoring the viewBox,
  ‹svg id="Layer_1" data-name="Layer 1" xmlns="{elided}" version="1.1" viewBox="0 0 576 576"›
Illustrator exported the 1mm stoke as px:
  … stroke-width: 2.8px; …
FM is treating the maximum content extents as points (72dpi).
  ‹rect class="cls-1" x="144" y="144" width="288" height="288"/›
This got imported at 100% as a 4.056×4.056in rectangle (the excess due to the width of the ‘2.8px’ stroke).

 

Doing a hand edit on the SVG and specifying width="4cm" height="4cm" resulted in FM honoring that, and treating it as a 1.639in rectangle.

 

So a huge factor in this import:default process would seem to be what the SVG exporting app is generating. If dimensionless, they are apparently assumed to be 'pt

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community Expert ,
Jul 02, 2024 Jul 02, 2024

If I use a one-column text frame, they scale correctly. I am anchoring the frames in an across-all-columns paragraph and I thought that would trigger the scaling to the text frame instead of the text column.

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community Expert ,
Jul 02, 2024 Jul 02, 2024

Have you mapped the attributes and values to properties via read/write rules?

Ditto with default values to ignore att values if needed.

-Matt Sullivan
FrameMaker Course Creator, Author, Trainer, Consultant
Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community Expert ,
Jul 02, 2024 Jul 02, 2024

Here are the rules I am using:

 

element "image" {;
  is fm graphic element ;

  attribute "src" {
    is fm property file;
  };
};
Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community Expert ,
Jul 02, 2024 Jul 02, 2024

So, you'll want to carry the other image attributes and values into Fm, either passing through as attributes or as fm properties, yes?

-Matt Sullivan
FrameMaker Course Creator, Author, Trainer, Consultant
Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community Expert ,
Jul 02, 2024 Jul 02, 2024

Yes, but there is no scaling or height or width attributes in the original XML. I can add them via XSLT, but I don't know what is required to scale to text frame width versus column width.

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community Expert ,
Jul 02, 2024 Jul 02, 2024
AKTUELL

Got it. 

Still, you should be able to set a read rule that sets an fm property with a default. 

I'm not sure where my R/W Rules reference docs are right now, but lmk if you need help tracking it down.

-Matt Sullivan
FrameMaker Course Creator, Author, Trainer, Consultant
Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines