Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Please verify input parameters... on conversion from docx with Table of Contents #32

Open
LLDmitry opened this issue Jan 29, 2020 · 9 comments

Comments

@LLDmitry
Copy link

LLDmitry commented Jan 29, 2020

I use nodejs10 aws lambda + lambda layer created from the latest lo.tar.zip.
It works well, but conversion Word docs in which "Table of Contents" exists, raises an error: "Please verify input parameters... (SfxBaseModel::impl_store file:///tmp/file.pdf failed: 0xc10(Error Area:Io Class:Write Code:16))"
With previous version - lo.tar.gz the same document is converted successfully

@tadasauciunas
Copy link

Same, having problems with converting docx files containing table of contents.

@tadasauciunas
Copy link

tadasauciunas commented Feb 11, 2020

Managed to fix the problem by unzipping/decompressing the https://github.com/shelfio/libreoffice-lambda-layer/blob/master/layer.tar.br.zip file, adding directories from share/config directory in normal libreoffice installation to the unzipped libre installation, compressing and zipping it again, and using the result file as a lambda layer.
I pushed the result and added some more details to a separate repository, you can download it from it or do the steps yourself:
https://github.com/tadasauciunas/libreoffice-lambda-layer-brotli

@vladgolubev I would provide a pull request with this updated libre archive, but it added 35mb to the unzipped/decompressed libreoffice installation, and I'm not sure if that's good enough to release publicly

@LLDmitry
Copy link
Author

Thank you, it solved the problem

@jpike88
Copy link

jpike88 commented Jul 30, 2020

@vladgolubev this is a major issue, any comments?

@evrardts
Copy link

evrardts commented Jan 5, 2021

Hi @tadasauciunas,

Thanks for the solution. However, when creating the layer in AWS, I encounter this issue: "Failed to create layer version: Could not unzip uploaded file. Please check your file, then try to upload again." Any idea where that could come from ? Thanks!

@Jun711
Copy link

Jun711 commented Nov 20, 2021

@tadasauciunas I installed libreoffice 6.4.0.1 on my mac but I can't find share/config directory. Could you provide more information on how to find that directory?

@evrardts Do you know where to find the share/config` directory?

@evrardts
Copy link

@Jun711 I did that long time ago, but here is my code:
`app.post('/converttopdf', async function(req, res) {

console.log(execSync('ls -alh /opt').toString('utf8'));

// const inputPath = '/opt/lo.tar.br';
const inputPath = '/opt/lo.tar.br';
// const outputPath = '/tmp/instdir/program/soffice.bin';
const outputPath = '/tmp/instdir/program/soffice.bin';

await unpack({inputPath, outputPath});

wait(1000)

var s3 = new S3({
accessKeyId: process.env.ACCESS_ID,
secretAccessKey: process.env.SECRET_KEY,
region: process.env.REGION,
signatureVersion: 'v4',
});

var key = req.apiGateway.event.requestContext.authorizer.claims['custom:companyId'] + req.body.key

var objectData = await getFile(process.env.AWS_COMPANYFILESTORAGE_BUCKET, key, s3)

wait(2000)

// console.log(execSync('ls -alh /tmp').toString('utf8'));

if (! await canBeConvertedToPDF(req.body.fileName)) {
res.json({success: 'post call failed!', url: req.url, body: req.body, output: false})
}

writeFileSync(/tmp/${req.body.fileName}, objectData);
const outputFilename = await ${parse(req.body.fileName).name}.pdf;
const convertCommand = /tmp/instdir/program/soffice.bin --headless --norestore --invisible --nodefault --nofirststartwizard --nolockcheck --nologo --convert-to pdf --outdir /tmp;

let test
try {
test = await execSync(${convertCommand} /tmp/${req.body.fileName}).toString('utf8')
} catch (e) {
test = await execSync(${convertCommand} /tmp/${req.body.fileName}).toString('utf8')
}
console.log(test)
// console.log(execSync('ls -alh /tmp').toString('utf8'));

wait(3000)

const outputFileBuffer = await readFileSync(/tmp/${outputFilename});

var slicedKey = key.slice(0, -4)
var newKey = slicedKey.concat("pdf")

var responseSlicedKey = req.body.key.slice(0, -4)
var responseNewKey = responseSlicedKey.concat("pdf")

var resp = await putFile(process.env.AWS_COMPANYFILESTORAGE_BUCKET, newKey, outputFileBuffer, s3)

fs.unlinkSync(/tmp/${req.body.fileName})
fs.unlinkSync(/tmp/${outputFilename})

// console.log(execSync('ls -alh /tmp').toString('utf8'));

res.json({success: 'post call succeed!', url: req.url, body: req.body, output: true, newKey: responseNewKey})

});
`

@tadasauciunas
Copy link

@Jun711 should be where all installed apps are stored, perhaps /Applications/LibreOffice.app/ or something similar. Try which libreoffice in the command line, perhaps it'll give you a clue. In linux it's /usr/lib/libreoffice/share

@Jun711
Copy link

Jun711 commented Nov 22, 2021

@evrardts @tadasauciunas Thanks. I found the share/config folder
amer1993 shared the config file in this shelfio/libreoffice-lambda-layer#33

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants