Skip to content

Commit

Permalink
Merge pull request #151 from shaehn/docinfo
Browse files Browse the repository at this point in the history
Text changes fix #149 #52 #42 plus line additions
  • Loading branch information
chunyenHuang authored Nov 5, 2019
2 parents 62d5a9c + f0449db commit 15ffeb0
Show file tree
Hide file tree
Showing 28 changed files with 4,492 additions and 3,453 deletions.
713 changes: 636 additions & 77 deletions docs/Recipe.html

Large diffs are not rendered by default.

544 changes: 272 additions & 272 deletions docs/Recipe.js.html

Large diffs are not rendered by default.

684 changes: 342 additions & 342 deletions docs/annotation.js.html

Large diffs are not rendered by default.

92 changes: 46 additions & 46 deletions docs/appendPage.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,51 +37,51 @@ <h1 class="page-title">appendPage.js</h1>

<section>
<article>
<pre class="prettyprint source linenums"><code>const hummus = require('hummus');
const hummusUtils = require('./utils');

/**
* Append pages from the other pdf to the current pdf
* @name appendPage
* @function
* @memberof Recipe
* @param {string} pdfSrc - The path for the other pdf.
* @param {number|number[]} pages - The page number or the array of page numbers to be appended.
*/
exports.appendPage = function appendPage(pdfSrc, pages = []) {
if (!Array.isArray(pages) &amp;&amp; !isNaN(pages)) {
pages = [pages];
}
const pdfReader = hummus.createReader(pdfSrc);
const pageCount = pdfReader.getPagesCount();
// prevent unmatched pagenumber
const transformPageNumber = (pageNum) => {
pageNum = (pageNum > pageCount) ? pageCount : pageNum;
pageNum = (pageNum &lt; 1) ? 1 : pageNum;
return (pageNum - 1);
};
pages = pages.map((element) => {
if (Array.isArray(element)) {
return [
transformPageNumber(element[0]),
transformPageNumber(element[1])
];
} else {
return [
transformPageNumber(element),
transformPageNumber(element)
];
}
});
if (pages.length > 0) {
hummusUtils.appendPDFPagesFromPDFWithAnnotations(this.writer, pdfSrc, {
specificRanges: pages
});
} else {
hummusUtils.appendPDFPagesFromPDFWithAnnotations(this.writer, pdfSrc);
}
return this;
};
<pre class="prettyprint source linenums"><code>const hummus = require('hummus');
const hummusUtils = require('./utils');

/**
* Append pages from the other pdf to the current pdf
* @name appendPage
* @function
* @memberof Recipe
* @param {string} pdfSrc - The path for the other pdf.
* @param {number|number[]} pages - The page number or the array of page numbers to be appended.
*/
exports.appendPage = function appendPage(pdfSrc, pages = []) {
if (!Array.isArray(pages) &amp;&amp; !isNaN(pages)) {
pages = [pages];
}
const pdfReader = hummus.createReader(pdfSrc);
const pageCount = pdfReader.getPagesCount();
// prevent unmatched pagenumber
const transformPageNumber = (pageNum) => {
pageNum = (pageNum > pageCount) ? pageCount : pageNum;
pageNum = (pageNum &lt; 1) ? 1 : pageNum;
return (pageNum - 1);
};
pages = pages.map((element) => {
if (Array.isArray(element)) {
return [
transformPageNumber(element[0]),
transformPageNumber(element[1])
];
} else {
return [
transformPageNumber(element),
transformPageNumber(element)
];
}
});
if (pages.length > 0) {
hummusUtils.appendPDFPagesFromPDFWithAnnotations(this.writer, pdfSrc, {
specificRanges: pages
});
} else {
hummusUtils.appendPDFPagesFromPDFWithAnnotations(this.writer, pdfSrc);
}
return this;
};
</code></pre>
</article>
</section>
Expand All @@ -94,7 +94,7 @@ <h1 class="page-title">appendPage.js</h1>
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Wed Oct 02 2019 12:00:26 GMT-0700 (Pacific Daylight Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Fri Nov 01 2019 20:41:12 GMT-0400 (Eastern Daylight Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>

<script>prettyPrint();</script>
Expand Down
Loading

0 comments on commit 15ffeb0

Please sign in to comment.