ulivz / vuepress-plugin-export Goto Github PK
View Code? Open in Web Editor NEWExport your VuePress site to a PDF file
License: MIT License
Export your VuePress site to a PDF file
License: MIT License
Is it possible to add the feature for the user to hide the nav bar and change the margin? Since there are some minor styling differences between the website and PDF version of the docs, e.g. no nav bar, upper and bottom margin, text horizontal overflow wrap, etc.
Thanks for the efforts.
🚨 You need to enable Continuous Integration on Greenkeeper branches of this repository. 🚨
To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because it uses your CI build statuses to figure out when to notify you about breaking changes.
Since we didn’t receive a CI status on the greenkeeper/initial
branch, it’s possible that you don’t have CI set up yet.
We recommend using:
If you have already set up a CI for this repository, you might need to check how it’s configured. Make sure it is set to run on all new branches. If you don’t want it to run on absolutely every branch, you can whitelist branches starting with greenkeeper/
.
Once you have installed and configured CI on this repository correctly, you’ll need to re-trigger Greenkeeper’s initial pull request. To do this, please click the 'fix repo' button on account.greenkeeper.io.
As e.g. some PNGs, not as one PDF. Would like to work on it if devs will approve the idea.
Hello,
when i run the command, if has generated 21 pages of pdf but it is just empty and the file size is just 14kb.
am i missing something or plugin is still in experimental stage?
The module easy-pdf-merge
needs developers to prepare a Java environment with downloading a complete Java JDK. Is there any other solutions to bypass the tedious environment setup?
Thanks for the efforts.
Hi,
first of all, thanks for creating this plugin, it's very useful!
I'm having troubles running the pdf export on Windows, though:
> vuepress export docs
wait Extracting site metadata...
(...)
info Start to generate current site to PDF ...
Error: net::ERR_ADDRESS_INVALID at http://0.0.0.0:8080
I was able to patch this locally by changing this line of the plugin:
await generatePDF(ctx, nCtx.devProcess.port, nCtx.devProcess.host)
to
await generatePDF(ctx, nCtx.devProcess.port, 'localhost')
With this change, the PDF export works.
Is there a way to configure the host name with the current release?
Cheers,
Daniel
The links in current PDF are localhost:8080
, it should be customizable.
This tool is really cool! Thank you. I ran into a few issues using it that were pretty easy to work-around in my local code. I'm not sure yet how to fix them correctly so no PR today.
First issue, the paths sent to puppeteer don't include the base
from my .vuepress/config.js.
const exportPages = pages.map(page => {
return {
url: page.path,
title: page.title,
location: `http://${host}:${port}<BASE HERE WITHOUT TRAILING SLASH>${page.path}`,
path: `${tempDir}/${page.key}.pdf`
}
})
Second issue, puppeteer tries to navigate before the build is finished; in my case the build is over a minute, and puppeteer times out waiting for the first page to load. I worked around it by inserting a long await on setTimeout for the first loop iteration. I do see vuepress actually logging a message to console when the build is finally done. If the plug in could event on that, it would be cleaner.
if (I===0) await SOME LONG TIMEOUT
await browserPage.goto(
location,
{ waitUntil: 'networkidle2' }
)
Third issue, pdfbox.jar PDFMerger requires a JDK. The README should point out this dependency.
Fourth issue, it exports all languages and the page assembly order is pretty random. I worked around by assembling/merging myself.
The issue is that I wanted to sort pages in exported PDF, but code does not work as expected. As a result, pages are not sorted in resulting PDF.
This problem is caused by a version of index.js in the NPM tarball that is different from the version presented on the Github repository. The version provided in the NPM tarball, while being tagged 0.2.0, does NOT feature usage of the sorted
optional function.
Evidence of this difference:
As a workaround, I have added a line to overwrite index.js after the installation of the tarball, by fetching the version from GitHub.
$ npm i vuepress-plugin-export
$ cd node_modules/vuepress-plugin-export/
$ rm index.js
$ wget https://raw.githubusercontent.com/ulivz/vuepress-plugin-export/master/index.js
After that change, the plugin can sort pages as expected.
Hi, when i run the command vuepress export, it shows the below codes and it's not generating pdf... can anyone take a look pls?
wait Extracting site metadata...
tip Apply theme @vuepress/theme-default
warning [vuepress] cannot resolve plugin "export"
tip Apply plugin @vuepress/container (i.e. "@vuepress/plugin-container") ...
tip Apply plugin @vuepress/container (i.e. "@vuepress/plugin-container") ...
tip Apply plugin @vuepress/register-components (i.e. "@vuepress/plugin-register-components") ...
tip Apply plugin @vuepress/active-header-links (i.e. "@vuepress/plugin-active-header-links") ...
tip Apply plugin @vuepress/search (i.e. "@vuepress/plugin-search") ...
tip Apply plugin @vuepress/nprogress (i.e. "@vuepress/plugin-nprogress") ...
tip Apply plugin @vuepress/container (i.e. "@vuepress/plugin-container") ...
tip Apply plugin @vuepress/container (i.e. "@vuepress/plugin-container") ...
tip Apply plugin @vuepress/container (i.e. "@vuepress/plugin-container") ...
Unknown command: export
After installing Vuepress 1.x and the plugin, trying to run the command leads to the following:
At C:\Users\domin\AppData\Local\Yarn\bin\vuepress.ps1:5 char:13
+ *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
+ ~
Unexpected token ')' in expression or statement.
At C:\Users\domin\AppData\Local\Yarn\bin\vuepress.ps1:8 char:3
+ if [ -x "$basedir/pwsh" ]; then
+ ~
Missing '(' after 'if' in if statement.
At C:\Users\domin\AppData\Local\Yarn\bin\vuepress.ps1:8 char:5
+ if [ -x "$basedir/pwsh" ]; then
+ ~
Missing type name after '['.
At C:\Users\domin\AppData\Local\Yarn\bin\vuepress.ps1:9 char:20
+ ... edir/pwsh" "$basedir/../Data/global/node_modules/.bin/vuepress.ps1" ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unexpected token '"$basedir/../Data/global/node_modules/.bin/vuepress.ps1"' in expression or statement.
At C:\Users\domin\AppData\Local\Yarn\bin\vuepress.ps1:9 char:77
+ ... /pwsh" "$basedir/../Data/global/node_modules/.bin/vuepress.ps1" "$@"
+ ~~~~
Unexpected token '"$@"' in expression or statement.
+ CategoryInfo : ParserError: (:) [], ParseException
+ FullyQualifiedErrorId : UnexpectedToken
Can anyone help me out with troubleshooting this?
Cheers!
I want to use bundles[].sorter, but found it did not work. it seems this feature is not in v0.2.0, why not package a new version? By the way , this plugin is great.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.