vagran / dxf-viewer

DXF 2D viewer written in JavaScript
Mozilla Public License 2.0
290 stars 86 forks source link

Possible to display DXF from string var, not by fetching URL ? #97

Closed loicroybon closed 5 months ago

loicroybon commented 6 months ago

Hello, I build DXF file content with this lib : @tarikjabiri/dxf So I get string variables containing DXF content. I would like to use vagran/dxf-viewer to display the generated DXF based on this content.

I use Vue3

Possible ?

vagran commented 6 months ago

I do not see any reason why it can be impossible. See current reference example, use Blob with string content to create object URL.

loicroybon commented 6 months ago

I'm sorry but could you provide a short code sample please ? I think I already tried your idea without success

vagran commented 6 months ago
const s = loadDxfAsString()
const b = new Blob([s], {type: "image/x-dxf"})
const url = URL.createObjectURL(b)