Sicos1977/QPdfNet

Error in qpdf terminates whole process

Closed this issue · 2 comments

Airex commented

Execution of qpdf wrapper with input file in not pdf format causes error that terminates whole process.
Error in output is:

renderer_1  | terminate called after throwing an instance of 'std::runtime_error'
renderer_1  |   what():  error logger function returned code -1299308016

Environment: Alpine linux 3.18 in docker. Library libqpdf.so.29 is successfully loaded.

Expected behavior to return non success return value instead of uncatchable c++ exceptions.

Usage of library done as

using var workspace = new Workspace(_options.WorkingDirectory);

var inputFileName = workspace.TempFile();
await input.SaveAsFileAsync(inputFileName, cancellationToken);

using Job job = new Job(_logger)
         .InputFile(inputFileName)
         .When(() => !string.IsNullOrWhiteSpace(password), j => j.Password(password));
  
 var result = job
         .WarningExit0()
         .NoWarn()
         .RequiresPassword()
         .RunRequiresPassword(out var output);       

If this is an uncatchable c++ exception then I think you need to raise an issue at QPDF so they can fix this. I don't know if I even can catch a C++ exception in C#

https://github.com/qpdf/qpdf

No response anymore so closed