Compare commits
No commits in common. "12e4fe29630446abe1e387af14cc1f9ec9812b16" and "d2cf9c9f51f13c17d3a8935f74795804f2ae9cfc" have entirely different histories.
12e4fe2963
...
d2cf9c9f51
3
make.sh
3
make.sh
@ -4,7 +4,6 @@ FILENAME="ResearchProposal"
|
|||||||
|
|
||||||
IN="${FILENAME}.md"
|
IN="${FILENAME}.md"
|
||||||
OUT="${FILENAME}.pdf"
|
OUT="${FILENAME}.pdf"
|
||||||
OUT_MOD="${FILENAME}-Erkl.pdf"
|
|
||||||
|
|
||||||
# Generate the PDF from Markdown
|
# Generate the PDF from Markdown
|
||||||
echo "Generating PDF..."
|
echo "Generating PDF..."
|
||||||
@ -23,7 +22,7 @@ fi
|
|||||||
|
|
||||||
# Insert Erklärung.pdf at the end of the PDF
|
# Insert Erklärung.pdf at the end of the PDF
|
||||||
echo "Modifying the PDF..."
|
echo "Modifying the PDF..."
|
||||||
./modify-pdf.sh "$OUT" "resources/Erklärung.pdf" "$OUT_MOD"
|
./modify-pdf.sh "$OUT" "resources/Erklärung.pdf" "$OUT"
|
||||||
|
|
||||||
# remove last page for osf.io
|
# remove last page for osf.io
|
||||||
echo "Removing last page for OSF.io output and saving to OSF-$OUT"
|
echo "Removing last page for OSF.io output and saving to OSF-$OUT"
|
||||||
|
@ -17,30 +17,6 @@ input_pdf="$1"
|
|||||||
insert_pdf="$2"
|
insert_pdf="$2"
|
||||||
output_pdf="$3"
|
output_pdf="$3"
|
||||||
|
|
||||||
# Check if input and insert PDFs exist
|
|
||||||
if [ ! -f "$input_pdf" ]; then
|
|
||||||
echo "Error: Input PDF '$input_pdf' not found."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -f "$insert_pdf" ]; then
|
|
||||||
echo "Error: Insert PDF '$insert_pdf' not found. Deleting the last page from input PDF."
|
|
||||||
|
|
||||||
# Get the number of pages in the input PDF
|
|
||||||
num_pages=$(pdftk "$input_pdf" dump_data | grep NumberOfPages | awk '{print $2}')
|
|
||||||
|
|
||||||
if [ -z "$num_pages" ] || [ "$num_pages" -le 1 ]; then
|
|
||||||
echo "Error: Input PDF has insufficient pages or unable to determine the number of pages."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Remove the last page and save as output
|
|
||||||
pdftk "$input_pdf" cat 1-$(($num_pages - 1)) output "$output_pdf"
|
|
||||||
|
|
||||||
echo "Removed the last page from '$input_pdf' and saved as '$output_pdf'."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Get the number of pages in the input PDF
|
# Get the number of pages in the input PDF
|
||||||
num_pages=$(pdftk "$input_pdf" dump_data | grep NumberOfPages | awk '{print $2}')
|
num_pages=$(pdftk "$input_pdf" dump_data | grep NumberOfPages | awk '{print $2}')
|
||||||
|
|
||||||
@ -58,5 +34,4 @@ pdftk temp_removed_last.pdf "$insert_pdf" cat output "$output_pdf"
|
|||||||
# Clean up temporary files
|
# Clean up temporary files
|
||||||
rm -f temp_removed_last.pdf
|
rm -f temp_removed_last.pdf
|
||||||
|
|
||||||
# Success message
|
echo "Successfully created $output_pdf by replacing the last page with $insert_pdf."
|
||||||
echo "Successfully created '$output_pdf' by replacing the last page with '$insert_pdf'."
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user