-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
69d17dd
commit b8f359b
Showing
4 changed files
with
13 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright 2012-2021 Michael Pozhidaev <[email protected]> | ||
Copyright 2012-2022 Michael Pozhidaev <[email protected]> | ||
This file is part of LUWRAIN. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright 2012-2021 Michael Pozhidaev <[email protected]> | ||
Copyright 2012-2022 Michael Pozhidaev <[email protected]> | ||
Copyright 2015-2016 Roman Volovodov <[email protected]> | ||
This file is part of LUWRAIN. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* | ||
Copyright 2012-2021 Michael Pozhidaev <[email protected]> | ||
Copyright 2012-2022 Michael Pozhidaev <[email protected]> | ||
Copyright 2015-2016 Roman Volovodov <[email protected]> | ||
This file is part of LUWRAIN. | ||
|
@@ -26,7 +26,7 @@ | |
import javafx.scene.paint.Color; | ||
import javafx.scene.image.Image; | ||
import javafx.scene.canvas.GraphicsContext; | ||
//import javafx.embed.swing.SwingFXUtils; | ||
import javafx.embed.swing.SwingFXUtils; | ||
import javafx.application.Platform; | ||
import javafx.beans.value.ObservableValue; | ||
import javafx.concurrent.Worker.State; | ||
|
@@ -59,10 +59,10 @@ abstract class ViewPdf | |
private double offsetX = 0; | ||
private double offsetY = 0; | ||
|
||
ViewPdf(Luwrain luwrain) | ||
ViewPdf(Luwrain luwrain) throws IOException | ||
{ | ||
this.luwrain = luwrain; | ||
this.doc = null;//PDDocument.load(file); | ||
this.doc = PDDocument.load(new File("/tmp/proba.pdf")); | ||
this.rend = new PDFRenderer(doc); | ||
Log.debug(LOG_COMPONENT, "PDF renderer created"); | ||
} | ||
|
@@ -76,7 +76,7 @@ abstract class ViewPdf | |
abstract void announceZoomIn(); | ||
abstract void announceZoomOut(); | ||
|
||
public void show() | ||
void show() | ||
{ | ||
luwrain.showGraphical((control)->{ | ||
try { | ||
|
@@ -89,10 +89,7 @@ public void show() | |
} | ||
catch(Throwable e) | ||
{ | ||
Log.error(LOG_COMPONENT, "unable to initialize the PDF preview:" + e.getClass().getName() + ":" + e.getMessage()); | ||
e.printStackTrace(); | ||
this.canvas = null; | ||
return null; | ||
throw new RuntimeException(e); | ||
} | ||
}); | ||
} | ||
|
@@ -297,7 +294,7 @@ private Image makeImage(int pageNum, float scale) | |
Log.error(LOG_COMPONENT, "unable to render a PDf page:" + e.getClass().getName() + ":" + e.getMessage()); | ||
return null; | ||
} | ||
final Image image = null;//SwingFXUtils.toFXImage(pageImage, null); | ||
final Image image = SwingFXUtils.toFXImage(pageImage, null); | ||
Log.debug(LOG_COMPONENT, "image " + String.format("%.2f", image.getWidth()) + "x" + String.format("%.2f", image.getHeight())); | ||
return image; | ||
} | ||
|