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

quill delta format to PDF and HTML #33

Open
ghost opened this issue Sep 6, 2018 · 18 comments
Open

quill delta format to PDF and HTML #33

ghost opened this issue Sep 6, 2018 · 18 comments

Comments

@ghost
Copy link

ghost commented Sep 6, 2018

is there any interest in this ?

This woudl allow a user to print a zefyr document by first converting it to PDF.

This dart package looks like the good:
https://github.com/DavBfr/dart_pdf

  • able to generate a PDF
  • able to print the PDF
  • able to share the generated PDF:

SO all we only need to do write a generic parser in Dart that takes the current zefyr / quill format and convert it to PDF. Because zefyr format is limited ( like markdown in a way) it should not be too hard.

I am not sure if its Notus that is the actual on data structure we work from ?

@ghost
Copy link
Author

ghost commented Sep 6, 2018

i found a nodejs quill-delta to html. It would be a good spec / example to work from.
https://www.npmjs.com/package/quill-delta-to-html

But again i dont know if its Notus that is the source format ?

@ghost ghost changed the title quilljs delta format to PDF and HTML quill delta format to PDF and HTML Sep 6, 2018
@leedstyh
Copy link

leedstyh commented Sep 7, 2018

Converting to PDF would be very helpful!

@ghost
Copy link
Author

ghost commented Sep 10, 2018

hey @pulyaevskiy what do you think of the idea ?

If you have other plans in this area, i am happy to adapt.

@stemuk
Copy link

stemuk commented Sep 13, 2018

@gedw99 It would be really helpful to have such functionality for delta documents in flutter!

And while I believe that this functionality would be best implemented outside of the zefyr editor in a separate package, I would love to help with building such functionality or help with testing if you already have something in the making.

https://flutter.io/developing-packages/
This article would then go into detail on how to publish a package on pub.dartlang.org once it is ready.

@pulyaevskiy
Copy link
Contributor

Sorry for late response here. I definitely think this is a valuable thing to do.

There is one thing I’m mostly concerned about which is bringing in too many dependencies into Zefyr or Notus. I’d like these packages to be lightweight and not force users downloads the rest of Pub with them.

I currently have basic markdown converter in notus, but I’m starting to consider stripping out into a separate notus_convert package. This package would also be a good place for HTML and PDF converters.

I can go ahead and set it up if this would help you guys to contribute.

Let me know your thoughts.

@ghost
Copy link
Author

ghost commented Sep 21, 2018

hey @pulyaevskiy thats the exact approach i would do also - converters.

SO to Print a Zefyr doc, your thinking zefyr --> Notus ( file ) --> Markdown --> PDF ?
https://github.com/memspace/zefyr/blob/master/packages/notus/lib/src/convert/markdown.dart

I would also like: zefyr --> Notus ( file ) --> PDF
Here is why..
Converting to Markdown is damn useful because you can then do anything with it. Save it into github, put on a webpage, etc etc
Converting from Notus --> PDF will ensure you have a pixel perfect match always.
Markdown is the lowest common denominator, but Notus to PDF will always be pure exact copy visually.

Also there is another reason too. Zefyr proves whats possible with Flutter in terms of highly interactive software. I think that Spreadsheets, Powerpoints and SVG Editors will be built with Flutter ongoing.
Especially since it runs on Desktop quite well now. All with collaboration possibilities thanks to quill.
For instance, so say i wanted to build an SVG Editor !
I would be taking your zefyr code and maybe using 40% of it to make a SVG Editor app.
Then build a Notus equivalent on top of quill package. Call it SVGNotus format.
Then for PDF export, i would look at the Notus --> PDF package and take x% of it too.
Basically its a 3 layer stack archi of:
a. Presentation
b. File Format / Serialisation
c. Export to PDF

You should keep Zefyr & Notus and the exporter light and focussed. i agree.
But i can see also a leaning towards one day abstracting some of Zefyr & Notus out to a core package maybe. I expect this will happen sometime down the road.

@ghost
Copy link
Author

ghost commented Sep 21, 2018

About Notus to PDF...
We will need to re-layout the zefyr document at some point because you need to calculate exact x and y positions for the PDF page size.
But Notus does not hold the x and y placement data. It only holds the structural relationship ?

SO to go from notus to pdf, how to calc the x and y ?
Seems maybe we have to use some of zefyr ?

See example: https://github.com/DavBfr/dart_pdf/tree/master/pdf

@stemuk
Copy link

stemuk commented Oct 29, 2018

@gedw99 Any progress on this feature so far? I would love to help with testing/prototyping since I believe most zefyr users would benefit in one way or another from having an export feature. After separating the notus_convert package as @pulyaevskiy mentioned the remaining work should be much easier since Markdown to PDF renders are already existing and a simple port to dart should do the trick.

@stemuk
Copy link

stemuk commented Nov 12, 2018

@pulyaevskiy I was lately looking into exporting a Zefyr document into Markdown using the Notus converter you mentioned above, but I had trouble finding it. Could you maybe quickly outline how to access the Markdown generated by the Notus markdown converter?

@ghost
Copy link
Author

ghost commented Nov 12, 2018

hey @stemuk Nothng on my side. Too many things going on. GO for it and please comment back here how you go.

Has the notus_convert package been seperated out yet though ?

@stemuk
Copy link

stemuk commented Nov 12, 2018

@gedw99 I will let you know if I make any progress on this side, for now I am focusing on exporting to Markdown though. As for the separation I think the notus_convert package has not yet been separated but I believe the basic markdown functionality should already be usable.

@Panthro
Copy link

Panthro commented Jan 7, 2019

My users are asking for this one, I successfully released a version of my app with "note taking" feature, but now people are asking for a way to "export" the notes with formatting :-)

@pulyaevskiy
Copy link
Contributor

Thanks for the feedback @Panthro!

I’m planning to have more updates in January. This is not very high on the list yet but I’ll keep everyone posted when I get to this.

@tth05
Copy link

tth05 commented Jan 11, 2019

Nice, I'd love to see this actually happening

@lukepighetti
Copy link

lukepighetti commented Mar 5, 2019

@pulyaevskiy May I recommend exporting an interface for conversion, something like, ZefyrOutputDelegate (just made up the name), which can be implemented by any package. For example, it could result in zefyr_markdown, zefyr_pdf, zefyr_html, zefyr_hewn_stone_tablet, zefyr_smoke_signals, whatever.

Or perhaps notus_html etc.

And you would provide the converter/serializer when you create a new Zefyr widget.

@Panthro
Copy link

Panthro commented Apr 6, 2019

hey @pulyaevskiy any update on this? :-)

Has anyone found a way to export the document to pdf or html?

thanks

@ghost
Copy link
Author

ghost commented May 2, 2019

@Panthro
There is a PR that does conversion to HTML

SO from HTML, its easy to convert to PDF using the PDF Dart lib. There are a few out there.
I am bogged down with other stuff right now. If i had time it woudl be something i would do.
I dont think its that complex.

@dedikusnadi207
Copy link

@pulyaevskiy
Has anyone found a way to export the document to pdf?
And save as template file?

Thanks

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

7 participants