
Security News
Bun 1.2.19 Adds Isolated Installs for Better Monorepo Support
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.
@magneds/hapi-plugin-pdf
Advanced tools
Create a PDF file from any web page
$ npm install --save @magneds/hapi-plugin-pdf
As the name might have suggested already, this package is a plugin for the Hapi framework, simply registering the package as plugin will suffice.
@magneds/hapi-server
const HapiServer = require('@magneds/node-hapi-server');
const HapiPluginPDF = require('@magneds/hapi-plugin-pdf');
new HapiServer()
.configure({ host: 'localhost', port: 3000 })
.plugin(HapiPluginPDF)
.start()
.then(() => console.log(`Running @${server.info.uri}`));
hapi
const Hapi = require('hapi');
const HapiPluginPDF = require('@magneds/hapi-plugin-pdf');
const server = Hapi.server({ host: 'localhost', port: 3000 });
const init = async () => {
await server.register(HapiPluginPDF);
await server.start();
console.log(`Running @${server.info.uri}`);
};
init();
The pdf plugins registers a single route and works with both the GET
and POST
request methods.
/pdf/render
The request is delegated to the provided url using the method used to call the /pdf/render
endpoint, any GET and/or POST parameter as well as all headers are added to the delegated request.
A GET request only requires a (properly encoded) url
parameter, which contains the url to the web page to render as PDF.
Any header provided will be provided to the final destination.
Like the GET request, a POST request also only requires the url
parameter, which may be provided in either the payload (body) or as parameter to the url.
All headers and payload data will be provided to the final destination.
The '/pdf' portion of the route is a so-called route prefix, it can be changed to whatever you'd like during registration to Hapi by specifying an alternative.
@magneds/hapi-server
//...
// rename the /pdf/render path to /my-custom/pdf/render
.plugin({ ...HapiPluginPDF, routes: { prefix: '/my-custom/pdf' } })
//..
hapi
//...
// rename the /pdf/render path to /my-custom/pdf/render
await server.register({ ...HapiPluginPDF, routes: { prefix: '/my-custom/pdf' } });
//...
};
init();
Please see Changelog
$ npm test
Please see Contributing
The MIT License (MIT). Please see License File for more information.
FAQs
Hapi plugin to create PDF's from webpages
The npm package @magneds/hapi-plugin-pdf receives a total of 0 weekly downloads. As such, @magneds/hapi-plugin-pdf popularity was classified as not popular.
We found that @magneds/hapi-plugin-pdf demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2.19 introduces isolated installs for smoother monorepo workflows, along with performance boosts, new tooling, and key compatibility fixes.
Security News
Popular npm packages like eslint-config-prettier were compromised after a phishing attack stole a maintainer’s token, spreading malicious updates.
Security News
/Research
A phishing attack targeted developers using a typosquatted npm domain (npnjs.com) to steal credentials via fake login pages - watch out for similar scams.