Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand document information dictionary - v3 branch #408

Merged
merged 11 commits into from
Apr 14, 2019

Conversation

becoded
Copy link

@becoded becoded commented Apr 9, 2019

No description provided.

@gunnsth
Copy link
Contributor

gunnsth commented Apr 9, 2019

Failing build with error:

=== RUN   TestCreatorStable
[DEBUG]  ttfparser.go:527 parseCmapVersion: format=0 length=262 language=0
[DEBUG]  ttfparser.go:130 No rune. code=0x001d glyph="glyph1"
[DEBUG]  ttfparser.go:130 No rune. code=0x0000 glyph="glyph1"
[DEBUG]  ttfparser.go:130 No rune. code=0x000d glyph="glyph1"
[DEBUG]  ttfparser.go:130 No rune. code=0x0008 glyph="glyph1"
Unlicensed copy of unidoc
To get rid of the watermark - Please get a license on https://unidoc.io
[DEBUG]  ttfparser.go:527 parseCmapVersion: format=0 length=262 language=0
[DEBUG]  ttfparser.go:130 No rune. code=0x0000 glyph="glyph1"
[DEBUG]  ttfparser.go:130 No rune. code=0x001d glyph="glyph1"
[DEBUG]  ttfparser.go:130 No rune. code=0x000d glyph="glyph1"
[DEBUG]  ttfparser.go:130 No rune. code=0x0008 glyph="glyph1"
Unlicensed copy of unidoc
To get rid of the watermark - Please get a license on https://unidoc.io
--- FAIL: TestCreatorStable (1.13s)
    creator_test.go:2997: output is not stable

I guess because of the timestamp? Although presumably the timestamp is initialized at the package load time.

@codecov
Copy link

codecov bot commented Apr 9, 2019

Codecov Report

Merging #408 into v3 will increase coverage by 5.41%.
The diff coverage is 70.42%.

Impacted file tree graph

@@            Coverage Diff             @@
##               v3     #408      +/-   ##
==========================================
+ Coverage   55.63%   61.05%   +5.41%     
==========================================
  Files         153      153              
  Lines       27531    27597      +66     
==========================================
+ Hits        15318    16849    +1531     
- Misses      10345    10364      +19     
+ Partials     1868      384    -1484
Impacted Files Coverage Δ
pdf/model/structures.go 83.52% <100%> (+12.1%) ⬆️
pdf/model/writer.go 81.12% <62.5%> (+3.41%) ⬆️
pdf/annotator/field_appearance.go 11.62% <0%> (+0.75%) ⬆️
pdf/creator/division.go 89.13% <0%> (+1.08%) ⬆️
pdf/model/outline.go 86.74% <0%> (+1.2%) ⬆️
pdf/creator/invoice.go 90.07% <0%> (+1.21%) ⬆️
pdf/model/sighandler/sighandler_rsa_sha1.go 6.75% <0%> (+1.35%) ⬆️
pdf/annotator/form_field.go 14.78% <0%> (+1.4%) ⬆️
pdf/internal/ccittfax/decode.go 94.73% <0%> (+1.5%) ⬆️
pdf/creator/toc_line.go 75.39% <0%> (+1.58%) ⬆️
... and 96 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 852b515...d37cfb7. Read the comment docs.

@gunnsth gunnsth requested a review from adrg April 9, 2019 22:17
@adrg
Copy link
Collaborator

adrg commented Apr 10, 2019

@gunnsth It does not seem to be the dates. However, I do think it might be better to not initialize those fields by default to the current time. I'll check to see what is the issue.

var pdfAuthor = ""
var pdfCreator = ""
var pdfKeywords = ""
var pdfProducer = ""
var pdfSubject = ""
var pdfTitle = ""
var pdfCreationDate time.Time
var pdfModifiedDate time.Time
	// Set creation and modified dates.
	if creationDate := getPdfCreationDate(); !creationDate.IsZero() {
		if cd, err := NewPdfDateFromTime(creationDate); err == nil {
			infoDict.Set("CreationDate", cd.ToPdfObject())
		}
	}
	if modifiedDate := getPdfModifiedDate(); !modifiedDate.IsZero() {
		if md, err := NewPdfDateFromTime(modifiedDate); err == nil {
			infoDict.Set("ModDate", md.ToPdfObject())
		}
	}

Copy link
Collaborator

@adrg adrg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a couple of observations. Please see the comment about the usage of the map which is the cause for the build failure.

pdf/model/writer.go Outdated Show resolved Hide resolved
pdf/model/writer.go Outdated Show resolved Hide resolved
pdf/model/writer.go Outdated Show resolved Hide resolved
Copy link
Collaborator

@adrg adrg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@gunnsth gunnsth merged commit 1433f04 into unidoc:v3 Apr 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants