notepad-plus-plus / npp-usermanual

Notepad++ User Manual
https://npp-user-manual.org/
Other
215 stars 98 forks source link

Please create Npp user manual as pdf file #163

Closed skarsgal closed 3 years ago

skarsgal commented 3 years ago

Hi, I would like a copy of the online user manual in pdf, without having to download the entire site. Thank you.

pryrt commented 3 years ago

There is a tool at http://wkhtmltopdf.org/ which supposedly can generate the PDF from a website; I haven't tried it yet, but the docs make it look like it should work pretty easily. You could give that a try, while waiting for an official version.

@donho , would it be possible to use that tool in our usermanual release flow, using the GitHub actions, to automatically create a PDF every time you create a tag, and add it to that tag's asset files? If that could be made to work, then after a bit of development, we could easily point users to download the asset-file PDF if they want an offline version.

donho commented 3 years ago

@pryrt Ideally, it'll be cool to have this:

image

So go ahead. If you need help, please let me know.

pryrt commented 3 years ago

@donho ,

Understood. I'll work on it

chcg commented 3 years ago

@pryrt I you need some help on github actions let me know.

pryrt commented 3 years ago

@chcg, thanks for the offer. I'll probably ask a bunch of questions once I get that far.

However, first I have to figure out how to make hugo and wkhtmltopdf to work together nicely. After quick experimentation and lots of web searches, it looks like I might need a separate hugo theme, with a layout that combines all the content into a single page; after I get all that working together, then I'll look into automating the process into the github actions. But since I'm not a hugo (or wkhtmltopdf) expert, this could take a while before I get even that far.

If someone else is a better hugo+github expert, they would likely be able to do it faster thank I could -- if so, feel free to volunteer. Otherwise, I'll take it on as a long-term project.

donho commented 3 years ago

@pryrt Could you provide me the command to generated a pdf from https://npp-user-manual.org/ ?

pryrt commented 3 years ago

@donho,

I would love to. I thought there would be a variant of wkhtmltopdf https://npp-user-manual.org usermanual.pdf -- but that only extracts the first page. As far as I can tell, wkhtmltopdf appears to only handle a single URL or local file to PDF, and doesn't recursively navigate the whole website to generate a single PDF.

I thought about manually generating a bunch of PDFs, then using a PDF merging tool to put them all in one... but the results of the wkhtmltopdf on the theme used on the website are less than ideal even for a single page: the multi-column approach ends up writing text overtop of other text in the PDF, and all the links in the PDF link to the original website, not within the PDF itself.

From everything I read last night while researching, the best bet is to create a single-page HTML from Hugo (using a different theme and/or layout), and then use wkhtmltopdf to convert that single-page HTML to PDF. So after a single-page theme is developed, the process would be to generate the single-page HTML from that theme ( using a command like hugo --minify --theme WhateverWeNameTheSinglePageTheme, which would output into a public/index.html) , then use wkhtmltopdf to turn it into a PDF (wkhtmltopdf public/index.html npp-user-manaul.pdf); when we're ready for full automation, then the github action would need to take that PDF and add it as an asset to the tag being released. (this thread is what I'm using as my main idea)

donho commented 3 years ago

@pryrt Then wkhtmltopdf may not be the tool for us. BTW, I'm asking myself now why user need PDF format - user DO need a off-line document. So a zip of off-line html format will be even better - what do you think?

pryrt commented 3 years ago

@donho, that sounds like a good idea: it gives the offline experience, without the difficulty of creating PDF.

I know that the hugo command without the server subcommand will generate the HTML instead of making a local server, so that could be zipped up. But in my experiments last night with the hugo-outputted HTML, it makes the CSS references all URLs relative to the root of the domain, so it gives CSS links like /somefilename.css -- which means that if you load up the local index.html, it cannot find the CSS at the root directory of the filesystem, so it doesn't apply the CSS formatting. I know there must be a hugo option (either from the command line or from inside the docs) to make sure that all links (both a-href and CSS links) are relative to the file location... but I don't know what it is.

donho commented 3 years ago

I used httrack for old Notepad++ user manual: https://www.httrack.com/

The result is not so bad: nppUserManual.zip

chcg commented 3 years ago

From a internet search this might be helpful (not tested so): For a offline version of hugo, see https://github.com/gohugoio/hugo/issues/622. And to create a pdf https://discourse.gohugo.io/t/generate-hugo-website-as-a-pdf/22855/3.

pryrt commented 3 years ago

@chcg, interesting idea; the problem with the gohugoio/hugo#622 is that it required hacking a bunch of configuration settings that don't appear to be command-line options in hugo, and it doesn't always work (not everything is relative to the index.html like it needs to be). And the PDF link you provided was the same one I mentioned above, which requires a new layout (and maybe a whole new theme) to get the document all into one page.

I like @donho's suggestion of httrack and zipping up the resulting html, since its results seem to look reasonably good. I just checked and there is a chocolatey install for that app, so it should work in GitHub action flow that the this weekend I'll explore how to get it all to work together.

@donho, when you generated the example zip from httrack, did you have to use any special arguments? or was it as simple as changing the example httrack "http://www.all.net/" -O "/tmp/www.all.net" "+*.all.net/*" -v to httrack "http://npp-user-manual.org/" -O "./nppUserManual" "+*.npp-user-manual.org/*" -v

skarsgal commented 3 years ago

Hi, I would like to point out to you some possible solutions:

  1. convert npp-usermanual to HTML5: Monolith (command line) Monolith not only saves the target document, it embeds CSS, image, and JavaScript assets all at once, producing a single HTML5 • GitHub project page: https://github.com/Y2Z/monolith • direct download ver. 2.4.1 (latest): https://github.com/Y2Z/monolith/releases/download/v2.4.1/monolith.exe • Softpedia: https://www.softpedia.com/get/Internet/Other-Internet-Related/Y2Z-Monolith.shtml

  2. convert HTML5 to PDF wkhtmltopdf (command line) • GitHub project page: https://github.com/wkhtmltopdf/wkhtmltopdf • download page: https://github.com/wkhtmltopdf/packaging/releases/0.12.6-1 • direct download ver. 0.12.6 (latest): https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox-0.12.6-1.msvc2015-win64.exe

    Prince Prince is a HTML to PDF converter with CSS and JavaScript styling options • Prince home page: https://www.princexml.com/ • download page: https://www.princexml.com/download/ It's free to download Prince software for non-commercial use • direct download ver. 14.1 (latest) standalone: https://www.princexml.com/download/prince-14.1-win64.zip

    html5-to-pdf • GitHub project page: https://github.com/peterdemartini/html5-to-pdf • direct download ver. 4.0.1 (latest) - Only JavaScript source code: https://github.com/peterdemartini/html5-to-pdf/archive/v4.0.1.zip

    Weeny Free HTML TO PDF Converter • Weeny software home page: https://www.weenysoft.com/free-html-to-pdf-converter.html • direct download ver. 2.0 (latest): https://www.weenysoft.com/download.php?id=9

Other Free HTML to PDF Converter Software For Windows https://listoffreeware.com/best-free-html-to-pdf-converter-software-windows/

pryrt commented 3 years ago

closed by #170, #174, #175

donho commented 3 years ago

@pryrt

when you generated the example zip from httrack, did you have to use any special arguments?

I just install HTTRACK and use the default argument.

donho commented 3 years ago

@chcg

For a offline version of hugo, see gohugoio/hugo#622.

It would be great if the offline version of hugo exist. But with some search, I didn't see anything.