- if len(args) > 1:
- pdf.transform(provider, slug, output_file=args[1], verbose=options.verbose, save_tex=options.save_tex)
- else:
- pdf.transform(provider, slug, output_dir=path, make_dir=options.make_dir, verbose=options.verbose, save_tex=options.save_tex)
+ for main_input in args:
+ path, fname = os.path.realpath(main_input).rsplit('/', 1)
+ provider = DirDocProvider(path)
+ output_file, output_dir = options.output_file, options.output_dir
+ if not (options.output_file or options.output_dir):
+ output_file = os.path.splitext(main_input)[0] + '.pdf'
+ else:
+ output_file = None
+
+ doc = WLDocument.from_file(main_input, provider=provider)
+ pdf = doc.as_pdf(save_tex=options.save_tex,
+ cover=options.with_cover,
+ morefloats=options.morefloats)
+
+ doc.save_output_file(pdf,
+ output_file, options.output_dir, options.make_dir, 'pdf')