0

Get orientation from Media object

asked 2022-05-31 00:27:16 +0800

softteam gravatar image softteam
130 1 8

Hi,

Is it there any way to get the orientation (portrait or landscape) from a Media object?

We call Fileupload.get() and we would like to know the orientation of this Media object.

Thank you,

Javier

delete flag offensive retag edit

4 Answers

Sort by ยป oldest newest most voted
0

answered 2022-06-15 14:37:59 +0800

MDuchemin gravatar image MDuchemin
2560 1 6
ZK Team

Hey there,

In that case, you would need to use a dedicated PDF library, such iText, openPDF or other similiar "service side PDF handling library".

I expect that most PDF libraries would have the ability to give you the document format, or failing that, the page width and page height for you to compare.

Just a warning there: while most user will generate PDFs using a standard print paper format (usually A4), there is no spec in PDF that says they have to use a standard format.

You could create a 1px by 1px pdf containing a black dot, and it would be a valid PDF file. That's probably an edge case, but you should be aware of that in advance :D

link publish delete flag offensive edit
0

answered 2022-06-09 22:49:29 +0800

softteam gravatar image softteam
130 1 8

Hi, any ideas?

Thank you! Javier

link publish delete flag offensive edit
0

answered 2022-06-10 12:34:04 +0800

MDuchemin gravatar image MDuchemin
2560 1 6
ZK Team

Hi there,

The media you receive at the end of fileupload is just a wrapper for the byte content of the upload, with a few meta-data provided by the browser upload (name, size, extension, etc).

The orientation is not part of that metadata. It's also only applicable to a few file types.

If you need that information, you may need to read the file content at server-side, and retrieve the orientation from the file content itself.

What type files do you want to retrieve the orientation for? (image, pdf, word, etc?)

link publish delete flag offensive edit
0

answered 2022-06-14 22:04:42 +0800

softteam gravatar image softteam
130 1 8

Hi,

I want to retrieve the orientation for pdf files.

Thank you,

Javier

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2022-05-31 00:27:16 +0800

Seen: 14 times

Last updated: Jun 15 '22

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More