mirror of
https://github.com/LucasVbr/LecteurPdfDoubleAffichage.git
synced 2026-07-09 12:47:45 +00:00
Ajout commentaires PDF, Page et Fenêtre
Modification recharger/charger => charger uniquement Ajout affichage Vertical/Horizontal Methodes de Tests pour Page et Fenêtre
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
package lecteur_pdf.affichage;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
class FenetreTest {
|
||||
|
||||
// TODO
|
||||
|
||||
/**
|
||||
* Lance les methodes de tests
|
||||
*
|
||||
* @param args non utilisé
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
new Fenetre();
|
||||
}
|
||||
}
|
||||
@@ -1,33 +1,14 @@
|
||||
package lecteur_pdf.document;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
|
||||
class PDFTest {
|
||||
|
||||
/**
|
||||
* TODO comment main
|
||||
* Lance les methodes de tests
|
||||
*
|
||||
* @param args
|
||||
* @param args non utilisé
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
JFrame frame = new JFrame();
|
||||
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
frame.setLocationRelativeTo(null);
|
||||
|
||||
frame.setSize(300,300);
|
||||
frame.setBackground(Color.gray);
|
||||
frame.setVisible(true);
|
||||
|
||||
//PDF doc = new PDF(new File("C:/Users/public/test.pdf"));
|
||||
|
||||
//JScrollPane scrollPane = new JScrollPane(doc);
|
||||
//scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
//scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
|
||||
//frame.add(scrollPane);
|
||||
frame.validate();
|
||||
// TODO
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,32 +3,49 @@ package lecteur_pdf.document;
|
||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
class PageTest {
|
||||
|
||||
public static void testPage() {
|
||||
try {
|
||||
PDDocument document = PDDocument.load(
|
||||
new File("Documents_PDF/paysage_35pages.pdf"));
|
||||
JFrame frame = new JFrame();
|
||||
frame.setVisible(true);
|
||||
frame.add(new Page(document, 0, 1.0f));
|
||||
frame.pack();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void testPageZoom() {
|
||||
try {
|
||||
PDDocument document = PDDocument.load(
|
||||
new File("Documents_PDF/paysage_35pages.pdf"));
|
||||
JFrame frame = new JFrame();
|
||||
frame.setVisible(true);
|
||||
frame.add(new Page(document, 0, 2.0f));
|
||||
frame.pack();
|
||||
|
||||
JFrame frame2 = new JFrame();
|
||||
frame2.setVisible(true);
|
||||
frame2.add(new Page(document, 0, 0.5f));
|
||||
frame2.pack();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test du constructeur {@link Page#Page(PDDocument, int)}
|
||||
* Lance les methodes de tests
|
||||
*
|
||||
* @param args non utilisé
|
||||
*/
|
||||
public static void main(String[] args) throws IOException {
|
||||
/* Mise en place du JFrame de test */
|
||||
JFrame frame = new JFrame();
|
||||
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
frame.setLocationRelativeTo(null);
|
||||
frame.setSize(300, 300);
|
||||
frame.setBackground(Color.gray);
|
||||
frame.setVisible(true);
|
||||
|
||||
/* Creation de l’objet Page */
|
||||
PDDocument document = PDDocument.load(new File("F:/paysage_35pages.pdf"));
|
||||
Page page = new Page(document, 0);
|
||||
|
||||
/* Ajout de l’objet dans la frame et mise à jour de la frame */
|
||||
// frame.add(page);
|
||||
frame.validate();
|
||||
public static void main(String[] args) {
|
||||
testPage();
|
||||
testPageZoom();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user