SVG Importing Error

I keep trying to drag and drop SVG Files into my Window, and I keep getting an 'Error Parsing SVG File' error message, with the details:

org.apache.batik.bridge.BridgeException: null:-1
The URI "(Removed extremely long URI due to size, I can paste it back in if it's needed)"
on element can't be opened because:
URL data in unsupported format or corrupt
at org.apache.batik.bridge.UserAgentAdapter.getBrokenLinkDocument(UserAgentAdapter.java:448)
at org.apache.batik.bridge.SVGImageElementBridge.createRasterImageNode(SVGImageElementBridge.java:642)
at org.apache.batik.bridge.SVGImageElementBridge.createImageGraphicsNode(SVGImageElementBridge.java:339)
at org.apache.batik.bridge.SVGImageElementBridge.buildImageGraphicsNode(SVGImageElementBridge.java:179)
at org.apache.batik.bridge.SVGImageElementBridge.createGraphicsNode(SVGImageElementBridge.java:121)
at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:213)
at org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:171)
at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:219)
at org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:171)
at org.apache.batik.bridge.GVTBuilder.build(GVTBuilder.java:82)
at com.inductiveautomation.factorypmi.designer.workspace.DropHandler$SvgImporter.parseSvg(DropHandler.java:321)
at com.inductiveautomation.factorypmi.designer.workspace.DropHandler$SvgImporter.run(DropHandler.java:336)
at java.desktop/java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)

Ignition v8.1.27 (b2023042509)
Java: Azul Systems, Inc. 11.0.18

I tried following 2 other threads I found about SVG Import errors (below), using Inkscape, simplifying the path, and saving as plain SVG... already tried that. I also went and downloaded the latest java package as recommended from the other thread.

Any help would be appreciated!

That's a code path that doesn't bode well for your SVG(s).

Background: SVG (Scalable Vector Graphics) have the capability to embed arbitrary raster images inside of them. Raster images do none of the things that make SVGs powerful - because they're just regular old images. So whatever your source of these SVGs is, they're (unfortunately) probably not going to be very good at doing the SVG things you want them do anyways. It might be easier to export into a raster format and just drop those raster images into image management. Or see if you can export into a more useful SVG form from whatever the source tool is.

Are you able to share the SVG/SVGs that are causing the issue?

Thank you for your input! I have an SVG Test file I was using that I made random blocks in, and I happened to throw an exported image in it (Test)... With what you said in mind, I deleted that image block, and sure enough it worked (Test3) right away.

For my project I don't know if I'll need to include image files as part of the SVG, it was more of a happenstance thing. If I do need something similar in the future, would you recommend making them as raster images, or something else? The goal is to turn on layers progressively to show assembly progress as part of a work instruction.

SVGTest
SVGTest3

Reference a separate image by URL. If you need to host lots of images, or dynamically update them, you might like my Blob Server module.

Hi Phil, thank you for the suggestion of a new resource. I read through your post and it seems like a good tool. We'll see if I have use for it, as I'm only testing and don't know if I'll need that application. I'll definitely keep it in mind!

Regarding using raster images inside of SVGs, I would strongly refrain, since you then defeat the S (Scalable) and the V (Vector) in SVG and you're simply left with the G :confused: . I would only ever use vector shapes within an SVG

3 Likes

That makes sense. The main reason I'm looking at SVGs is because you can have layers in them to turn on / off, highlight, etc. One of the ideas I'm looking at is exporting Creo CAD files into SVG or another format that has that capability. As mentioned in an earlier post, I want to use the turning on and off layers as part of work instructions to show the assembly progressing. If using regular images as an SVG isn't an option / ideal, is there another file type that you'd recommend that accomplishes the same goal?

this works for me, just gotta import the images seperatly
or am i missing something?
image

OP is in Vision, not Perspective, I'm pretty confident.

Correct. I'm going through Inductive University, and was just finishing up the Vision section. I'm just about to start the Perspective section.