javaasciidoctorasciidoctor-pdf

Asciidoctor convert multiple adocs to a pdf


I'm using asciidoctorj in a test method to produce my pdfs

@Test
public void bAdocToPdf() throws Exception {

    Asciidoctor asciidoctor = create();
    Options options = new Options();

    options.setBackend("pdf");
    String[] result = asciidoctor.convertDirectory(new AsciiDocDirectoryWalker("src/docs/generated"),options);


}

will produce a pdf for each file but i want them all to be in one pdf, how would i go about this?

I'm using asasciidoctorj version 1.5.4 and asciidoctorj-pdf version 1.5.0-alpha.11


Solution

  • Why not:

    1) Write (if not too long) or generate in your code a "MyUniqueDoc.adoc" file with a series of include directives of all your files

    = My unique doc
    
    include::./src/docs/generated/filea.adoc[leveloffset=+1]
    include::./src/docs/generated/fileb.adoc[leveloffset=+1]
    etc
    

    2) Produce a unique pdf from MyUniqueDoc.adoc