Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
L
lab4
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
9731013
lab4
Commits
9fd1cdfb
Commit
9fd1cdfb
authored
Mar 10, 2019
by
9731013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add writing
parent
fe6dbd5d
Pipeline
#319
failed with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
10 deletions
+20
-10
a.java
a.java
+20
-10
No files found.
a.java
View file @
9fd1cdfb
import
com.itextpdf.text.pdf.PdfReader
;
import
java.io.File
;
import
com.itextpdf.text.pdf.parser.PdfTextExtractor
;
import
java.io.FileOutputStream
;
import
java.io.OutputStream
;
import
com.itextpdf.text.Document
;
import
com.itextpdf.text.Paragraph
;
import
com.itextpdf.text.pdf.PdfWriter
;
public
class
a
{
public
class
a
{
public
static
void
main
(
String
args
[]){
public
static
void
main
(
String
args
[]){
try
{
try
{
PdfReader
pdfReader
=
new
PdfReader
(
"a.pdf"
);
Document
doc
=
new
Document
();
int
cnt
=
pdfReader
.
getNumberOfPages
();
for
(
int
i
=
1
;
i
<=
cnt
;
i
++){
OutputStream
ostream
=
new
FileOutputStream
(
new
File
(
"b.pdf"
));
String
str
=
PdfTextExtractor
.
getTextFromPage
(
pdfReader
,
i
);
System
.
out
.
println
(
str
);
PdfWriter
.
getInstance
(
doc
,
ostream
);
}
doc
.
open
();
doc
.
add
(
new
Paragraph
(
"salam salam"
));
doc
.
close
();
ostream
.
close
();
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
System
.
out
.
println
(
e
.
getMessage
());
System
.
out
.
println
(
e
.
getMessage
());
}
}
...
...
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