Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@archireport/react-native-static-html-to-pdf
Advanced tools
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
npm install @archireport/react-native-static-html-to-pdf
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
param | description | example |
---|---|---|
path | path to your html file (it must be under documents) | ${DocumentDirectoryPath}/index.html (DocumentDirectoryPath is provided by react-native-fs ) |
target | url used to indicate that js execution is finished | http://finishload.com |
documentName | name of the generated pdf (in cache directory) | file.pdf |
width | width of the generated pdf | 612 |
height | height of the generated pdf | 792 |
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
FAQs
Convert static html file to pdf
We found that @archireport/react-native-static-html-to-pdf demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.