File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ # This has very limited methods created to use the PDFIO functionality for
2
+ # testing and quick prototyping. While you can use them to get some of the
3
+ # regular testing these are not currently part of the core library.
4
+
5
+ using PDFIO
6
+ using PDFIO. Common
7
+ using PDFIO. Cos
8
+ using PDFIO. PD
9
+
10
+ function pdfhlp_extract_doc_content_to_dir (filename,dir= tempdir ())
11
+ file= rsplit (filename, ' /' ,limit= 2 )
12
+ filenm= file[end ]
13
+ dirpath= joinpath (dir,filenm)
14
+ if isdir (dirpath)
15
+ rm (dirpath; force= true , recursive= true )
16
+ end
17
+ mkdir (dirpath)
18
+ doc= pdDocOpen (filename)
19
+ try
20
+ npage= pdDocGetPageCount (doc)
21
+ for i= 1 : npage
22
+ page = pdDocGetPage (doc, i)
23
+ if pdPageIsEmpty (page)== false
24
+ contents= pdPageGetContents (page)
25
+ bufstm = get (contents)
26
+ buf = read (bufstm)
27
+ close (bufstm)
28
+ path= joinpath (dirpath,string (i)* " .txt" )
29
+ write (path, buf)
30
+ end
31
+ end
32
+ finally
33
+ pdDocClose (doc)
34
+ end
35
+ end
You can’t perform that action at this time.
0 commit comments