// Estrutura do projeto Main.java PdfGeneratorService.java Documento.java

import java.io.FileWriter;
import java.io.IOException;

// Documento.java (modelo)
class Documento {

    private String titulo;
    private String paragrafo;

    public Documento(String titulo, String paragrafo) {
        this.titulo = titulo;
        this.paragrafo = paragrafo;
    }

    public String getTitulo() {
        return titulo;
    }

    public String getParagrafo() {
        return paragrafo;
    }
}

// PdfGeneratorService.java (lógica central)

class PdfGeneratorService {

    public void gerarDocumento(Documento doc) {
        try (FileWriter writer = new FileWriter("documento_simulado.txt")) {

            writer.write("===== DOCUMENTO GERADO =====\n\n");
            writer.write(doc.getTitulo().toUpperCase() + "\n\n");
            writer.write(doc.getParagrafo() + "\n");

            System.out.println("Documento gerado com sucesso!");

        } catch (IOException e) {
            System.out.println("Erro ao gerar documento.");
        }
    }
}

// Main.java
public class Main {
    public static void main(String[] args) {

        Documento doc = new Documento(
            "Relatório Operacional",
            "Este documento representa a base para geração futura de PDFs dinâmicos."
        );

        PdfGeneratorService service = new PdfGeneratorService();
        service.gerarDocumento(doc);
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: