Converting Windows Journal files to PDFs from command line
Solution 1
John's post pointed me to the correct answer. Here is a cygwin script that you can adapt to print the JNT files to PDFs using the PDF Creator (free Windows PDF printer). You might have to make sure that PDF Creator is installed, and is configured as the default printer (at least for JNT files).
#!/bin/bash
PDFDIR="pdfs"
JOURNAL_EXE="C:\Program Files\Windows Journal\Journal.exe"
AUTOSAVE_FNAME_FLAG="<REDMON_DOCNAME_FILE>"
PWD_CYGWIN_FORMAT="$(pwd -P)"
PWD_WIN_FORMAT="$(sed -e 's|/|\\|g' \
-e 's|^.cygdrive.||g' \
-e 's|^\(.\)|\1:|g' <<< $PWD_CYGWIN_FORMAT)"
AUTOSAVE_DIR_WIN_FORMAT="$PWD_WIN_FORMAT"'\'"$PDFDIR"
# set up PDFCreator autosave
REG ADD 'HKEY_CURRENT_USER\Software\PDFCreator\Program' /f /v UseAutosave /d 1
REG ADD 'HKEY_CURRENT_USER\Software\PDFCreator\Program' /f /v Autosavedirectory /d "$AUTOSAVE_DIR_WIN_FORMAT"
REG ADD 'HKEY_CURRENT_USER\Software\PDFCreator\Program' /f /v Autosavefilename /d "$AUTOSAVE_FNAME_FLAG"
for file in *.jnt; do
file_w_path="$PWD_WIN_FORMAT"'\'"$file"
eval 'cygstart ''"'"$JOURNAL_EXE"'"'' /p '"'"'"'"$file_w_path"'"'"'"
#strip 's cygstart " c:\prog... " /p ' " c:\home\... " '
sleep 0.5 # just in case
done
To use this script, put it somewhere in your PATH and execute it in a directory that contains the jnt files. It would be easy to modify it to take a target directory as a parameter.
Other notes: in theory, PDF Creator (free Windows PDF printer) should be able to generate the PDFs from the command line, but I couldn't get this to work. The crazy quoting in the eval
statement simply produces cygstart "c:\program files..." /p '"c:\file\to\print"' on the command line.
Solution 2
Look here:
REM Skript sthet unter GPLv3 by jcol11
REM man benötigt PDFCreator um es ausführen zu können
REM frisches Verzeichnis mit aktuellem Datum erstellen
rmdir %cd%\PDFs_%Date%
mkdir %cd%\PDFs_%Date%
REM alten Drucker umbenennen (keine Leerzeichen erlaubt)!!
REM HIER eigenen Standarddrucker eintragen merken
SET %alterdrucker=MeinDrucker
REM PDFCreator als Standarddrucker
rundll32 printui.dll,PrintUIEntry /y /n "PDFCreator"
REM Autosave aktivieren
REG ADD HKEY_CURRENT_USER\Software\PDFCreator\Program /f /v UseAutosave /d 1
FOR %%f IN (*.jnt) DO (
REM Filename setzen
REG ADD HKEY_CURRENT_USER\Software\PDFCreator\Program /f /v Autosavefilename /d %%f
REM Ausgabeverzeichnis setzen
REG ADD HKEY_CURRENT_USER\Software\PDFCreator\Program /f /v AutosaveDirectory /d %cd%\PDFs_%Date%\
REM PrintFile to pdf
"%ProgramFiles%\Windows Journal\Journal.exe" /p "%cd%\%%f")
REM alten Drucker wiederherstellen
rundll32 printui.dll,PrintUIEntry /y /n %alterdrucker%
Maybe you could improve my script and post it again? (new version under ubuntuusers available, works fine for me. It also saves the file under the correct filename):
Ubuntuusers.de Script to convert jnt to pdf
If you have improved the script please post it on ubuntuusers.de (you can post it in english). This will keep the "effort" together so that we dont have to check 2 sites for new versions.
Related videos on Youtube
Comments
-
Leo Alekseyev over 1 year
Support for the Windows Journal format (JNT) outside the Windows platform is dismal. Thus, I am looking for a way to convert jnt files to PDFs. Currently, one either has to print to PDFs from Journal or use online converters. Is there a way to automate the conversion?
-
Admin over 13 yearsWell if you're part-way there (via printing), you might be able to automate that process.
-
Leo Alekseyev over 13 yearsTrouble is, the only PDF conversion printer drivers I have always pop up a "save as" dialog box and dong have command line interfaces.
-
Kurt Pfeifle over 13 yearsNah... some of these drivers have configuration options allowing to suppress the "Save as..." popup and use a default directory/name instead.
-
Leo Alekseyev over 13 yearsConcrete examples?... CutePDF, for instance, doesn't have those options.
-
Kurt Pfeifle almost 13 yearsUse a combination of Ghostscript, RedMon and a generic PostScript printer driver and a batch file... See answer below.
-
-
slhck over 12 yearsWelcome to the site! Can you please summarize what the page says? It's in German, and I doubt everyone will understand what it does. It might be good to translate the script comments too.
-
Leo Alekseyev over 12 yearsThis pointed me to the correct answer. I was able to write a cygwin script that is an equivalent of what john posted in the German Ubuntu forum. I posted it as a separate answer: superuser.com/a/369182/32247