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

More Templates for HTML, PDF possible? #1

Closed
aviadavi opened this issue Mar 29, 2015 · 8 comments
Closed

More Templates for HTML, PDF possible? #1

aviadavi opened this issue Mar 29, 2015 · 8 comments

Comments

@aviadavi
Copy link

Hi.

Do you have more handlebars templates for bootprint swagger (there is only 1 correct me if i'm wrong) ?

Is generating PDF possible ?

@nknapp
Copy link
Member

nknapp commented Apr 1, 2015

At the moment, there is only this one template for swagger. Although I consider it usable at the moment (we used it to provide documentation to our customers) it can certainly be improved. So if you have any improvements, feel free to create an issue with more detailed ideas or a PR. I'm going to add a section about "contributing" to the documentation soon.

PDF generation is a bit tricky and it is a more general question of converting HTML to PDF. I've tried the following:

  1. PhantomJS with the rasterize script - Works at the first glance, but it does not add PDF bookmarks and the links within the document are not working
  2. WeasyPrint - Looks good and generates PDF-bookmarks. PDF-generation takes a bit longer. Links within the document are not working.
  3. wkhtmltopdf - Takes really long to generate PDF. The resulting file is huge (2,3 MB for the petstore-example). Links and PDF-bookmarks are working fine.
  4. PrinceXML - Runs very quickly, small PDF, links are working, layout looks good. It's a great tool, but I can't justify $3800 just for sending a nice Rest-API-Reference as PDF instead of HTML. I would use it for open source projects though (for which it is free).

Since every option had a large drawback (links not working, file size, price), we just sent a zip-file containing the HTML- and the StyleSheets.
It's not what I had intended to do with Bootprint in the beginning, but at the moment I do not see another option.

So, PDF-generation is possible, but it's not built in (yet).

@nknapp nknapp changed the title More Templates fo HTML More Templates for HTML, PDF possible? Apr 2, 2015
@aviadavi
Copy link
Author

The idea is that the HTML will contain the following:

  1. Default Values
  2. Min/Max Value
  3. Pattern
  4. Examples

@nknapp
Copy link
Member

nknapp commented Apr 28, 2015

Most of these values belong into the bootprint-json-schema module. I would like to encourage you to clone the repository, make your changes and submit a pull request. If you need a starting point. From what I can see, default values, min/max and pattern belong into the json-schema/datatype partial, which already renders the "format" and "enum"-values.

"Examples" in the json-schema parts of the swagger-spec would also go into bootprint-json-schema and there into the partial json-schema/body probably below the description. Pretty printed JSON can be rendered with the {{json value}}-helper.

"Examples" in the swagger-parts of the spec only seem to be possible within response definitions, which would go into the partials of this ("bootprint-swagger") module, namely swagger/responses.

Also, check out the development-setup when changing partials.

I may find some time to add these values myself, but a pull-request would probably be accepted faster than that.

I am currently working on documentation for the template-modules. Or better, I am trying to figure out a good way to write part of the document as inline comments within partials, less-files and js-files.

@JamesPaden
Copy link

@nknapp late to the party, but you might consider https://docraptor.com for HTML to PDF. It uses PrinceXML on the backend, but has a saas-based pricing model.

@nknapp
Copy link
Member

nknapp commented May 26, 2015

@aviadavi can you provide a simple (possibly minimal) example containing the data you'd like to see in the output? That would be a great help.

@nknapp
Copy link
Member

nknapp commented May 26, 2015

@JamesPaden I don't think a SaaS is the right alternative for my purposes, but it might be for others, thanks for the hint.

@nknapp
Copy link
Member

nknapp commented May 26, 2015

I've included "default-values" and examples in the JSON-Schema into the current version.

@nknapp
Copy link
Member

nknapp commented Sep 27, 2015

I've extracted the two remaining TODOs into separate issues. This issue will now be closed

@nknapp nknapp closed this as completed Sep 27, 2015
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

3 participants