Repository navigation
Add a PDF whose picture follows the clock with JavaScript - #46
Merged
Merged
Conversation
MartinThoma
marked this pull request as ready for review
November 6, 2026 21:06
Member
Author
|
@stefan6419846 This was a fun little experiment: I wanted to have a clear visual proof that JS is running within the PDF :-) A general question: Would you like to review changes to the sample-files repository before I merge them? I'm asking as this is a submodule of pypdf |
Collaborator
I will leave this up to you, as I have enough trust in you that you will not start doing anything strange. My permissions in this repository mostly stem from the fact that you had limited ability in the past and this would block adding test files for pypdf otherwise. |
stefan6419846
requested changes
Nov 7, 2026
MartinThoma
force-pushed
the
javascript-clock
branch
from
December 2, 2026 07:00
36dcb74 to
8d4b058
Compare
034-javascript-clock: a landscape in which a document-level JavaScript shows, once per second, * the sky of the current hour: the sun or the moon on its arc, the brightness of the sky and the ground, stars at night; * the tree of the current month, from bare with snow to falling leaves; * a penguin walking across the page once per hour, one position per minute, changing its step every second; * the time and the month in two text fields. The pictures are 156 read-only push buttons with appearance streams, all hidden except the default ones; the script switches them with the display property of the fields. Without JavaScript, the file shows noon in June. Tested in Firefox 157 (PDF.js), which only applies the display property to push buttons with a JavaScript action, so every picture has one that does nothing. The script writes the file without a PDF library and creates the same file every time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MartinThoma
force-pushed
the
javascript-clock
branch
from
December 2, 2026 07:02
8d4b058 to
513d4eb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
033-javascript-clock: a landscape in which a document-level JavaScript shows, once per second,
The pictures are 156 read-only push buttons with appearance streams, all hidden except the default ones; the script switches them with the display property of the fields. Without JavaScript, the file shows noon in June. Tested in Firefox 157 (PDF.js), which only applies the display property to push buttons with a JavaScript action, so every picture has one that does nothing.
The script writes the file without a PDF library and creates the same file every time.