Skip to content

Commit

Permalink
Correction resolucion
Browse files Browse the repository at this point in the history
  • Loading branch information
tharyckgusmao committed Sep 14, 2017
1 parent e368c00 commit 6757e22
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 80 deletions.
14 changes: 13 additions & 1 deletion app/components/ebook/EbookItemComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import fs from 'fs';
import async from 'async';
import { remote } from 'electron';
import {convert} from '../../utils/convert.js';
import resizer from 'resizer';


const URL_HOST = "https://jigsaw.vitalsource.com/api/v0/";
Expand All @@ -33,6 +34,15 @@ export default class EbookItemComponent extends Component{
loadingImg: false
})



}


_test = () =>{

convert("PDF",'/run/media/thaka/Backup/Empresa/Projetos/lab/bibliotecaFumecV2/livros/9788520453339','teste',()=>{});

}

_handlerDownloadEbook =()=>{
Expand Down Expand Up @@ -171,7 +181,9 @@ export default class EbookItemComponent extends Component{
});


}).pipe(fs.createWriteStream(folderPath + '/'+ self.props.data.isbn + '/temp/' + self.props.data.title + "___" + item.cfi.replace('/','') + '.jpeg'));
})
.pipe(fs.createWriteStream(folderPath + '/'+ self.props.data.isbn + '/temp/' + self.props.data.title + "___" + item.cfi.replace('/','') + '.jpeg'));



});
Expand Down
11 changes: 3 additions & 8 deletions app/utils/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,13 @@ export function convert(type = 'PDF', folderPath,name,cb){

});

let doc = new pdfkit({
size: [596, 842]
});
let doc = new pdfkit({size: [800, 1180], margin: 0});

doc.pipe(fs.createWriteStream(folderPath+'/'+name+'.pdf'));

files.forEach((el)=>{
doc.addPage()
.image(el,{
fit: [596, 842],
align: 'center',
valign: 'center'
});
.image(el , 0, 0,'height': 1180 , 'fit':[800, 1180]);

})

Expand Down
4 changes: 2 additions & 2 deletions dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="https://fonts.googleapis.com/css?family=Dosis" rel="stylesheet">

<link href="./main-ccf94e4fcbb3852dc45a.min.css" rel="stylesheet"></head>
<link href="./main-4fa437e7a10899e7c775.min.css" rel="stylesheet"></head>

<body>
<div id='root'>
</div>
<script type="text/javascript" src="./main-ccf94e4fcbb3852dc45a.min.js"></script></body>
<script type="text/javascript" src="./main-4fa437e7a10899e7c775.min.js"></script></body>
</html>
File renamed without changes.

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
},
"linux": {
"target": [
"deb",
"AppImage"
]
}
Expand All @@ -59,10 +58,12 @@
"babel-preset-stage-0": "^6.24.1",
"brfs": "^1.4.3",
"cheerio": "^1.0.0-rc.2",
"electron-image-resize": "^1.2.4",
"eslint": "^3.19.0",
"eslint-plugin-react": "^7.0.0",
"express": "^4.15.2",
"html-webpack-plugin": "^2.28.0",
"jimp": "^0.2.28",
"json-loader": "^0.5.7",
"pdfkit": "^0.8.3",
"react": "^15.5.4",
Expand All @@ -77,7 +78,9 @@
"redux-thunk": "^2.2.0",
"request-promise": "^4.2.1",
"requestretry": "^1.12.2",
"resizer": "0.0.6",
"rimraf": "^2.6.1",
"sharp": "^0.18.3",
"string-replace-webpack-plugin": "^0.1.3",
"transform-loader": "^0.2.4",
"webpack": "^2.5.1",
Expand Down
101 changes: 51 additions & 50 deletions webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module.exports = {
filename: '[name]-[hash].min.js',
publicPath: './'
},

plugins: [
new webpack.optimize.UglifyJsPlugin({
compressor: {
Expand Down Expand Up @@ -47,58 +48,58 @@ module.exports = {
"react",
"es2015",
"stage-0"]
},
},
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract({
fallback:'style-loader',
use:'css-loader?sourceMap&modules&importLoaders=1&localIdentName=__[hash:base64:5]!postcss-loader'
})
},
{
test: /\.(eot|svg|ttf|woff|woff2)$/,
loader: 'file-loader',
}
,{
test: /\.(jpg|png|gif)$/,
loader: 'file-loader'
},
{test: /pdfkit[\/\\]js[\/\\]mixins[\/\\]fonts.js$/, loader: StringReplacePlugin.replace({
replacements: [
{
pattern: 'return this.font(\'Helvetica\');',
replacement: function () {
return '';
{
test: /\.css$/,
loader: ExtractTextPlugin.extract({
fallback:'style-loader',
use:'css-loader?sourceMap&modules&importLoaders=1&localIdentName=__[hash:base64:5]!postcss-loader'
})
},
{
test: /\.(eot|svg|ttf|woff|woff2)$/,
loader: 'file-loader',
}
,{
test: /\.(jpg|png|gif)$/,
loader: 'file-loader'
},
{test: /pdfkit[\/\\]js[\/\\]mixins[\/\\]fonts.js$/, loader: StringReplacePlugin.replace({
replacements: [
{
pattern: 'return this.font(\'Helvetica\');',
replacement: function () {
return '';
}
}
}
]})
},
{test: /fontkit[\/\\]index.js$/, loader: StringReplacePlugin.replace({
replacements: [
{
pattern: /fs\./g,
replacement: function () {
return 'require(\'fs\').';
]})
},
{test: /fontkit[\/\\]index.js$/, loader: StringReplacePlugin.replace({
replacements: [
{
pattern: /fs\./g,
replacement: function () {
return 'require(\'fs\').';
}
}
}
]})
},
/* hack for Web Worker support */
{test: /FileSaver.js$/, loader: StringReplacePlugin.replace({
replacements: [
{
pattern: 'doc.createElementNS("http://www.w3.org/1999/xhtml", "a")',
replacement: function () {
return 'doc ? doc.createElementNS("http://www.w3.org/1999/xhtml", "a") : []';
]})
},
/* hack for Web Worker support */
{test: /FileSaver.js$/, loader: StringReplacePlugin.replace({
replacements: [
{
pattern: 'doc.createElementNS("http://www.w3.org/1999/xhtml", "a")',
replacement: function () {
return 'doc ? doc.createElementNS("http://www.w3.org/1999/xhtml", "a") : []';
}
}
}
]})
},
{enforce: 'post', test: /fontkit[\/\\]index.js$/, loader: "transform-loader?brfs"},
{enforce: 'post', test: /unicode-properties[\/\\]index.js$/, loader: "transform-loader?brfs"},
{enforce: 'post', test: /linebreak[\/\\]src[\/\\]linebreaker.js/, loader: "transform-loader?brfs"}
]})
},
{enforce: 'post', test: /fontkit[\/\\]index.js$/, loader: "transform-loader?brfs"},
{enforce: 'post', test: /unicode-properties[\/\\]index.js$/, loader: "transform-loader?brfs"},
{enforce: 'post', test: /linebreak[\/\\]src[\/\\]linebreaker.js/, loader: "transform-loader?brfs"}

]
},
};
]
},
};

0 comments on commit 6757e22

Please sign in to comment.