package tourplaner.business;

import org.apache.pdfbox.exceptions.COSVisitorException;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPage;
import org.apache.pdfbox.pdmodel.edit.PDPageContentStream;
import org.apache.pdfbox.pdmodel.font.PDFont;
import org.apache.pdfbox.pdmodel.font.PDType1Font;

import java.io.IOException;

public class Reporter {

    public static void createTourReport(String tourname) throws IOException, COSVisitorException {
        PDDocument document = new PDDocument();
        PDPage page = new PDPage();
        document.addPage(page);

        PDFont font = PDType1Font.HELVETICA;
        PDPageContentStream contentStream = new PDPageContentStream(document, page);
        contentStream.beginText();
        contentStream.setFont(font, 12);
        contentStream.moveTextPositionByAmount(100,700);
        contentStream.drawString(tourname);
//        contentStream.drawString();
        contentStream.endText();

        contentStream.close();

        document.save(ConfigHelper.getIniString(ConfigHelper.getStandartConfig(), "report", "path") + "test.pdf");
        document.close();
    }

}
