Writing .odt file; image with no declared height

Discussions about using 3rd party extension with OpenOffice.org

Writing .odt file; image with no declared height

Postby alexjordan » Tue Nov 03, 2020 8:57 pm

I'm new to this forum and uncertain if this is the right subforum to post to. Please advise me if I should take this elsewhere.

I am a contributor to a project that converts PreTeXt XML to various output formats. I'm currently working on an XSLT conversion to .odt, and I have hit an obstacle. I'm hoping to find insight here for how to proceed.

The issue is that PreTeXt XML does not declare heights for image files. A width is always declared (or inferred to be 100%) and it is assumed that the image file knows its own aspect ratio, and that the renderer will use the defined width and the image file to infer a height for display. I'm not having success translating to an .odt file that opens and shows images. I'm creating content with constructions like:

Code: Select all   Expand viewCollapse view
  <draw:frame  svg:width="some width"  text:anchor-type="as-char">
    <draw:image  xlink:href="the correct path"  xlink:type="simple"  xlink:show="embed"  xlink:actuate="onLoad"  draw:mime-type="the correct type"/>

and I do have a style applied to the p and to the frame. But in OpenOffice and LibreOffice, the output looks like a value of 0 is being used for svg:height and I see an almost completely flat line where an image should be. MS Word appears to be using a 1 inch default here, so the images are all visible but their aspect ratio is distorted.

Is it possible to build a .odt file with images, not declare an image height, and still expect the word processors to display the images with their native aspect ratio? (If not, the conversion process from PreTeXt to .odt will need to analyze image files, which will be a significant additional stage to conversion.)
OpenOffice 4.1.7 with MacOS 10.14.6
Posts: 1
Joined: Tue Nov 03, 2020 7:52 pm

Re: Writing .odt file; image with no declared height

Postby JeJe » Wed Nov 04, 2020 11:56 pm

You can get/set the dimensions when in the odt file

https://www.openoffice.org/api/docs/com ... ActualSize

In basic for the first drawing in a document you would put this
Code: Select all   Expand viewCollapse view
Openoffice 4.1.6
Windows 8
Posts: 1531
Joined: Wed Mar 09, 2016 2:40 pm

Return to Extensions

Who is online

Users browsing this forum: No registered users and 2 guests