Merge pull request #176 from becoded/bugfix-text-chunk-annotation

Copy action of annotation
This commit is contained in:
Gunnsteinn Hall 2019-10-04 21:05:42 +00:00 committed by GitHub
commit b7dc67705d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 26 additions and 10 deletions

View File

@ -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
git checkout $branch_name
target_branch="development"
if [[ `git ls-remote origin "$build_branch"` ]]; then
target_branch="$build_branch"
fi
git checkout $target_branch
echo "replace github.com/unidoc/unipdf/v3 => $TRAVIS_BUILD_DIR" >> go.mod
./build_examples.sh

2
Jenkinsfile vendored
View File

@ -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(/[\/\.]/, '')

View File

@ -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)

View File

@ -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{
@ -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()...)