Skip to content
This repository has been archived by the owner on Jun 11, 2022. It is now read-only.

unable to export as PNG or JPEG image #67

Open
saikrishna-chunchu opened this issue Feb 11, 2021 · 3 comments
Open

unable to export as PNG or JPEG image #67

saikrishna-chunchu opened this issue Feb 11, 2021 · 3 comments

Comments

@saikrishna-chunchu
Copy link

saikrishna-chunchu commented Feb 11, 2021

When I try to export the SVG as a PNG or JPEG image, I am seeing the below error. This is happening before I chose the destination file/directory to export the file.

OS: macOS Catalina, version: 10.15.6 (19G2021)

TypeError [ERR_INVALID_ARG_TYPE] [ERR_INVALID_ARG_TYPE]: The "path" argument must be one of type string, Buffer, or URL. Received type object
at Object.openSync (fs.js:439:10)
at Object.func (electron/js2c/asar.js:138:31)
at Object.func [as openSync] (electron/js2c/asar.js:138:31)
at Object.writeFileSync (fs.js:1206:35)
at /Users/schunchu/.atom/packages/svg-preview/lib/svg-preview-view.js:396:12
at HTMLImageElement. (/Users/schunchu/.atom/packages/svg-preview/lib/svg-to-raster.js:23:12)

@sverweij
Copy link
Contributor

  • In more recent versions of atom showSaveDialog has become async, so the call to it in svg-preview-view.js#L392 needs to be awaited now 🤷 .
  • On top of that showSaveDialog's signature changed so now instead the output file path needs to be picked from the filePath attribute.

This means that line 392 with something like this should theoretically fix this issue:

    const dialogOutput = await atom.applicationDelegate.showSaveDialog(`${filePath}.${outputType}`)
    const outputFilePath = dialogOutput.filePath

From my experience with atom adapting the unit test could be a bit of work, but as the exportTo method is already async (for other reasons) it might to prove to be 0 minutes as well.

(don't have the bandwidth to make a PR for this a.t.m. And even if I did - not sure @josa42 would be willing and/ or able to merge it given the project not maintained label in the README)

@saikrishna-chunchu
Copy link
Author

Thanks, @sverweij.
I made those changes in my machine and used it, it worked.
@josa42, let me if you can merge these changes. I can make PR (for the rest of community).

@josa42
Copy link
Owner

josa42 commented Feb 12, 2021

@saikrishna-chunchu If you open a PR I will merge it.

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

No branches or pull requests

3 participants