質問編集履歴
2
書式の変更
title
CHANGED
File without changes
|
body
CHANGED
@@ -8,8 +8,10 @@
|
|
8
8
|
STSを使用
|
9
9
|
```
|
10
10
|
### 問題
|
11
|
+
```ここに言語を入力
|
11
12
|
pdfファイルを読み込み、別名で保存するまでは出来たが、文字の追加方法が分からない。
|
12
13
|
|
14
|
+
```
|
13
15
|
### ソース
|
14
16
|
```ここに言語を入力
|
15
17
|
package com.example.demo;
|
1
書式の変更
title
CHANGED
File without changes
|
body
CHANGED
@@ -26,7 +26,7 @@
|
|
26
26
|
|
27
27
|
public class ScanPDF {
|
28
28
|
public static void main(String[] args) {
|
29
|
-
File file = new File("
|
29
|
+
File file = new File("ファイルパス//template.pdf");
|
30
30
|
PDDocument document = new PDDocument();
|
31
31
|
PDPage page = new PDPage();
|
32
32
|
document.addPage(page);
|
@@ -37,7 +37,7 @@
|
|
37
37
|
PDPageContentStream cos= new PDPageContentStream(document, page);
|
38
38
|
PDDocument doc = PDDocument.load(file);
|
39
39
|
|
40
|
-
doc.save("
|
40
|
+
doc.save("ファイルパス//result.pdf");
|
41
41
|
}catch(IOException ex) {
|
42
42
|
ex.printStackTrace();
|
43
43
|
}
|