Skip to content

Commit

Permalink
Fix issue #42 (pdDocOpen() crash on Latex file) (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
gwierzchowski authored and sambitdash committed Dec 18, 2018
1 parent 593e5b0 commit d49f38e
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/CosObjStream.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,8 @@ function read_object_info_from_stm(stm::CosStream,
io = util_open(String(filename),"r")
try
for i = 1:n
val = readuntil(io, ' ')
oids[i] = parse(Int,val)
val = readuntil(io, ' ')
oloc[i] = parse(Int,val) + first
oids[i] = convert(Int, parse_unsignednumber(io))
oloc[i] = convert(Int, parse_unsignednumber(io)) + first
end
finally
util_close(io)
Expand Down
Binary file added test/files/outline.pdf
Binary file not shown.
18 changes: 18 additions & 0 deletions test/files/outline.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}

%opening
\title{}
\author{}

\begin{document}

\maketitle

\begin{abstract}

\end{abstract}

\section{}

\end{document}
11 changes: 11 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,17 @@ include("debugIO.jl")
end
end

@testset "LaTeX Document" begin
@test begin
filename="files/outline.pdf"
DEBUG && println(filename)
doc = pdDocOpen(filename)
@assert doc !== nothing
pdDocClose(doc)
length(utilPrintOpenFiles()) == 0
end
end

@testset "PDF File with ObjectStreams" begin
@test begin
filename="files/pdf-17.pdf"
Expand Down

0 comments on commit d49f38e

Please sign in to comment.