Skip to content

Commit

Permalink
make pdfinfo format optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Loipfuehrer committed Feb 22, 2020
1 parent cc05f43 commit ca388fb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/print/calc.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ var (
ErrInvalidFormat = errors.New("invalid format")
ErrPasswordRequired = errors.New("password required")
ErrInvalidPdfinfo = errors.New("invalid pdf info output")
pageSizeRegex = regexp.MustCompile(`^Page size:\s+(?P<width>\d+\.?\d*) x (?P<height>\d+\.?\d*) pts \((?P<format>\w+)\).*$`)
pageSizeRegex = regexp.MustCompile(`^Page size:\s+(?P<width>\d+\.?\d*) x (?P<height>\d+\.?\d*) pts( \((?P<format>\w+)\))?.*$`)
)

func pdfInfo(j *Job) {
Expand Down Expand Up @@ -138,7 +138,9 @@ func pdfInfo(j *Job) {
j.Rotated = true
}

j.Format = match[3]
if len(match) > 3 {
j.Format = match[3]
}
}
/*case 'E':
if bytes.Compare(line[:10], []byte("Encrypted:")) == 0 {
Expand Down

0 comments on commit ca388fb

Please sign in to comment.