def encrypt_pdf(update, context):
    result = check_back_user_data(update, context)
    if result is not None:
        return result

    _ = set_lang(update, context)
    update.effective_message.reply_text(
        _("Encrypting your PDF file"), reply_markup=ReplyKeyboardRemove()
    )
    process_pdf(update, context, "encrypted", encrypt_pw=update.effective_message.text)

    return ConversationHandler.END
def rotate_pdf(update, context):
    if not check_user_data(update, context, PDF_INFO):
        return ConversationHandler.END

    _ = set_lang(update, context)
    degree = int(update.effective_message.text)
    update.effective_message.reply_text(
        _("Rotating your PDF file clockwise by {} degrees").format(degree),
        reply_markup=ReplyKeyboardRemove(),
    )
    process_pdf(update, context, "rotated", rotate_degree=degree)

    return ConversationHandler.END
Exemple #3
0
def scale_pdf(update, context, percent=None, dim=None):
    _ = set_lang(update, context)
    if percent is not None:
        update.effective_message.reply_text(
            _("Scaling your PDF file, horizontally by *{}* and vertically by *{}*"
              ).format(percent[0], percent[1]),
            reply_markup=ReplyKeyboardRemove(),
            parse_mode=ParseMode.MARKDOWN,
        )
        process_pdf(update, context, "scaled", scale_by=percent)
    else:
        update.effective_message.reply_text(
            _("Scaling your PDF file with width of *{}* and height of *{}*").
            format(dim[0], dim[1]),
            reply_markup=ReplyKeyboardRemove(),
            parse_mode=ParseMode.MARKDOWN,
        )
        process_pdf(update, context, "scaled", scale_to=dim)

    return ConversationHandler.END