this post was submitted on 22 Jan 2024
25 points (96.3% liked)

Linux

48329 readers
1141 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

Pretty much all of the PDF readers I have tried will work for form filling, however I have some similar issues with all of them.

I mainly use Okular or Atril.

Issue 1 is when filling out multiple fields in a PDF, it becomes extremely slow, to the point of typing some text, and having to wait for 5-10 second for it to show up and I can continue.

Issue 2 is that both Okular and Atril will insert the text with a much larger font size and/or different font than the document. Even in cases where the fields have some pre-populated text, if I touch the field, the font changes. Sometimes the change is significant enough that the text is not readable, or makes surrounding elements not readable.

The best way I have found that works is to use FireFox. The form filling in that works fast and doesn't mess up the fonts, but the way FireFox handles saving PDFs is tedious. I can't just click ctrl+s to save, as it prompts me to choose a location to save at and makes me overwrite the original file every time, rather than just editing it in place.

Is there any PDF reader that people are aware of that does not have these issues? Or is this something that is weird with my setup?

I'm running Debian 12 with the KDE Plasma desktop environment

you are viewing a single comment's thread
view the rest of the comments
[–] tsonfeir@lemm.ee 7 points 10 months ago* (last edited 10 months ago)

This isn’t a gui solution and probably is way off from your intentions, but you could use pdftk to dump the fillable field name and pdftk again to populate them with an xfdf file.

edit, I got interested:

#!/bin/bash

# Check for required arguments
if [ $# -ne 2 ]; then
    echo "Usage: $0 <source-pdf> <destination-pdf>"
    exit 1
fi

SOURCE_PDF=$1
DEST_PDF=$2
XFDF_FILE=tmp.xfdf

# Extract form field names
FIELD_NAMES=$(pdftk "$SOURCE_PDF" dump_data_fields | grep "FieldName:" | cut -d ' ' -f2-)

# Start XFDF file
echo '<?xml version="1.0" encoding="UTF-8"?>' > $XFDF_FILE
echo '<xfdf xmlns="http://ns.adobe.com/xfdf/">' >> $XFDF_FILE
echo '<fields>' >> $XFDF_FILE

# Prompt for user input for each field
for FIELD in $FIELD_NAMES; do
    read -p "$FIELD: " INPUT
    echo "<field name=\"$FIELD\"><value>$INPUT</value></field>" >> $XFDF_FILE
done

# Close XFDF file
echo '</fields>' >> $XFDF_FILE
echo '</xfdf>' >> $XFDF_FILE

# Populate the PDF form
pdftk "$SOURCE_PDF" fill_form $XFDF_FILE output "$DEST_PDF"

# Clean up
rm $XFDF_FILE

echo "PDF form filled and saved as $DEST_PDF"