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

Exporting as PDF #66

Open
claireboyd opened this issue Mar 27, 2023 · 6 comments
Open

Exporting as PDF #66

claireboyd opened this issue Mar 27, 2023 · 6 comments
Labels
enhancement New feature or request

Comments

@claireboyd
Copy link

Is there a way to export SQL notebooks as PDFs easily? Thanks!

@cmoog
Copy link
Owner

cmoog commented Mar 28, 2023

Not at the moment. I think I've seen this feature request from others, so I'll prioritize it for future work.

@cmoog
Copy link
Owner

cmoog commented Mar 28, 2023

@claireboyd UChicago!

@claireboyd
Copy link
Author

Small world! I could be interested in collaborating to add it if that would help - I'm not sure how big a lift it might be, but would be happy to learn.

@claireboyd
Copy link
Author

also my friend/fellow CAPP student @divij-sinha would be down to collab to make this work as well!

@cmoog
Copy link
Owner

cmoog commented Mar 29, 2023

@claireboyd @divij-sinha Great! I'd be happy to accept this as a contribution. Here are some high level steps on how I think this should be accomplished

  • add a new command in the extension manifest, something like Export as PDF, docs on that here
  • when the command is invoked, generate some HTML from the notebook state (should include cells and cell "outputs"). Right now, the tabular output is formatted as markdown– this will need to be converted into HTML. The same goes for any "markdown cells". The SQL query cells should be placed in <pre></pre> tags. (maybe a future enhancement could give these blocks syntax highlighting in the final output). Finally, some simple embedded CSS to give reasonably attractive tables that format well in the final PDF output.
  • convert this HTML into a PDF (pretty sure there are libraries for this) and... (write to the current directory?, maybe prompt for a filename then write?)

If you make some progress and want to open a draft PR I'll be happy to give feedback along the way or iron out any issues you're having. In general, the VS Code extension API can be a bit tricky to work with but the docs are great.

@cmoog cmoog added the enhancement New feature or request label Mar 29, 2023
@bmrussell
Copy link

Just chipping in with a suggestion :

Exporting the whole lot to markdown might be easier & more flexible as conversion to pdf, html could be done from the complete markdown.

Even a select all, copy-as-markdown would be cool

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

No branches or pull requests

3 participants