Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
pdf2pptx
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guanzixin
pdf2pptx
Commits
08b93ec1
Commit
08b93ec1
authored
Jul 11, 2019
by
guanguan1009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
75e2c147
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
+20
-3
src/main/java/com/jtyjy/pdf2pptx/converter/Pdf2Pptx.java
+19
-2
src/main/java/com/jtyjy/pdf2pptx/support/MyTask.java
+1
-1
No files found.
src/main/java/com/jtyjy/pdf2pptx/converter/Pdf2Pptx.java
View file @
08b93ec1
...
...
@@ -93,7 +93,11 @@ public class Pdf2Pptx {
executorService
.
execute
(
new
PdfTask
(
allot
.
get
(
String
.
valueOf
(
i
)),
path
));
}
}
try
{
Thread
.
sleep
(
2000
);
}
catch
(
InterruptedException
e
)
{
logger
.
error
(
"错误:{}"
,
e
);
}
while
(
exeFlag
)
{
if
(((
ThreadPoolExecutor
)
executorService
).
getActiveCount
()
==
0
)
{
executorService
.
shutdown
();
...
...
@@ -104,7 +108,12 @@ public class Pdf2Pptx {
}
long
endTime
=
System
.
currentTimeMillis
();
logger
.
info
(
"总耗时:{}ms"
,
endTime
-
startTime
);
//删除图片文件夹
//删除所有生成的图片文件
for
(
String
dirPathName
:
allDirPathName
)
{
if
(
dirPathName
.
endsWith
(
"_图片"
)
&&
FileUtil
.
delFolder
(
dirPathName
))
{
logger
.
info
(
"删除文件夹:{}及其文件成功"
,
dirPathName
);
}
}
}
...
...
@@ -138,6 +147,14 @@ public class Pdf2Pptx {
public
static
void
main
(
String
[]
args
)
{
//读取指定文件夹下所有文件并转换为图片
// conver(Constant.SOURCE_PATH);
//删除所有生成的图片文件
List
<
String
>
allDirPathName
=
new
ArrayList
<>();
FileUtil
.
getAllDirPathNameRe
(
Constant
.
SOURCE_PATH
,
allDirPathName
);
for
(
String
dirPathName
:
allDirPathName
)
{
if
(
dirPathName
.
endsWith
(
"_图片"
)
&&
FileUtil
.
delFolder
(
dirPathName
))
{
logger
.
info
(
"删除文件夹:{}及其文件成功"
,
dirPathName
);
}
}
}
}
src/main/java/com/jtyjy/pdf2pptx/support/MyTask.java
View file @
08b93ec1
...
...
@@ -40,7 +40,7 @@ public class MyTask implements Runnable {
imgFilePath
.
append
(
String
.
valueOf
(
i
+
1
));
imgFilePath
.
append
(
".png"
);
File
dstFile
=
new
File
(
imgFilePath
.
toString
());
BufferedImage
image
=
renderer
.
renderImageWithDPI
(
i
,
30
0
);
BufferedImage
image
=
renderer
.
renderImageWithDPI
(
i
,
25
0
);
logger
.
info
(
"线程:{} 开始转换第{}页pdf"
,
Thread
.
currentThread
().
getName
(),
i
);
ImageIO
.
write
(
image
,
"png"
,
dstFile
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment