Skip to content

Commit 7409199

Browse files
committed
Added interactive samples.
1 parent bc52a4f commit 7409199

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,61 @@ function getPDFText(src, out)
125125
end
126126
```
127127

128+
### Interactive Code Examples
129+
130+
One can also execute the following interactive commands on a Julia REPL to access objects of a PDF file.
131+
132+
#### Getting Document Handle
133+
```julia
134+
julia> doc = pdDocOpen("test/sample-google-doc.pdf")
135+
136+
PDDoc ==>
137+
138+
CosDoc ==>
139+
filepath: /home/sambit/.julia/dev/PDFIO/test/sample-google-doc.pdf
140+
size: 21236
141+
hasNativeXRefStm: true
142+
Trailer dictionaries:
143+
144+
Catalog:
145+
4 0 obj
146+
<<
147+
/Pages 14 0 R
148+
/Type /Catalog
149+
>>
150+
endobj
151+
152+
isTagged: none
153+
```
154+
155+
#### Getting Document Info
156+
```
157+
julia> info = pdDocGetInfo(doc)
158+
Dict{String,Union{CDDate, String, CosObject}} with 1 entry:
159+
"Producer" => "Skia/PDF m79"
160+
```
161+
#### Getting the Number of Pages
162+
```
163+
julia> npage = pdDocGetPageCount(doc)
164+
1
165+
```
166+
#### Get the Page Handle
167+
```
168+
julia> page = pdDocGetPage(doc, 1)
169+
PDFIO.PD.PDPageImpl(
170+
...
171+
)
172+
```
173+
#### View Page Text Contents
174+
```
175+
julia> pdPageExtractText(stdout, page);
176+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
177+
labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco
178+
laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
179+
voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
180+
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
181+
```
182+
128183
As can be seen above, granular APIs are provided in `PDFIO` that can be used in combination to achieve a desirable task. For details, please refer to the [Architecture and Design](@ref).
129184

130185
## Features

0 commit comments

Comments
 (0)