IanDarwin / pdfshow

Deliver/present talks from PDFs - A simple PDF presenter oriented towards slideshow decks in PDF form
Other
8 stars 4 forks source link

ifndef::ver[] :ver: 1.0.5 endif::[] :sillyName: Clock watching ifndef::current-java-ver[] :current-java-ver: Java 21 endif::[] :gh-url: https://github.com/IanDarwin/pdfshow :releases-link: {gh-url}/releases :download-link: {releases-link}/download/v{ver}

= PdfShow Version {ver} ({sillyName})

PdfShow is a PDF viewer specifically for running slide shows. I wrote it because I sometimes teach from PDFs and was tired of general-purpose programs like PDF Annotator and Adobe Reader, which have too many modes, controls, etc. and aren't really optimized for showing slide decks.

Wait! Who presents from PDFs? Maybe you have to present a talk and you only have the PDF, not the ODP, KeyNote or PPT file(s). Some training companies just distribute their courses to instructors as PDFs, not presentation-software files. Or maybe you want to re-give somebody else's preso from the PDF-only version they published online (if you do this, make sure to ask permission/give credit/respect copyrights+licenses). Or yet again, maybe you use the open-source https://staff.fnwi.uva.nl/b.diertens/useful/gpresent/[gpresent], which doesn't actually present shows but generates the PDF and leaves it to others to present. Or the https://docs.asciidoctor.org/reveal.js-converter/latest/converter/features/[ AsciiDoctor+Reveal.js tooling] which can create PDF slides from AsciiDoc. Or the Markdown-based https://marp.app/[MARP], which can generate PDFs directly from markdown files. Or the MagicPoint-based https://mg.pov.lt/mgp2pdf/[MagicPoint to PDF Converter]. Whatever the reason you need to present with just the PDF of the slides, PdfShow is for you!

image::images/SampleShow.png[width="800"]

PdfShow has fewer features than other tools, due to its relative youth and, more importantly, its design goals. Please see the https://github.com/IanDarwin/pdfshow/issues[list of issues]; read through it before condemning the app as incomplete and again before adding to it - anyone can create a free github account and add issues there! That is also why there's no TODO file here - all the TODOs are in the issues list.

The program is for desktops, not mobiles. There is too much dependency on Swing to make it feasible to run on platforms other than desktop Java.

You can have multiple documents open, which show in the expected tab-vew format. You can drag the tabs around, e.g., to move the most important ones to the left (or right) or for any sort of ordering that makes sense to you at the time.

PdfShow supports dual monitors, one for control and one for viewing slides. As of now, the control window will appear on Monitor 1 and the view on Monitor 2; someday that'll be switchable via an option.

More bells and whistles will likely be added as time permits, but let's keep it relatively simple. There is still some basic functionality that is imperfect or incomplete. Pull requests will be gratefully accepted as long as they fit within the general tone of the program - minimalist, but functional.

== Installing PdfShow

[[installation-summary]] .Installation/Download Summary [options="header",cols="2,2,5,5"] |==== |OS|Pkg Format|CLI Install|Install Download |Java|fat jar|n/a/|{download-link}/pdfshow-{ver}-jar-with-dependencies.jar |Linux|deb|Download then deb install|{download-link}/pdfshow_{ver}-1_amd64.deb |Linux|rpm|Download then dnf install|{download-link}/pdfshow-{ver}-1.x86_64.rpm |macOS|dmg|Download; should open|{download-link}/PDFShow-{ver}.dmg |Windows|msi|winget install RejminetGroupInc.PDFShow|{download-link}/PDFShow-{ver}.msi |====

Or check the {releases-link}[latest release under the Assets dropdown].

The installers bundle their own Java VM, with which they are known to work; they are about 50Mb to download and about 120-140Mb when installed. If you already have a current Java installed, you may prefer to run the JAR file; you have to be sure you have a JDK that will work with PdfShow. The JAR is built with {current-java-ver} on most platforms.

For MS-Windows, once you have winget installed, just type this in a terminal window:

winget install RejminetGroupInc.PDFShow

(That's really me; Rejminet Group Inc. is my consulting company.)

If there's no installer, and you have Java, there's a Jar file that you can run with java -jar. You can rebuild that from source with mvn package assembly:single; see <> below.

== Using PdfShow

The program is intuitive and easy to use. Of course they all say that. Just run it and use File->Open (or CTRL/CMD O), or run it with a filename argument. There's a "recent files" menu for subsequent days of your course, for example. There is more documentation in the link:docs[] folder.

[[building]] == Building PdfShow From Source

=== Build: Prerequisites

On all platforms you need JDK ({current-java-ver}$$+$$) and Apache Maven installed. On Windows jpackage has a couple of pre-requisites, which it will let you know about if they're not already installed.

On Linux, for RPMs, you need rpm-build or you will get told that 'rpm' is an invalid type (sudo dnf install rpm-build). On Linux, for DEBs, you may need fakeroot (sudo apt install fakeroot).

The install formats are:

[[table-name]] .The Installer Formats [options="header",cols="2,4,3"] |==== |OS|Default Format|Other formats with mkinstaller -t |macOS|DMG, with copy-to-Applications iconage.|pkg |Linux|rpm - Redhat/Yum/dnf/Zypher|deb |Windows|MSI installer|exe |====

=== Getting Source

Download the repository from {gh-url}.

Install Apache-Maven if not already installed.

Using command-line tools:

git clone https://github.com/IanDarwin/pdfshow
cd pdfshow

Using Eclipse:

Window->Show View->Git->Git Repositories.
In the Repos window, Clone (the third icon at the right side of this window).
Enter the URL https://github.com/IanDarwin/pdfshow and click Next
On the next dialog, be sure to check Import Existing Projects before Next.
PdfShow should show up in the Package Explorer

Using IntelliJ IDEA

From the startup screen, "Get from Version Control"
Enter the URL https://github.com/IanDarwin/pdfshow and click Clone
Accept or choose the directory and click Clone
On "Open or Import" popup (with choice of how to open), select "Maven Project"

=== Test Runs

To test run the program in a supported Java IDE (Eclipse and IntelliJ IDEa), you just open and run Main.java. If you use another IDE, the same goes. You can even submit a pull request with that IDE's config files, as long as it doesn't require changing the directory structure (i.e., moving existing files around).

To run the program in Maven, use mvn exec:java.

=== Packaging

To make a JAR file with just the program and its images (without the dependencies), do mvn package.

To make a clickable runnable JAR file, run mvn package assembly:single. You'll then find a jar with dependencies in the target folder. It'll be named something like target/pdfshow-x.y.z-SNAPSHOT-jar-with-dependencies.jar. You can run it with java -jar target/pdfshow*dependencies.jar (see scripts/pdfshow), or just click on it in a file manager window in MS-Windows, macOS, or most *Nix windowed environments.

The full-blown, platform-specific installers we release are built by the mkinstaller script. This makes a clickable runnable JAR file as above and then runs the Java 14+ https://docs.oracle.com/en/java/javase/14/docs/specs/man/jpackage.html[jpackage] tool. You can run that script yourself if you want. You can only build the Mac installer on macOS, the Windows installer on Windows, etc.

=== Configuring a Linux rpm-based system and building PDFShow

This may not be optimal, but should work. Newer versions may be available.


sudo dnf install https://cdn.azul.com/zulu/bin/zulu17.32.13-ca-jdk17.0.2-linux.x86_64.rpm

sudo dnf install rpm-build

These systems' packaging have Maven depending on dark ages' JDK-1.8, so:

curl -o apache-maven-3.8.4-bin.tar.gz \ https://dlcdn.apache.org/maven/maven-3/3.8.4/binaries/apache-maven-3.8.4-bin.tar.gz

cd /usr/local; sudo tar xzvf apache-maven-3.8.4.tar.gz

PATH=$PATH:/usr/local/apache-maven-3.8.4/bin

mkdir git cd git git clone https://github.com/IanDarwin/pdfshow

cd pdfshow

mkinstaller -s # skiptests; they fail on this Linux with infra-related errs, don't care

== Contributing / Development

Fork the repo, clone your forked copy, make changes, test changes, send a pull request.

Q: Why didn't I use this for the drawing:

PDPageContentStream contentStream = new PDPageContentStream(document, page);
contentStream.setNonStrokingColor(Color.DARK_GRAY);
contentStream.addRect(200, 650, 100, 100);

A: The problem is that it would be much harder (if not impossible) to implement Undo processing when using that approach. Perhaps a later Save PDF function could insert the GObjects into the PDF using this technique.

Q: Why not use the built-in contains() method for hit detection?

A: The GObject hierarchy is intentionally light-weight, not JComponent, and it's gotta be the same amount of work.

== Credits

Program written by Ian Darwin of Rejminet Group Inc. Contributions by a cast of thousands (we hope); their names are listed on the main github page. Thanks folks!

Draggable Tab component DnDTabbedPane courtesy of https://java-swing-tips.blogspot.com/2008/04/drag-and-drop-tabs-in-jtabbedpane.html

PDF access (i.e., some of the heavy listing!) is done by https://pdfbox.apache.org/[Apache PDFBox] software.

Some icons from feathericons.com; the rest by Ian Darwin.