Skip to content

PDF Annotation & Template creation from a PDF. Bug fixes.#27

Open
AstyCX wants to merge 10 commits intojonjampen:masterfrom
AstyCX:feature/pdf-annotation
Open

PDF Annotation & Template creation from a PDF. Bug fixes.#27
AstyCX wants to merge 10 commits intojonjampen:masterfrom
AstyCX:feature/pdf-annotation

Conversation

@AstyCX
Copy link
Copy Markdown
Contributor

@AstyCX AstyCX commented Dec 8, 2025

PDF Annotation

Added a feature to annotate a chosen PDF from Obsidian. By right-clicking a file with the .pdf extension, “Annotate in Xournal++” will appear in the menu. By choosing it, a -annotated.xopp file will be created (with a corresponding .pdf if the Export to PDF setting is on).

PDF Template Creation

Added PDF to the list of styles in the template creation modal. When creating a new template through settings, you can now choose to create a template from a PDF. It will suggest choosing a PDF either by entering an absolute path on your system or by using a fuzzy search modal inside your vault.
After choosing the PDF, the following settings are applied:

  • Page Size is changed to Custom and filled with the width and height fetched from the chosen PDF.
  • A Number of Pages setting appears, allowing you to choose how many pages from the original PDF you would like to appear in the template.

Fixes

  • Added a separate types.ts for constants and introduced types.
  • Fixed custom dimensions in the template creation modal not creating input fields.
  • Fixed small cosmetic code issues.

@diam0ndkiller
Copy link
Copy Markdown
Contributor

Is that feature available now? To create a xopp file that has a pdf as background? Why not just open the pdf file in Xournal++ for the user to save / choose name + folder later? I would rather do that in my normal workflow than having it auto-create a xopp file.

Copy link
Copy Markdown
Contributor

@diam0ndkiller diam0ndkiller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's smarter to just comment here instead of forking your fork again and making random changes :)

height: dimensions.height,
pdfPage: await getPageCount(file, app)
};
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add function to open PDF in Xournal++ instead of creating new .xopp file with background - e.g. openInXOPP(file, app)



function addAnnotatePdfInXournalppMenu(menu: Menu, plugin: XoppPlugin, file: TFile) {
menu.addItem((item) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

two buttons, one for "annotate" and one for "annotate & autosave" maybe? otherwise maybe add toggle in settings whether to just open pdf in xournal or to create a new xopp with pdf as background to auto-save

}
});
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Automatically save annotated PDF when choosing annotate in file menu" maybe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants