forked from CoderWanFeng/python-office
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_pdf.py
More file actions
67 lines (54 loc) · 1.98 KB
/
Copy pathtest_pdf.py
File metadata and controls
67 lines (54 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import unittest
from office.api.pdf import *
from tests.test_utils.test_input import stub_stdin
class TestPDF(unittest.TestCase):
def test_add_watermark(self):
stub_stdin(self, './test_files/popdf/in.popdf\npython-office\n') # 依次输入
add_watermark()
def test_add_watermark_by_parameters(self):
add_watermark_by_parameters(
pdf_file=r'./test_files/popdf/in.popdf',
mark_str='python-office',
output_file_name='参数-水印-测试.popdf')
def test_pdf2imgs(self):
pdf2imgs(
pdf_path=r'./test_files/popdf/in.popdf',
out_dir='./images')
def test_pdf2docx(self):
pdf2docx(
file_path=r'./test_files/popdf/in.popdf',
output_path=r'./test_files/popdf/'
)
# def test_file2pdf(self):
# file2pdf(
# file_type='txt',
# path=r'./test_files/popdf/in.popdf',
# )
def test_pdf2docx(self):
pdf2docx(
file_path=r'./test_files/popdf/in.popdf',
output_path=r'./test_files/popdf/'
)
def test_merge2pdf(self):
merge2pdf(
one_by_one=[r'./test_files/popdf/in.popdf', r'./test_files/popdf/add_img.popdf'],
output=r'./test_files/popdf/merge2pdf.popdf'
)
def test_encrypt4pdf(self):
encrypt4pdf(
path=r'D:\workplace\code\github\popdf\tests\test_files\pdf\32012356985422-watermark.popdf',
password='123456'
)
def test_decrypt4pdf(self):
decrypt4pdf(
path=r'./test_files/popdf/encrypt.popdf',
password='123456'
)
def test_pdf2imgs(self):
pdf2imgs(
pdf_path =r'./test_files/popdf/in.popdf',
out_dir=r'./test_files/popdf'
)
def test_add_img_water(self):
add_img_water(pdf_file_in='./test_files/popdf/add_img.popdf', pdf_file_mark='./test_files/popdf/in.popdf',
pdf_file_out='add_img_res.popdf')