Exemplo n.º 1
0
    def sync(self):
        if self.state == model.item.STATE_SYNCING:
            return

        self.state = model.item.STATE_SYNCING
        self._update_state_listener()

        self._download_raw()
        self._write_remapy_file()
        self._update_state(inform_listener=False)

        annotations_exist = os.path.exists(self.path_rm_files)

        if self.type == TYPE_NOTEBOOK and annotations_exist:
            render.notebook(self.path,
                            self.id(),
                            self.path_annotated_pdf,
                            self.is_landscape(),
                            path_templates=cfg.get("general.templates"))

        else:
            if annotations_exist:
                # Also for epubs a pdf file exists which we can annotate :)
                # We will then show the pdf rather than the epub...
                render.pdf(self.path_rm_files, self.path_original_pdf,
                           self.path_annotated_pdf, self.path_oap_pdf)

        self._update_state()
        self.parent().sync()
Exemplo n.º 2
0
def render(id, name):
    print()
    print("Rendering " + name + ".....")
    pdf(INPUT_BASE_PATH + id + "/" + id,
        INPUT_BASE_PATH + id + "/" + id + ".pdf",
        OUTPUT_BASE_PATH + name + "_annotated.pdf",
        OUTPUT_BASE_PATH + name + "_oap.pdf")
Exemplo n.º 3
0
def render(id, name):
    print()
    print("Rendering " + name + ".....")
    path_original_pdf = INPUT_BASE_PATH / id / f"{id}.pdf"
    rm_files_path = INPUT_BASE_PATH / id / id
    path_highlighter = INPUT_BASE_PATH / f"{id}.highlights"
    pages = get_pages(rm_files_path)
    path_annotated_pdf = OUTPUT_BASE_PATH / f"{name}_annotated.pdf"
    path_oap_pdf = OUTPUT_BASE_PATH / f"{name}_oap.pdf"

    pdf(
        rm_files_path,
        path_highlighter,
        pages,
        path_original_pdf,
        path_annotated_pdf,
        path_oap_pdf,
    )