unidoc / unipdf

Golang PDF library for creating and processing PDF files (pure go)
https://unidoc.io
Other
2.56k stars 251 forks source link

[FEATURE] PdfPage.Rotate value always nil #471

Closed DerrickMartinez closed 2 years ago

DerrickMartinez commented 3 years ago

Not sure if this is a bug or a feature... Renaming to feature.

Description

Page rotate value is always Nil if Rotate flag is missing

Expected Behavior

Grab a PDF that's rotated that is missing the Rotate field. If there is no /Rotate field it should calculate the transformation off cm values. But instead it is nil so I think that code must be missing

gunnsth commented 2 years ago

This can happen if the rotation is inherited. To get the effective value, use

// GetRotate gets the inheritable rotate value, either from the page
// or a higher up page/pages struct.
func (p *PdfPage) GetRotate() (int64, error) {