File tree 4 files changed +39
-5
lines changed
4 files changed +39
-5
lines changed Original file line number Diff line number Diff line change 11
11
class PdfEntry (BaseModel ):
12
12
path : str
13
13
encrypted : bool
14
- producer : str
14
+ producer : str | None
15
15
pages : NonNegativeInt
16
16
images : NonNegativeInt | None
17
17
forms : NonNegativeInt
Original file line number Diff line number Diff line change
1
+ from pypdf import PdfReader , PdfWriter
2
+
3
+ reader = PdfReader ("habibi.pdf" )
4
+ writer = PdfWriter ()
5
+ page = reader .pages [0 ]
6
+
7
+ page .rotate (90 )
8
+
9
+ writer .add_page (page )
10
+
11
+ page .rotate (90 )
12
+
13
+ writer .add_page (page )
14
+
15
+ page .rotate (90 )
16
+
17
+ writer .add_page (page )
18
+
19
+ page .rotate (90 )
20
+
21
+ writer .add_page (page )
22
+
23
+
24
+ with open ("habibi-rotated.pdf" , "wb" ) as fp :
25
+ writer .write (fp )
Original file line number Diff line number Diff line change 162
162
"images" : 0 ,
163
163
"forms" : 0
164
164
},
165
+ {
166
+ "path" : " 015-arabic/habibi-rotated.pdf" ,
167
+ "producer" : " pypdf" ,
168
+ "creation_date" : null ,
169
+ "encrypted" : false ,
170
+ "pages" : 4 ,
171
+ "images" : 0 ,
172
+ "forms" : 0
173
+ },
165
174
{
166
175
"path" : " 015-arabic/habibi-oneline-cmap.pdf" ,
167
176
"producer" : " WeasyPrint 54.1" ,
200
209
},
201
210
{
202
211
"path" : " 019-grayscale-image/grayscale-image.pdf" ,
203
- "producer" : " " ,
204
- "creation_date" : " 2022-09-20T08:15:17 " ,
212
+ "producer" : null ,
213
+ "creation_date" : null ,
205
214
"encrypted" : false ,
206
215
"pages" : 1 ,
207
216
"images" : 1 ,
208
217
"forms" : 0
209
218
},
210
219
{
211
220
"path" : " 020-xmp/output_with_metadata_pymupdf.pdf" ,
212
- "producer" : " " ,
213
- "creation_date" : " 2022-09-20T08:15:17 " ,
221
+ "producer" : null ,
222
+ "creation_date" : " 2023-04-10T07:46:54 " ,
214
223
"encrypted" : false ,
215
224
"pages" : 1 ,
216
225
"images" : 1 ,
You can’t perform that action at this time.
0 commit comments