galkahana / HummusJS

Node.js module for high performance creation, modification and parsing of PDF files and streams
http://www.pdfhummus.com
Other
1.14k stars 169 forks source link

Cannot get logging to work #251

Closed tsestrich closed 6 years ago

tsestrich commented 6 years ago

I feel really silly for having to ask this, but I for some reason cannot get logging to work. I add the log option on the createWriter call, and it just won't write anything out to a log. I've tried writing to the file you see below, to /tmp/combineTest.log, and a handful of others. None are creating an output file, despite the actual PDFs being written properly.

I'm using the latest version of hummusJs currently.

try
    {
        var pdfWriter = hummus.createWriter(targetFileLocation, { 
            version: hummus.ePDFVersion17,
            log: "combineTest.log" //won't actually log
        });

        fileGrouping.Files.forEach(function(file){
            var docUniqueId = file.docUniqueId;

            var tempPDFFileNameIn = tempDirectoryName + "/" + docUniqueId + ".pdf";
            pdfWriter.appendPDFPagesFromPDF(tempPDFFileNameIn);
        });

        var newInfo = pdfWriter.getDocumentContext().getInfoDictionary();

        newInfo.title = fileGrouping.title;

        pdfWriter.end();
    }
    catch(error)
    {
        logService.LogError(error);
    }
chunyenHuang commented 6 years ago

I think that HummusJS only logs when having known errors, it will not log the progress.

tsestrich commented 6 years ago

Okay, thanks. That must be what's happening. I am getting an invalid PDF as a result, but it must not be throwing any errors. I'll create a separate ticket the describes that.