Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: preserve links in PDF #389

Merged
merged 2 commits into from
Aug 3, 2022

Conversation

ublefo
Copy link
Contributor

@ublefo ublefo commented Aug 3, 2022

Description

This fix will only preserve links (hyperlinks and internal links) and nothing else. This is a limitation of the TeX packages we have available, both pax and newpax can only extract links and nothing else. The TeX engine can insert annotations with a package like pdfcomment, but we cannot extract them from the PDFs we are including, so this is as good as it gets right now.

Changes made

  • Update erb templates

    • Global preamble app/views/layouts/application.pdf.erbtex
    • Task submission PDF template app/views/task/task_pdf.pdf.erb
    • Portfolio PDF template app/views/portfolio/portfolio_pdf.pdf.erb
  • Update installation script to install newpax with tlmgr

  • Update installation script to patch the current version of newpax (call tlmgr info --only-installed --data cat-version newpax and ensure we are only patching v0.52)

  • Improve logging in app/helpers/file_helper.rb to report whether PDF compression has happened or not

Fixes: #130 and doubtfire-lms/doubtfire-web#337
Does not fix: #326

Tests done

CI run:
https://github.com/ublefo/doubtfire-api/runs/7643617478?check_suite_focus=true

Additional tests done locally:

  • Submitted a test file as task evidence, learning summary and additional portfolio evidence, ensured links are present in the output file. Only the links on the first page should be intact, we currently cannot preserve anything in the other pages.
  • Ensured our GhostScript compression calls will preserve these links (ImageMagick doesn't seem to have such options) by running GhostScript with the same cmdline args specified in file_helper and made sure links are still present after processing.

@ublefo ublefo mentioned this pull request Aug 3, 2022
5 tasks
@macite macite merged commit f489546 into doubtfire-lms:development Aug 3, 2022
@ublefo ublefo deleted the fix/pdf-annotation branch August 3, 2022 06:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants