Skip to content

Commit

Permalink
Merge pull request #176 from becoded/bugfix-text-chunk-annotation
Browse files Browse the repository at this point in the history
Copy action of annotation
  • Loading branch information
gunnsth authored Oct 4, 2019
2 parents b063d02 + 2995ee5 commit b7dc677
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 10 deletions.
16 changes: 12 additions & 4 deletions .travis/build_examples.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@ repo_path="$HOME/projects/unipdf-examples"
git clone https://github.com/unidoc/unipdf-examples.git $repo_path
cd $repo_path

branch_name="v3"
if [[ `git ls-remote origin "$TRAVIS_BRANCH"` ]]; then
branch_name="$TRAVIS_BRANCH"
build_branch="$TRAVIS_BRANCH"
if [[ -n "$TRAVIS_PULL_REQUEST_BRANCH" ]]; then
build_branch="$TRAVIS_PULL_REQUEST_BRANCH"
fi
if [[ -z "$build_branch" ]]; then
build_branch="development"
fi

target_branch="development"
if [[ `git ls-remote origin "$build_branch"` ]]; then
target_branch="$build_branch"
fi

git checkout $branch_name
git checkout $target_branch
echo "replace github.com/unidoc/unipdf/v3 => $TRAVIS_BUILD_DIR" >> go.mod
./build_examples.sh
2 changes: 1 addition & 1 deletion Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ node {
sh("printenv")

// Pull unipdf-examples from connected branch, or master otherwise.
def examplesBranch = "v3"
def examplesBranch = "development"

// Check if connected branch is defined explicitly.
def safeName = env.BRANCH_NAME.replaceAll(/[\/\.]/, '')
Expand Down
10 changes: 5 additions & 5 deletions common/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ import (
)

const releaseYear = 2019
const releaseMonth = 8
const releaseDay = 4
const releaseHour = 11
const releaseMin = 40
const releaseMonth = 9
const releaseDay = 7
const releaseHour = 13
const releaseMin = 10

// Version holds version information, when bumping this make sure to bump the released at stamp also.
const Version = "3.1.1"
const Version = "3.2.0"

var ReleasedAt = time.Date(releaseYear, releaseMonth, releaseDay, releaseHour, releaseMin, 0, 0, time.UTC)
8 changes: 8 additions & 0 deletions creator/text_chunk.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ type TextChunk struct {
annotationProcessed bool
}

// SetAnnotation sets a annotation on a TextChunk.
func (tc *TextChunk) SetAnnotation(annotation *model.PdfAnnotation) {
tc.annotation = annotation
}

// newTextChunk returns a new text chunk instance.
func newTextChunk(text string, style TextStyle) *TextChunk {
return &TextChunk{
Expand Down Expand Up @@ -85,6 +90,9 @@ func copyLinkAnnotation(link *model.PdfAnnotationLink) *model.PdfAnnotationLink
annotation := model.NewPdfAnnotationLink()
annotation.BS = link.BS
annotation.A = link.A
if action, err := link.GetAction(); err == nil && action != nil {
annotation.SetAction(action)
}

if annotDest, ok := link.Dest.(*core.PdfObjectArray); ok {
annotation.Dest = core.MakeArray(annotDest.Elements()...)
Expand Down

0 comments on commit b7dc677

Please sign in to comment.