Ask Your Question
1

How to export Impress Notes only? [closed]

asked 2013-02-26 04:45:08 +0200

ROSt52 gravatar image

I want to export all the notes of slides of an Impress presentation in the format: slide on top and the notes below; just like they are visible in the NOTES VIEW.

I opened the presentation in NOTES VIEW and exported to pdf; result: only the slides are exported.

I opened the pdf-export window, checked: "Export notes pages"; result: all slides are exported + the notes pages.

How can I export only the notes pages as they are seen in the NOTES VIEW without the slides before?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2016-03-05 11:53:07.989835

3 Answers

Sort by » oldest newest most voted
1

answered 2013-02-26 16:43:34 +0200

qubit gravatar image

Looks like we've already got a bug on the books for this one...

  • fdo#39271 - Impress PDF export should support notes pages only - NEW

It's been around for a while, too:

Reported: 2011-07-15
Modified: 2012-09-10

Please feel free to go kick it and wake it up. There was a suggestion that it might be an EasyHack, but it's not marked as such right now.

edit flag offensive delete link more
1

answered 2014-10-26 06:56:56 +0200

Matthew Cline gravatar image

updated 2014-10-26 21:45:26 +0200

I've found a hack for UNIX users here, via here:

1) Put this script into a file:

#!/usr/bin/perl -w 

# This script takes an OpenOffice Impress output file in PDF format, 
# including both slides and notes, and splits that PDF into separate 
# slides-only and notes-only PDF files.  The reason this script exists 
# is because OpenOffice itself (as of version 2.2, at least) does not 
# have the capability to export a notes-only PDF file. 
# 
# This script depends on the pdftk program (http://www.pdfhacks.com/pdftk/) 
# being installed and available in your command search path. 

if (scalar @ARGV != 1) { 
    print "usage:  split_pdf slides_and_notes.pdf\n"; 
    exit 1; 
} 

my $pdf_file = $ARGV[0]; 

# An OpenOffice Impress PDF contains a certain string that holds the 
# total number of pages in the document.  There may be no guarantee 
# that this string must exist, but since it does for now, we use it. 
my $pagecountstring = `strings $pdf_file | fgrep /Count`; 
$pagecountstring =~ m,/Count (\d+)>>,; 
my $totalpagecount = $1; 
my $halfpagecount = $totalpagecount / 2; 
my $firstnotepage = $halfpagecount + 1; 

my $out_file_base = $pdf_file; 
$out_file_base =~ s/\.pdf$//; 

`pdftk $pdf_file cat              1-$halfpagecount  output ${out_file_base}_slides.pdf`; 
`pdftk $pdf_file cat $firstnotepage-$totalpagecount output ${out_file_base}_notes.pdf`;

2) Install PDFtk.

3) Export the Impress file as a PDF file with both slides and notes.

4) Run the script on the exported file.

The script will produce two new PDF files: one containing only slides and one containing only notes.


I wrote another Perl script to do something similar for HTML exports:

  1. Export the HTML files to directory in-dir.
  2. Create a directory out-dir to hold the notes-only files.
  3. Run [script] in-dir out-dir, or just [script] out-dir if the current working directory is in-dir.

out-dir will hold HTML files which contain only the notes. If an original HTML file had no notes, there will be no corresponding file in out-dir.

This doesn't modify the original file, and doesn't create any notes-free HTML files.

The script:

#!/usr/bin/perl

use strict;
use Cwd;

my $in_dir = cwd();
my $out_dir;

sub processFile {
  my ($file_name) = @_;

  open (my $in, "<", "$file_name") || die "Couldn't read $file_name: $!";

  my $preamble = "";
  while (<$in>)
  {
      $preamble .= $_;
      last if (m/<body/i);
  }

  my $found_notes = 0;
  while (<$in>)
  {
      if (m|^<h.>Notes:</h.>|i)
      {
          $found_notes = 1;
          last;
      }
  }

  unless ($found_notes)
  {
      close($in);
      return;
  }

  my $out_file = "$out_dir/$file_name";
  open(my $out, ">", "$out_file") || die "Couldn't write $out_file: $!";

  print $out "$preamble";
  print $out $_;

  while(<$in>)
  {
      print $out $_;
  }
  close($in);
  close($out);
}

##########################################################################

if (@ARGV == 1)
{
    $out_dir = $ARGV[0];
}
elsif (@ARGV == 2)
{
    $in_dir  = $ARGV[0];
    $out_dir = $ARGV[1];
}
else
{
    print STDERR "Usage:\n";
    print STDERR "   notes-only.pl: in-dir out-dir\n";
    print STDERR "   notes-only.pl: out-dir (assumes current dir is in-dir)\n";
    exit(1);
}

die "No directory $in_dir"  unless (-d $in_dir);
die "No directory $out_dir" unless (-d $out_dir);

opendir(my $dh, $in_dir) || die "can't open $in_dir: $!";

while(readdir $dh) {
    next unless /^text[0-9]+.html?$/;
    processFile($_);
}

closedir($dh);

exit(0);
edit flag offensive delete link more

Comments

can't upvote you but thanks!

the_card_cheat gravatar imagethe_card_cheat ( 2014-12-16 20:33:38 +0200 )edit
0

answered 2013-02-27 03:25:49 +0200

ROSt52 gravatar image

@qubit - your answer is what I did not want to read... but I never kill the messenger. I was afraid it is a bug. Thanks for the link of the old bug file. I added information and examples because the suggested workaround does function. Let's keep fingeres crossed that our devs can tackle this issue quickly. It is a rather nasty bug.

edit flag offensive delete link more

Comments

@qubit takes an arrow to the knee... :-)

qubit gravatar imagequbit ( 2013-02-27 03:27:42 +0200 )edit

Question Tools

1 follower

Stats

Asked: 2013-02-26 04:45:08 +0200

Seen: 4,896 times

Last updated: Oct 26 '14