Skip to content

Commit 13e448d

Browse files
committed
Adding changes and test cases for better coverage.
1 parent 7d79d9c commit 13e448d

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

A1947-15.txt

4.55 KB
Binary file not shown.

src/PDPageElement.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,8 @@ showtext(io::IO, pdo::PDPageTextObject, state::Dict=Dict()) = showtext(io, pdo.g
486486
function showtext(io::IO, pdo::PDPageMarkedContent, state::Dict)
487487
tag = pdo.group.objs[1].operands[1] # can be used for XML tagging.
488488
showtext(io, pdo.group, state)
489-
write(io, '\n')
489+
print(io, '\n')
490+
return io
490491
end
491492

492493
function showtext(io::IO, pdo::PDPageElement, state::Dict=Dict())

test/runtests.jl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,29 @@ include("debugIO.jl")
6767
end
6868

6969
@testset "Hybrid x-ref" begin
70+
@test begin
71+
filename="A1947-15.pdf"
72+
DEBUG && println(filename)
73+
isfile(filename)||
74+
download("http://lawmin.nic.in/ld/P-ACT/1947/A1947-15.pdf",filename)
75+
doc = pdDocOpen(filename)
76+
try
77+
npage= pdDocGetPageCount(doc)
78+
for i=1:npage
79+
page = pdDocGetPage(doc, i)
80+
if pdPageIsEmpty(page) == false
81+
pdPageGetContentObjects(page)
82+
pdPageExtractText(IOBuffer(), page)
83+
end
84+
end
85+
finally
86+
pdDocClose(doc)
87+
end
88+
length(utilPrintOpenFiles()) == 0
89+
end
90+
end
91+
92+
@testset "Corrupt File" begin
7093
@test begin
7194
filename="A1947-14.pdf"
7295
DEBUG && println(filename)
@@ -89,6 +112,7 @@ include("debugIO.jl")
89112
end
90113
end
91114

115+
92116
@testset "Test RunLengthDecode" begin
93117
@test begin
94118
filename="582.pdf"

0 commit comments

Comments
 (0)