django_ocr_server/utils.py
def ocr_pdf(stdin, filename):
    """
    This function OCRs a pdf document from the stdin, \
    then saves searchable pdf to a disk if filename does not equal 'store_pdf_disabled', returns a recognized text 2019-04-11
    :param stdin: a pdf document as bytes
    :param filename: a filename of a searchable pdf that will be created
    :return: a recognized text
    """
    popen = subprocess.Popen([
        'ocrmypdf',
        '-l',
        TESSERACT_LANG,
        '-',  # using STDIN
        filename,  #
        '--force-ocr',
        '--sidecar',
        '-'  # using STDOUT for sidecar
    ], stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
    return popen.communicate(input=stdin)[0].decode()

    This function OCRs a pdf document from the stdin, \
    then saves searchable pdf to a disk if filename does not equal 'store_pdf_disabled', returns a recognized text 2019-04-11
    :param stdin: a pdf document as bytes
    :param filename: a filename of a searchable pdf that will be created
    :return: a recognized text
    
This function OCRs a pdf document from the stdin, \
then saves searchable pdf to a disk if filename does not equal 'store_pdf_disabled', returns a recognized text 2019-04-11
This function OCRs a pdf document from the stdin \ then saves searchable pdf to a disk if filename does not equal ' store_pdf_disabled ' returns a recognized text 2019 - 04 - 11
def ocr_pdf(stdin, filename):
    popen = subprocess.Popen([
        'ocrmypdf',
        '-l',
        TESSERACT_LANG,
        '-',  
        filename,  
        '--force-ocr',
        '--sidecar',
        '-'   using STDOUT for sidecar
    ], stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
    return popen.communicate(input=stdin)[0].decode()
def ocr_pdf ( stdin , filename ) : popen = subprocess . Popen ( [ 'ocrmypdf' , '-l' , TESSERACT_LANG , '-' , filename , '--force-ocr' , '--sidecar' , '-' ] , stdout = subprocess . PIPE , stderr = subprocess . PIPE , stdin = subprocess . PIPE ) return popen . communicate ( input = stdin ) [ 0 ] . decode ( )
This function OCRs a pdf document from the stdin, \
then saves searchable pdf to a disk if filename does not equal 'store_pdf_disabled', returns a recognized text 2019-04-11
This function OCRs a pdf document from the stdin \ then saves searchable pdf to a disk if filename does not equal ' store_pdf_disabled ' returns a recognized text 2019 - 04 - 11
"""
    This function OCRs a pdf document from the stdin, \
    then saves searchable pdf to a disk if filename does not equal 'store_pdf_disabled', returns a recognized text 2019-04-11
    :param stdin: a pdf document as bytes
    :param filename: a filename of a searchable pdf that will be created
    :return: a recognized text
    """ # using STDIN # # using STDOUT for sidecar
a recognized text
a recognized text
stdin
a pdf document as bytes
a pdf document as bytes
filename
a filename of a searchable pdf that will be created
a filename of a searchable pdf that will be created