
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
@dbp-toolkit/pdf-viewer
Advanced tools
This component is a wrapper around the pdf.js library to display PDF files in the browser.
You can install this component via npm:
npm i @dbp-toolkit/pdf-viewer
<dbp-pdf-viewer></dbp-pdf-viewer>
<script type="module" src="node_modules/@dbp-toolkit/pdf-viewer/dist/dbp-pdf-viewer.js"></script>
Or directly via CDN:
<dbp-pdf-viewer></dbp-pdf-viewer>
<script type="module" src="https://unpkg.com/@dbp-toolkit/pdf-viewer@0.0.7/dist/dbp-pdf-viewer.js"></script>
lang
(optional, default: de
): set to de
or en
for German or English
<dbp-pdf-viewer lang="de" client-id="my-client-id"></dbp-pdf-viewer>
auto-resize
(optional, default: cover
)
contain
to resize the viewed PDF to fit the container horizontally and verticallycover
to resize the viewed PDF to fit the container horizontally only,
vertically the PDF can exceed the container<dbp-pdf-viewer auto-resize="contain"></dbp-pdf-viewer>
showPDF(file: File)
: Opens a PDF file. The file must be a File
object.
document.querySelector('dbp-pdf-viewer').showPDF(file);
You can use the showPDF
method to open a PDF file. This method accepts a File
object as parameter.
<input @change=${this.openFile} type="file" />
<dbp-pdf-viewer lang="en"></dbp-pdf-viewer>
<script type="module" src="https://unpkg.com/@dbp-toolkit/pdf-viewer@0.0.7/dist/dbp-pdf-viewer.js"></script>
<script>
document.querySelector('input').addEventListener('change', function(e) {
if (e.target.files[0]) {
let file = e.target.files[0];
console.log('You selected ' + file.name);
document.querySelector('dbp-pdf-viewer').showPDF(file);
}
});
</script>
See example/index.html for a working example.
# get the source
git clone git@github.com:digital-blueprint/toolkit.git
cd toolkit/packages/pdf-viewer
# install dependencies
npm install
# constantly build dist/bundle.js and run a local web-server on port 8002
npm run watch
# run tests
npm test
# build local packages in dist directory
npm run build
Jump to http://localhost:8002 and you should get a demo page.
FAQs
PDF Viewer Web Component
The npm package @dbp-toolkit/pdf-viewer receives a total of 12 weekly downloads. As such, @dbp-toolkit/pdf-viewer popularity was classified as not popular.
We found that @dbp-toolkit/pdf-viewer demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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 researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.