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.

5 Answers 5

3
+100

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).

5
  • I have also an idea to play with that *.svg files. But when I open them, it looses all formatting, showing only the blank screen with black unformatted text.
    – mipe34
    Aug 23, 2013 at 13:04
  • That depends on what viewer you use. While svg2pdf works, I've noticed that svgtools, svgtopam and Firefox's internal SVG viewer don't. If you can supply one of the notebooks, I can try and check it out.
    – LSerni
    Aug 23, 2013 at 15:14
  • I have marked this answer, because this is the most close answer to what I wanted. However, as you said, it can be used only for "simple" notebooks. I haven't found and there is probably no such converter, that could also load the flash hidden inside the notebook (even the GUI loads flash after opening the page) and convert it to pdf - what is also one of my requirements...
    – mipe34
    Aug 25, 2013 at 21:27
  • There is Flash in a notebook? But in that case you can't convert it to PDF; PDF doesn't support it, that I know of. If some "complicated" notebooks are available somewhere, I'd like to test my solution with those.
    – LSerni
    Aug 25, 2013 at 22:08
  • Pdf does not support flash, however, it does not have to be interactive - the screenshot is enough to see, that something is on the page (not just the blank screen). I can't find any example online - I will have to prepare some.
    – mipe34
    Aug 26, 2013 at 9:07
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
4
  • Yes, this is the way I would like to do it. Nevertheless I'm not aware of any of such console converter.
    – mipe34
    Aug 17, 2013 at 19:49
  • In that case, you need to write a script in a program like AutoHotKey to automatically do the clicking and key presses for you. See my edit above.
    – Duke Nukem
    Aug 17, 2013 at 22:03
  • It would be very hard to write such kind of script - I can't imagine how would you script to open thousand different files (for next file you have to click about 10px below, later roll the list...
    – mipe34
    Aug 18, 2013 at 19:22
  • The first file is deleted at the end of the script, so the next file becomes the first file on the next iteration. So, you just loop this script for every file, until there's no more unconverted files left. I wrote many scripts like this before - they take some effort to get used to but are very helpful in many situations.
    – Duke Nukem
    Aug 18, 2013 at 20:04
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.

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.

1
  • I have read this document, but there is nothing about cmd line converting to pdf. There is probably no such converter. Smart board software only allows to convert to pdf manually through GUI.
    – mipe34
    Aug 21, 2013 at 12:50
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 {} \;

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .