2

Is there any way, how to convert SMART *.notebook (file format to create presentations for Smartboard) to PDF in a batch?

I have about thousand of such files to convert to pdf and the software distributed with Smartboard allows only to export to pdf one-by-one.

mipe34
  • 23

5 Answers5

3

For simple notebooks, you might do this yourself.

.notebook files are simply .ZIP files with a manifest (used like a spine in ebooks) that allow you to navigate through the page files inside the notebook.

And page files are SVG format files, so you can convert them easily on Linux, but there are tools for Windows too (and even online tools - I don't know about using them for thousands of file though, the ToS probably forbid that).

To test, on Linux (it should work on Windows too, but it requires installing Cygwin with Perl), I tried:

$ unzip -l Untitled.notebook
Archive:  Untitled.notebook
  Length      Date    Time    Name
---------  ---------- -----   ----
    11715  2013-08-21 14:28   page1377095283484.svg
     1251  2013-08-21 14:28   imsmanifest.xml
     7137  2013-08-21 14:28   page0.svg
---------                     -------
    20103                     3 files

In the manifest file, I find:

<resource adlcp:scormType="asset" href="page0.svg" identifier="pages" type="webcontent">
  <file href="page0.svg"/>
  <file href="page1377095283484.svg"/>
</resource>

By running svg2pdf, I can get both pages to convert to PDF correctly.

At this point, a simple run of pdftk allowed me to get a single PDF with the two pages.

Wrapping this all into a converter requires a bit of tweaking to ease out the SVG pages from the manifest (in CPAN, I had to force install App::Xml_grep2 due to a test failure which looked spurious).

# Temporary files named from 1 to N. It is unlikely that
# any legitimate files exist with such names, but this has
# better be done in a temporary directory, just in case.

unzip $1

if [ ! -r imsmanifest.xml ]; then
    echo Sorry, this notebook seems to have no manifest.
    exit 2
fi

# Get page numbers
XPATH="//*[@identifier='pages']/*[local-name()='file']/@href"
PAGES=`xml_grep2 -t "$XPATH" imsmanifest.xml`

# Remove manifest, we need it no more.
rm imsmanifest.xml
N=0
for page in $PAGES; do
    # Create 
    N=$[ $N + 1 ]
    svg2pdf $page $N
    # Remove SVG page, we need it no more.
    rm $page
done
pdftk $( seq 1 $N ) output $1.pdf
# Now remove temporary files
rm $( seq 1 $N )

I have tried it with a few notebooks created with SmartTech Express, and it works. I can give no other warranty.

Once saved as a script, the above can convert recursively a large directory full of .notebook files:

find . -name "*.notebook" -exec /path/to/converter \{\}\;

...at the end, at the side of every .notebook file there will (well, there should...) be a .notebook.pdf file with the same name and converted content (the script can be modified to get rid of the .notebook part of the name, i.e., convert Sample.notebook to Sample.pdf, using the basename utility).

LSerni
  • 8,620
2

I don't have the software you mention, but if it accepts command line arguments or if the converter/exporter is a separate program, you can do the conversion using a batch file.

For example if the converter/exporter can be activated by typing converter.exe <input file> <output file> into the command line, the following batch file would convert all the *.notebook files in the same folder as itself:

set PATH_TO_CONVERTER=<insert path here>
for %%a in ("*.notebook") do "%PATH_TO_CONVERTER%" "%%a" "newfiles\%%~na.pdf"

In line 1 you would need to change <insert path here> to the full path to the converter, e.g. C:\Program Files\something\converter.exe

If the export can only be performed using the software's graphical interface, you could write a script to do the clicking for you, using a program such as AutoHotKey. Copy all the files you want to convert to a new folder first. The script would have to be something like this (the shortcut keys are for example only, they are probably different in the software you're using):

Type Ctrl+O      -- Open the file chooser dialog
Wait a few seconds for it to open
Type down arrow  -- Select the first file
Type enter       -- Open the file
Wait a few seconds for it to open
Type Alt+F+X     -- Call the export command
Wait a few seconds for export dialog to open
Type enter       -- Export file
Type Ctrl+W      -- Close the file
Type Ctrl+O      -- Open the file chooser dialog
Wait a few seconds for it to open
Type down arrow  -- Select the first file
Type Del         -- We're done with the first file so delete it
Type Enter       -- Agree to delete
Type Esc         -- Close file chooser
Go back to beginning of script
Duke Nukem
  • 1,255
  • 2
  • 10
  • 21
1

Powershell script. Requires path updates for the inkscape and pdftk executables, and installation of chocolatey (windows package manager) for installation of XMLStarlet.

function SmartNotebook2PDF
{
    Param($notebookfile)
    $notebasename = (Get-Item $notebookfile).basename
    $zipfile = $notebasename + ".zip"
    Write-Host "Working on $notebookfile"
    Copy-Item $notebookfile -Destination $zipfile
    Expand-Archive $zipfile -Force
        if (!(Test-Path $notebasename\imsmanifest.xml)) {
        Write-Host "sorry, this notebook seems to have no manifest."
        Break
        }
    $pages = xml sel -t -v "//*/_:resource[@identifier='pages']/_:file/@href" $notebasename\imsmanifest.xml
    $n = 0
    ForEach ($page in $pages) {
        $n++
        Write-Host "Found $page, converting"
        inkscape $notebasename\$page --export-area-page --export-pdf=$n
        Remove-Item -path $notebasename\$page
    }
    Write-Host "Exported $n pages to PDF with Inkscape"
    pdftk $(1..$n) output "$notebookfile.pdf"
    Write-Host "PDF created with pdftk at $notebookfile.pdf. Cleaning up."
    del $(1..$n)
    Remove-Item -path $notebasename -recurse
    Remove-Item -path $zipfile
    Write-Host "Done."
}


$files = dir -recurse -ea 0 *.notebook | % FullName

ForEach ($file in $files) {
    SmartNotebook2PDF ($file)
    }

Someone smarter than me can probably figure out how to get the XML attributes out of powershell natively instead of using XMLStarlet.

Biswapriyo
  • 11,584
podfish
  • 11
0

The before comment said something about scripts and command line arguments. I probed around the SmartBoard site and I found this .pdf. It is possible that a command-line option is hidden among the documentation but I don't have that software or product, so I can't help. My recommendation here is to search thoroughly.

I have seen some screenshots and it seems .notebook doesn't convert directly to .pdf; by this I mean there is some preprocessing needed (or desirable) to convert them. A script or a autoclicker script might end up resulting in a lot of unusable .pdf files.

0

I had plenty of problems with the solution provided by lserni. For example I couldn't find xml_grep2 or svg2pdf anywhere. Maybe it just needed an update. Here is my solution:

#!/bin/bash

# Temporary files named from 1 to N. It is unlikely that
# any legitimate files exist with such names, but this has
# better be done in a temporary directory, just in case.

# un-comment for debug messages
# set -x

# always overwrite when unzipping
unzip -o "$1"

if [ ! -r imsmanifest.xml ]; then
  echo Sorry, this notebook seems to have no manifest.
  exit 2
fi

# Get page numbers
XPATH="//*/_:resource[@identifier='pages']/_:file/@href"
PAGES=`xmlstarlet sel -t -v "//*/_:resource[@identifier='pages']/_:file/@href" imsmanifest.xml`

N=0
for page in $PAGES; do
    # Create   
    ((N++))

    inkscape $page --export-area-page --export-pdf=$N
    #inkscape $page --export-area-drawing --export-pdf=$N

    # Remove SVG page, we need it no more.   
    rm $page   
done

pdftk $( seq 1 $N ) output "$1.pdf"

# Now remove temporary files
rm $( seq 1 $N )
rm -rf images annotationmetadata
rm metadata.rdf metadata.xml settings.xml preview.png
rm imsmanifest.xml

To run it for multiple files I used:

find . -name "*.notebook" -exec convert.sh {} \;
flexus
  • 121