pdf-bookmark
pdf-bookmark copied to clipboard
获取网页目录乱码和无法生成C++Primer.Plus(第6版)中文版.pdf目录
点击生成目录没有任何反应,请作者指导
使用 release 确实有这个问题。 可以试试直接在IntelliJ IDEA跑代码,我这边试了没问题可以用。
同在线获取目录乱码,测试页面为 http://product.china-pub.com/195631 自己编译的版本
- macOS 11.2.3
- java 15.0.2
- Gradle 6.8.3
macOS 下乱码的原因是JavaFX获取系统默认字体时出现了问题,具体原因还不得而知,解决方法如下:
- 先在
pdf-bookmark
目录下添加resources
文件夹 - 在
resources
目录下新建application.css
:
.root{
-fx-font-size: 16pt;
-fx-font-family: "Courier New";
-fx-base: rgb(132, 145, 47);
-fx-background: rgb(225, 228, 203);
}
- 修改
pdf-bookmark/src/main/java/com/ifnoelse/pdf/gui/Main.java
:
Scene scene = new Scene(vBox, 600, 400);
scene.getStylesheets().add("application.css"); //添加内容
primaryStage.setScene(scene);
- 修改
build.gradle
,最后面添加:
processResources {
from('resources') {
include 'application.css'
}
}
- 重新运行:
./gradlew jlink
macOS 下乱码的原因是JavaFX获取系统默认字体时出现了问题,具体原因还不得而知,解决方法如下:
- 先在
pdf-bookmark
目录下添加resources
文件夹- 在
resources
目录下新建application.css
:.root{ -fx-font-size: 16pt; -fx-font-family: "Courier New"; -fx-base: rgb(132, 145, 47); -fx-background: rgb(225, 228, 203); }
- 修改
pdf-bookmark/src/main/java/com/ifnoelse/pdf/gui/Main.java
:Scene scene = new Scene(vBox, 600, 400); scene.getStylesheets().add("application.css"); //添加内容 primaryStage.setScene(scene);
- 修改
build.gradle
,最后面添加:processResources { from('resources') { include 'application.css' } }
- 重新运行:
./gradlew jlink
第五步运行错误
- What went wrong:
A problem was found with the configuration of task ':jlink' (type 'JlinkTask').
-
In plugin 'org.beryx.jlink' type 'org.beryx.jlink.JlinkTask' property 'imageDirAsFile' is annotated with @PathSensitive but that is not allowed for 'OutputDirectory' properties.
Reason: This modifier is used in conjunction with a property of type 'OutputDirectory' but this doesn't have semantics.
Possible solution: Remove the '@PathSensitive' annotation.
Please refer to https://docs.gradle.org/7.4.2/userguide/validation_problems.html#incompatible_annotations for more details about this problem.
-