Permalink
Browse files

The output to pdf was enabled

  • Loading branch information...
dameninngenn committed Aug 30, 2012
1 parent 60e21b4 commit 5126469041116a6c9cc2c14990ba2a390c57a7b2
Showing with 31 additions and 0 deletions.
  1. +4 −0 README.md
  2. +27 −0 bin/markdown2impress.pl
View
@@ -58,3 +58,7 @@ Command line options
- **--outputdir=.**
Output directory.
- **--outputpdf**
Output to pdf file.
View
@@ -15,13 +15,15 @@
height => 800,
max_column => 5,
outputdir => getcwd(),
outputpdf => 0,
);
GetOptions(
'width=i' => \$opts{ width },
'height=i' => \$opts{ height },
'column=i' => \$opts{ max_column },
'outputdir=s' => \$opts{ outputdir },
'outputpdf' => \$opts{ outputpdf },
);
my $SectionRe = qr{(.+[ \t]*\n[-=]+[ \t]*\n*(?:(?!.+[ \t]*\n[-=]+[ \t]*\n*)(?:.|\n))*)};
@@ -44,6 +46,20 @@
print $outputfile_fh $output;
close $outputfile_fh;
if( $opts{ outputpdf } ) {
output_pdf( $content );
}
sub output_pdf {
my $content = shift;
my $impress_demo_css = get_data_section( 'impress.css' );
my $pdf_css = get_data_section( 'pdf.css' );
$content = sprintf('<style>%s%s</style>%s', $impress_demo_css, $pdf_css, $content);
require PDF::WebKit;
my $kit = PDF::WebKit->new(\$content, page_size => 'Letter', orientation => 'Landscape');
my $output_file = $kit->to_file('./impress.pdf');
}
sub parse_markdown {
my $md = shift;
my $content;
@@ -1049,4 +1065,15 @@ sub output_static_files {
display: block;
}
@@ pdf.css
div.step {
page-break-after: always !important;
}
.step:not(.active) {
opacity: 100;
}
__END__

0 comments on commit 5126469

Please sign in to comment.