Search code examples
iphoneobjective-cpdfnslog

How to disable console logging on certain PDF generated by CGContextDrawPDFPage


I have a problem with certain PDF's logging to console some Node numbers and Font family and it is making my application slow. Anybody know how to disable the logging?

I used: CGContextDrawPDFPage(context, page);

This does not happen on all PDFs, one explanation in another SO question is that the logging happens when renderer doesn't know the font used by PDF. The PDF I used is http://dl.dropbox.com/u/861361/test.pdf

FYI, I'm using version 3.2 iOS (iPad)


Solution

  • The logs are generated are flushed to STDOUT, if you REALLY want to disable the logging, close STDOUT and redirect STDOUT to /dev/null or other streams that is not STDOUT ;)

    int fileDes = creat("/dev/null", S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
    dup2(fileDes, STDOUT_FILENO);
    close(fileDes);