Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DxfViewer.Load(url) always breaks with an "Unexpected end of input: EOF group not read before end of file" error #13

Closed
eavidal opened this issue Oct 28, 2022 · 2 comments

Comments

@eavidal
Copy link

eavidal commented Oct 28, 2022

I've been testing the viewer with different DXF files, and it always breaks with the same error in the DxfViewer.Load(url) step:

Uncaught (in promise) Error: Unexpected end of input: EOF group not read before end of file. Ended on code
at DxfArrayScanner.next (bundle.js:95279:19)
at parseAll (bundle.js:97136:32)
at DxfParser._parse (bundle.js:97725:5)
at DxfParser.parseSync (bundle.js:97058:21)
at DxfFetcher.Fetch (bundle.js:97786:23)
at async DxfWorker._Load (bundle.js:165347:21)
at async DxfViewer.Load (bundle.js:166831:23)

My code is the following:

import { DxfViewer } from "dxf-viewer";

var dxfCanvas = document.getElementById("dxf-canvas");
dxfCanvas.width = window.innerWidth;
dxfCanvas.height = window.innerHeight;

var dxfViewer = new DxfViewer(dxfCanvas);
dxfViewer.SetSize(dxfCanvas.width, dxfCanvas.height);

async function loadDxfUrl() {
    await dxfViewer.Load(dxfUrl);
}

loadDxfUrl();

dxfUrl is a blob url. I've been trying with different dxf files and all of them return the same error. The DXF files open in other viewers.
The files can be also parsed correctly using DxfFetcher with the following code:

import { DxfFetcher } from "dxf-viewer";

var dxfFetcher = new DxfFetcher(dxfUrl);
dxfFetcher.Fetch()
    .then(res => {
        console.log(res);
    });
@vagran
Copy link
Owner

vagran commented Oct 28, 2022

Hello,
dxfViewer.Load() expects parameters in form of batch object. So proper invokation should be dxfViewer.Load({url: dxfUrl}).

Seems it needs both better disgnostics (to handle missing required parameter) and may be typescript interface definition file (such issue is open and waits for fix).

@eavidal
Copy link
Author

eavidal commented Oct 28, 2022

@vagran thanks for the info. Working good now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants