sayanee / angularjs-pdf

:page_facing_up: An AngularJS directive <ng-pdf> to display PDF files with PDFJS
http://sayan.ee/angularjs-pdf/
MIT License
494 stars 248 forks source link

Add attribute to limit the canvas-height to its container #128

Closed lesteenman closed 7 years ago

lesteenman commented 8 years ago

This patch adds an attribute that, combined with scale='page-fit', allows to fit the contents inside of the page both with respects to the width and with respect to the height. Think of it as using background-size='contain' rather than the default behavior of background-size='cover' that scale='page-fit' triggers.

Fixes #127.

lesteenman commented 8 years ago

WIP: Pushed too early.

lesteenman commented 8 years ago

Note: It seems that even the cleanly pulled branch does not pass the tests, with the same error I'm getting here. However, I see that Travis still says your own builds are passing. Am I doing something wrong?

sayanee commented 8 years ago

Thanks @lesteenman - I haven't look at this in detail, but could you see some instructions on CONTRIBUTING.md to run some tests / build locally with grunt and npm? That might give you some clue hopefully!

lesteenman commented 8 years ago

Yes, I have. I'm having no issues with steps 1-4. However, when I run npm run build, I'm getting the following error:

Running "karma:unit" (karma) task
11 05 2016 12:32:43.285:INFO [karma]: Karma v0.13.22 server started at http://localhost:9876/
11 05 2016 12:32:43.298:INFO [launcher]: Starting browser PhantomJS
11 05 2016 12:32:43.682:INFO [PhantomJS 1.9.8 (Linux 0.0.0)]: Connected on socket /#EIIhO8EZAS2tWGgcAAAA with id 34226259
PhantomJS 1.9.8 (Linux 0.0.0) ERROR
  TypeError: '[object Uint8Array]' is not a valid argument for 'Function.prototype.apply' (evaluating 'argsArray[i]')
  at /home/erik/projects/angularjs-pdf/example/js/lib/pdf.js:4519
PhantomJS 1.9.8 (Linux 0.0.0): Executed 2 of 4 ERROR (0.948 secs / 0.013 secs)
Warning: Task "karma:unit" failed. Use --force to continue.

Note that this same error occurs with a clean clone of your repository, and the same error occurs with the Travis CI build. Running npm test also gives this error.

lesteenman commented 8 years ago

Updating karma-phantomjs-launcher to ^1.0.0 (from ^0.2.1) seems to have worked. I'll submit a new PR.

lesteenman commented 8 years ago

This new version does not include phantomjs-prebuilt anymore. Adding a commit to include this dependency manually.

dennybiasiolli commented 7 years ago

@lesteenman can you please rebase this PR? Now the problems with tests should be resolved.

lesteenman commented 7 years ago

The earliest I can do that is next Tuesday, probably. If there is a deadline before then, please do so yourself; the changes should be straightforward.