SetDirectory["C:\\drorbn\\AcademicPensieve\\2013-07"]

DeleteFile["ConciseFastKh.pdf"]

If[FileType["ConciseFastKh.pdf"]===None || (
FileType["ConciseFastKh.pdf"] === File && OrderedQ[{FileDate["ConciseFastKh.pdf"], FileDate["ConciseFastKh.nb"]}]),
Print["Making ConciseFastKh.pdf & ConciseFastKh.png ..."];
nb=Join[
Get["ConciseFastKh.nb"],
Notebook[
PageFooters -> {{None,None,None},{None,None,None}},
PageHeaders -> {{None,None,None},{None,None,None}},
PrintingOptions -> {
"PrintingMargins"->{{0,0},{5,5}},
"EmbedStandardPostScriptFonts"->False
},
StyleDefinitions->Notebook[{
Cell[StyleData[StyleDefinitions->"Default.nb"]],
Cell[
StyleData[All,"Printout"],
ShowSyntaxStyles->True,
Magnification->0.8
]
}]
]];
Export["ConciseFastKh.pdf", nb];
pages=ImageCrop /@ Take[Import["ConciseFastKh.pdf"], 2];
dims=Max/@Transpose[ImageDimensions/@pages];
image=ImageAssemble[pages/.x_Image:>ImageCrop[x,dims,Padding->Automatic]];
Export["ConciseFastKh.png", image];
];

nb=Join[
Get["ConciseFastKh.nb"],
Notebook[
PageFooters -> {{None,None,None},{None,None,None}},
PageHeaders -> {{None,None,None},{None,None,None}},
PrintingOptions -> {
"PrintingMargins"->{{0,0},{5,5}},
"EmbedStandardPostScriptFonts"->False
},
StyleDefinitions->Notebook[{
Cell[StyleData[StyleDefinitions->"Default.nb"]],
Cell[
StyleData[All,"Printout"],
ShowSyntaxStyles->True,
Magnification->0.8
]
}]
]];
Export["ConciseFastKh.pdf", nb];
pages=ImageCrop /@ Take[Import["ConciseFastKh.pdf"], 2];
dims=Max/@Transpose[ImageDimensions/@pages];
image=ImageAssemble[pages/.x_Image:>ImageCrop[x,dims,Padding->Automatic]];
Export["ConciseFastKh.png", image]