Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
angularjs-pdf-viewer
Advanced tools
Readme
An AngularJS directive to display PDFs. DEMO
npm install angularjs-pdf-viewer
yarn add angularjs-pdf-viewer
Include the path to the lib, AngularJS and PDFJS:
<script src="node_modules/pdfjs-dist/build/pdf.js"></script>
<script src="node_modules/angular/angular.js"></script>
<script src="node_modules/angularjs-pdf-viewer/dist/angular-pdf-viewer.min.js"></script>
var app = angular.module('App', ['pdf']);
The URL, request headers, scale and delegate-handle can be set using the attributes:
<pdf-viewer
delegate-handle="my-pdf-container"
url="pdfUrl"
scale="1"
show-toolbar="true"
headers="{ 'x-you-know-whats-awesome': 'EVERYTHING' }"></pdf-viewer>
The pdfDelegate service allows you to access and control individual instances of a directive. This allows us to have multiple instances of the same directive in the same controller.
Inject the pdfDelegate
service into your controller. You can then fetch an instance using it's delegate handle and call methods on it:
pdfDelegate.$getByHandle('my-pdf-container').zoomIn();
The following methods are available to the delegate:
In order to replace the active PDF with another one, you can call the load
method of the delegate. For example:
pdfDelegate
.$getByHandle('my-pdf-container')
.load('url-of-the-new-file.pdf');
Run npm install && yarn add
to install all dependencies. And then gulp dev
to start a local server. The example will now be available at localhost:3000/src
The default toolbar can be shown or hidden using the show-toolbar
attribute. Since the PDF can be easily controlled using the delegate service it's quite trivial to build a custom toolbar. Or place the toolbar on a separate scope.
FAQs
An AngularJS directive to display PDFs
The npm package angularjs-pdf-viewer receives a total of 40 weekly downloads. As such, angularjs-pdf-viewer popularity was classified as not popular.
We found that angularjs-pdf-viewer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.