Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@archireport/react-native-static-html-to-pdf

Package Overview
Dependencies
Maintainers
4
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@archireport/react-native-static-html-to-pdf

Convert static html file to pdf

  • 0.3.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
4
Created
Source

react-native-static-html-to-pdf

Convert static html file to pdf

This library is inspired by react-native-html-to-pdf. It takes a static html file as parameter (whereas react-native-html-to-pdf takes a string as argument).

It takes a screenshot of the page before redirection to target. So you need to add in your html file the following script at the end of the execution of your js

window.location.href = 'http://finishload.com';

The returned value is the path of the generated pdf file

Installation

npm install @archireport/react-native-static-html-to-pdf

Usage

import { generatePdf } from '@archireport/react-native-static-html-to-pdf';

// ...

const pathOfGeneratedPdf = await generatePdf({
  path: `${DocumentDirectoryPath}/public/index.html`,
  target: 'http://finishload.com',
  documentName: 'file.pdf',
  width: 612,
  height: 792,
});

where

paramdescriptionexample
pathpath to your html file (it must be under documents)${DocumentDirectoryPath}/index.html (DocumentDirectoryPath is provided by react-native-fs)
targeturl used to indicate that js execution is finishedhttp://finishload.com
documentNamename of the generated pdf (in cache directory)file.pdf
widthwidth of the generated pdf612
heightheight of the generated pdf792

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

Keywords

FAQs

Package last updated on 25 May 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc