Ajout de commentaires (Entêtes + TODO)

This commit is contained in:
LucasV-IUT
2022-02-26 01:21:29 +01:00
parent aa7d72361e
commit 78c209d3f6
22 changed files with 510 additions and 34 deletions
+53 -3
View File
@@ -1,3 +1,9 @@
/*
* PdfLoader.java, 26/02/2022
* IUT Rodez 2021-2022, INFO 2
* pas de copyright, aucun droits
*/
package lecteur_pdf.pdf;
import org.apache.pdfbox.pdmodel.PDDocument;
@@ -7,19 +13,54 @@ import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
/**
* TODO commentaires
*
* @author Léo Franch
* @author Lucas Vabre
* @author Noé Villeneuve
* @author Tristan Nogaret
*/
public class PdfLoader {
/**
* TODO
*/
PDDocument document;
/**
* TODO
*/
PDFRenderer renderer;
/**
* TODO
*
* @param file
* @throws IOException
*/
public PdfLoader(File file) throws IOException {
document = PDDocument.load(file);
renderer = new PDFRenderer(document);
}
/**
* TODO
*
* @return
*/
public int getNbPages() {
return document.getNumberOfPages();
}
/**
* TODO
*
* @param pageIndex
* @param scale
* @return
* @throws IOException
*/
public BufferedImage renderPage(int pageIndex, float scale) throws IOException {
if (pageIndex < 0 || pageIndex >= this.getNbPages()) {
throw new IllegalArgumentException();
@@ -27,17 +68,26 @@ public class PdfLoader {
return renderer.renderImage(pageIndex, scale);
}
/**
* TODO
*/
public void close() {
try {
renderer = null;
document.close();
} catch(IOException ignored) {}
} catch (IOException ignored) {
}
}
/**
* TODO
*
* @param file
*/
public void load(File file) {
try {
document = PDDocument.load(file);
} catch (IOException ignored) {}
} catch (IOException ignored) {
}
}
}