Skip to content

Commit

Permalink
Merge pull request #9 from paralect/ak_fix-options
Browse files Browse the repository at this point in the history
[-] Fix image options
  • Loading branch information
KuhArt authored Jan 29, 2018
2 parents fb1fa66 + 8580712 commit d91b09b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
10 changes: 5 additions & 5 deletions client/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module.exports = class PdfService {

return getStaticFileFromHtml({
outPaths: { htmlPath, staticFilePath: `${staticFilePath}.pdf` },
pdfOptions,
options: pdfOptions,
headers,
type: 'pdf',
templateSystem,
Expand All @@ -58,7 +58,7 @@ module.exports = class PdfService {

try {
return getStaticFileByContent({
pdfOptions,
options: pdfOptions,
headers,
type: 'pdf',
templateSystem,
Expand Down Expand Up @@ -90,7 +90,7 @@ module.exports = class PdfService {

return getStaticFileFromHtml({
outPaths: { htmlPath, staticFilePath: `${staticFilePath}.${imgOptions.type || 'png'}` },
imgOptions,
options: imgOptions,
headers,
templateSystem,
type: imgOptions.type || 'png',
Expand All @@ -115,7 +115,7 @@ module.exports = class PdfService {

try {
return getStaticFileByContent({
imgOptions,
options: imgOptions,
headers,
templateSystem,
content,
Expand All @@ -140,7 +140,7 @@ module.exports = class PdfService {
const paths = await validate({ pagePath });
const watchParams = {
paths,
pdfOptions,
options: pdfOptions,
templateSystem,
serverUrl: this.serverUrl,
mode: this.mode,
Expand Down
12 changes: 6 additions & 6 deletions client/lib/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const isProdHtmlExists = (htmlPath) => {

const getStaticFileFromHtml = async ({
outPaths,
pdfOptions,
options,
headers,
templateSystem,
serverUrl,
Expand All @@ -90,8 +90,8 @@ const getStaticFileFromHtml = async ({
}

let pdfStream = type === 'pdf'
? getPdf(html, pdfOptions, headers, serverUrl)
: getImg(html, pdfOptions, headers, serverUrl);
? getPdf(html, options, headers, serverUrl)
: getImg(html, options, headers, serverUrl);

if (mode === 'development') {
await writePdf(staticFilePath, pdfStream);
Expand All @@ -106,16 +106,16 @@ const getStaticFileFromHtml = async ({

const getStaticFileByContent = async ({
content,
pdfOptions,
options,
headers,
templateSystem,
serverUrl,
type,
}) => {
const html = compileHtml(content, templateSystem);
const pdfStream = type === 'pdf'
? getPdf(html, pdfOptions, headers, serverUrl)
: getImg(html, pdfOptions, headers, serverUrl);
? getPdf(html, options, headers, serverUrl)
: getImg(html, options, headers, serverUrl);

return pdfStream.pipe((PassThrough()));
};
Expand Down
3 changes: 2 additions & 1 deletion client/lib/webpackTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const build = ({ paths }) => {
});
};

const watch = ({ paths, templateSystem, serverUrl, buildPdf, mode }) => {
const watch = ({ paths, templateSystem, serverUrl, buildPdf, mode, options }) => {
const config = getConfig({ paths });
const compiler = webpack(config);
return new Promise((resolve, reject) => {
Expand All @@ -89,6 +89,7 @@ const watch = ({ paths, templateSystem, serverUrl, buildPdf, mode }) => {
await buildPdf({
outPaths: { htmlPath, pdfPath },
templateSystem,
options,
type: 'pdf',
serverUrl,
mode,
Expand Down
2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@paralect/pdf-service-client",
"version": "0.3.0",
"version": "0.3.1",
"description": "Pdf service client for https://hub.docker.com/r/paralect/pdf-service/",
"main": "index.js",
"bin": {
Expand Down

0 comments on commit d91b09b

Please sign in to comment.