Inserting vectors into LibreOffice

Hi all,

I just figured out how to insert SVG (vector) files as "OLE"s into LOW (LibreOffice Writer, version 6.4.4.2 [x64] installed on Windows 7 Professional).

But then it keeps creating all this white space to the right and below the actual SVG file (and yet somehow appearing inside of the corner squares).

How do I either tell it “no” or crop off that white space?

Thank you!

Surely there’s a way I can have a file remain vector in Writer without it being rasterized (i.e. converted to BMP/PNG), given that clip art, fonts, drawn-on shapes and so forth stay vector…

Please edit your question (instead of adding comments) to better describe the phenomenon and what you’d like to get. Don’t forget to mention OS name and LO version even if this seems irrelevant to you.

Very schematically, any “foreign insertion” ends up in a frame, a container which can be given attributes to interact with surrounding text. Select first the frame (usually close to the border of the object), otherwise you’ll interact with the object itself, right-click and Properties. Experiment with the various parameters or be descriptive.

1 Like

Update: I added the version of everything to the question.

Some SVG files have an area already defined. This may not be the best way to understand it so if you create a drawing in Draw you can export it to SVG as the entire page or as selection only. The first obviously takes an entire page while the second option only takes the space of the selection.

I don’t think there is an easy way to remove that white space in LibreOffice.

I usually call upon Inkscape to do the job.

  • Open the SVG in Inkscape
  • Choose File > Document Properties Shift + Ctrl + D
  • On the Page Tab open the Resize page to content and choose Resize page to drawing or selection
  • Save
1 Like

Thank you, and I know what you mean. And you would think that would fix it, wouldn’t you? Spookily though no LibreOffice Writer simply seems to add these blank spaces without any reason that I can discern. I’m 99% sure it hates me.

In that case you need to look at anchoring and wrap options.

Try anchor to paragraph and optimal wrap

1 Like

Yes, it’s those things (assuming you mean zero wrap).

The corner squares are outside the aforementioned white space.

(Little did you suspect when you got up this morning that you would be part of a real-life in a horror movie I’m betting!)

Can you make a small one page sample and upload it (middle icon with up pointing arrow)?

1 Like

Here it is:

TroubleshootingSample.odt (44.7 KB)

OK. The svg includes the artboard/page too.
I was wrong; you can get rid of space without leaving LibreOffice but it is more delicate task and not as close as using Inkscape:

  1. Right-click the object and select Edit. It will open a Draw window in the page

  2. Drag the edges of the Draw window as close as possible to the shape but without making the shape shrink. Keep the shape centered in the window using the window scroll bars

  3. click outside the Draw window

A more precise way would be to:

  1. Right-click the object and select Edit. It will open a Draw window in the page
  2. Copy the shape and paste it into a new Draw document.
  3. Keep the shape selected and click File > Export. Tick the box Selection only select File Type as .svg and save it to file.
  4. Insert the new svg into your Writer file and delete the original

TroubleshootingSample80039_EA.odt (61.9 KB)

I was using Version: 7.2.6.2 (x64) / LibreOffice Community
Build ID: b0ec3a565991f7569a5a7f5d24fed7f52653d754
CPU threads: 8; OS: Windows 10.0 Build 22000; UI render: default; VCL: win
Locale: en-NZ (en_NZ); UI: en-GB
Calc: CL

1 Like

I know how mentally ill this makes me sound. I warned you this was spooky. But I can’t tell you enough times that there was no extra space on the artboard or page. I used Inkscape to create the vector, and I have to say that Inscape is definitely not the problem here.

If you click on the image it definitely has the extra space around it.

Maybe you pasted it into Writer instead of Insert > Image from file?

When you save as SVG from Inkscape it includes the page, see my first comment to reduce page size to object.

1 Like

Okay, I can see I’m going to have to prove what I’m saying to you. Here is a PDF of the SVG file I used to create the file you’re looking at.

Also yes I went “Insert → Object → OLE Object… → Create from file → Search → OK”.

Unsettled yet?

OliveGarland.pdf (5.7 KB)

OK. I see where the problem arises. You inserted the svg as an OLE object rather than as an image. It doesn’t appear to be linked so is there a reason for that?

If not the Insert > Image and select file. Or just drag from Windows Explorer onto the page.

You could consider posting the result from insert as OLE as a bug, How to Report Bugs in LibreOffice - The Document Foundation Wiki

1 Like

Well for some reason I had been inserting the PDF files rather than the SVG files because well I just never thought that would work. As a result PDF files were always rasterized and pixelated. (I would make the file really big which helped.) Well just now I inserted the SVG file as an image, and that seems to be the way to do this.

I cannot thank you enough for your patience!

MS Office 2019 doesn’t support svg (does 365?) so I see where the assumption comes from. If you save the odt as .docx the svg will be converted, presumably to png.

You could also open OliveGarland.pdf in Draw, select all and paste into Writer. If you then right click on it you have the option to Ungroup so still vector. Cheers, Al

1 Like

Well I never imagined needing so much nor having someone help me through all of it.

That’s all going into my “book making cheat sheet”!

Now with MS Word, just because it sounds like you might just happen to know, is that where you can insert PDFs as images and they aren’t pixelated/rasterized?

I owe you one!

I don’t know about knowing, the PC with Office 2019 is not my computer. I was wrong again, Word 2019 can insert svg.

Re PDF if I drag and drop your pdf I just get an icon on the page.

If I open a PDF with Word 2019 it offers to convert to Word document. If I open your PDF it opens with a page size of the svg and the elements are ungrouped. Note that it will use Windows 10/11 built in OCR and possibly some smarts of its own to extract text and layout from scans