Criar livreto PDF

Criar um livreto PDF

Use PdfFileEditor.makeBooklet reorganizar as páginas de um PDF existente em ordem de livreto.

Etapas

  1. Crie uma instância de PdfFileEditor.
  2. Chame makeBooklet com o PDF de origem e o arquivo de saída.
  3. Salve o documento do livreto.
  4. Se quiser verificar o status de retorno, use a variante que devolve booleano e trate um resultado falho.

Exemplo Java

public static void createPdfBooklet(Path inputFile, Path outputFile) {
    PdfFileEditor bookletMaker = new PdfFileEditor();
    bookletMaker.makeBooklet(inputFile.toString(), outputFile.toString());
}

public static void tryCreatePdfBooklet(Path inputFile, Path outputFile) {
    PdfFileEditor bookletMaker = new PdfFileEditor();
    if (!bookletMaker.makeBooklet(inputFile.toString(), outputFile.toString())) {
        System.out.println("Failed to create booklet.");
    }
}