瀏覽代碼

Updated .readme and test case.

master
Kalimuthu Selvaraj 4 年之前
父節點
當前提交
feae87dbe9
共有 3 個檔案被更改,包括 13 行新增7 行删除
  1. 9
    7
      README.md
  2. 1
    0
      package.json
  3. 3
    0
      test/test.js

+ 9
- 7
README.md 查看文件



[![Build Status](https://travis-ci.com/kalimuthu-selvaraj/file-convert.svg?branch=master)](https://travis-ci.com/kalimuthu-selvaraj/file-convert) [![Coverage Status](https://coveralls.io/repos/github/kalimuthu-selvaraj/file-convert/badge.svg?branch=master)](https://coveralls.io/github/kalimuthu-selvaraj/file-convert?branch=master) [![Build Status](https://travis-ci.com/kalimuthu-selvaraj/file-convert.svg?branch=master)](https://travis-ci.com/kalimuthu-selvaraj/file-convert) [![Coverage Status](https://coveralls.io/repos/github/kalimuthu-selvaraj/file-convert/badge.svg?branch=master)](https://coveralls.io/github/kalimuthu-selvaraj/file-convert?branch=master)


Converts `.ppt` `.pptx` `.odp` and `.key` file to `pdf or/and image(png, jpg, jpeg and etc..)`
(new feature) `disableExtensionCheck` is `true` then converts any file(supported by libre office) to `pdf or/and image(any format)`

`disableExtensionCheck` is `false` then converts only `.ppt` `.pptx` `.odp` and `.key` file to `pdf or/and image(png, jpg, jpeg and etc..)`


## Dependencies ## Dependencies


Please install [libreoffice](https://www.libreoffice.org/), [imagemagick](https://www.imagemagick.org/script/index.php) and might required [ghostscript](https://www.ghostscript.com/) for Mac os Please install [libreoffice](https://www.libreoffice.org/), [imagemagick](https://www.imagemagick.org/script/index.php) and might required [ghostscript](https://www.ghostscript.com/) for Mac os
**(Note: Please do restart your machine after installed all required software.)** **(Note: Please do restart your machine after installed all required software.)**


###IMPORTANT
Make sure you install libreoffice to the USER you launch nodejs with and that this user HAS a home directory!
try to convert a file from inside that USER to properly test!
in case you install directly from libreoffice website,
MAKE SURE you use the ./install script that comes inside the tar.gz inside the USER!

###IMPORTANT
Make sure you install libreoffice to the USER you launch nodejs with and that this user HAS a home directory!
try to convert a file from inside that USER to properly test!
in case you install directly from libreoffice website,
MAKE SURE you use the ./install script that comes inside the tar.gz inside the USER!


## LibreOffice test ## LibreOffice test


imgExt: "jpg", // Optional and default value png imgExt: "jpg", // Optional and default value png
reSize: 800, // Optional and default Resize is 1200 reSize: 800, // Optional and default Resize is 1200
density: 120, // Optional and default density value is 120 density: 120, // Optional and default density value is 120
disableExtensionCheck: true, // convert any files to pdf or/and image
}; };


// Convert document to pdf and/or image // Convert document to pdf and/or image

+ 1
- 0
package.json 查看文件

"coverage": "nyc npm run test" "coverage": "nyc npm run test"
}, },
"keywords": [ "keywords": [
"libreoffice file convert to pdf or/and image",
"ppt to pdf", "ppt to pdf",
"pptx to pdf", "pptx to pdf",
"keynote to pdf", "keynote to pdf",

+ 3
- 0
test/test.js 查看文件

}); });


it("should convert pdf to image", function () { it("should convert pdf to image", function () {
options.libreofficeBin = "/usr/bin/libreoffice";
options.sourceFile = `${global.appRoot}/source/file_example.pdf`; options.sourceFile = `${global.appRoot}/source/file_example.pdf`;
options.outputDir = `${global.appRoot}/files/`; options.outputDir = `${global.appRoot}/files/`;
options.reSize = 800; options.reSize = 800;
}); });


it("should convert pdf only", function (done) { it("should convert pdf only", function (done) {
options.libreofficeBin = "/usr/bin/libreoffice";
options.sourceFile = `${global.appRoot}/source/file_example.pptx`; options.sourceFile = `${global.appRoot}/source/file_example.pptx`;
options.img = false; options.img = false;
document.convert(options).then((res) => { document.convert(options).then((res) => {
}); });


it("should convert without resize, density and imgExt", function () { it("should convert without resize, density and imgExt", function () {
options.libreofficeBin = "/usr/bin/libreoffice";
options.img = true; options.img = true;
document.convert(options).then((res) => { document.convert(options).then((res) => {
expect(res).to.equal("Success"); expect(res).to.equal("Success");

Loading…
取消
儲存