How to find if PDF has orientation or portrait

Are there tools to determine if a PDF has a landscape or portrait orientation?

I am currently looking at pdfbox and Itext , but it seems I could not find it. Tell me if they support it.

Retrieving PDF information using Origami provides information that PDF pages have some rotation. Here is what Origami reports:

{:Parent=>#<PDF::Reader::Reference:0x872349c @id=8, @gen=0>, :Type=>:Page, 
 :Contents=>#<PDF::Reader::Reference:0x8722f24 @id=4, @gen=0>, :Resources=># <PDF::Reader::Reference:0x870dbd8 @id=2, @gen=0>, 
:MediaBox=>[0, 0, 612, 792], :Rotate=>270}

Turn: 270

What does rotation mean?

+3
source share
1 answer

pdfinfo MediumBox, CropBox, BleedBox, ArtBox TrimBox . 2 4 :

pdfinfo -box -f 2 -l 4 sample.pdf
  Creator:        FrameMaker 6.0
  Producer:       Acrobat Distiller 5.0.5 (Windows)
  CreationDate:   Thu Aug 17 16:43:06 2006
  ModDate:        Tue Aug 22 12:20:24 2006
  Tagged:         no
  Form:           AcroForm
  Pages:          146
  Encrypted:      no
  Page    2 size: 419.535 x 297.644 pts
  Page    2 rot:  90
  Page    3 size: 297.646 x 419.524 pts
  Page    3 rot:  0
  Page    4 size: 297.646 x 419.524 pts
  Page    4 rot:  0
  Page    2 MediaBox:     0.00     0.00   595.00   842.00
  Page    2 CropBox:     87.25   430.36   506.79   728.00
  Page    2 BleedBox:    87.25   430.36   506.79   728.00
  Page    2 TrimBox:     87.25   430.36   506.79   728.00
  Page    2 ArtBox:      87.25   430.36   506.79   728.00
  Page    3 MediaBox:     0.00     0.00   595.00   842.00
  Page    3 CropBox:    148.17   210.76   445.81   630.28
  Page    3 BleedBox:   148.17   210.76   445.81   630.28
  Page    3 TrimBox:    148.17   210.76   445.81   630.28
  Page    3 ArtBox:     148.17   210.76   445.81   630.28
  Page    4 MediaBox:     0.00     0.00   595.00   842.00
  Page    4 CropBox:    148.17   210.76   445.81   630.28
  Page    4 BleedBox:   148.17   210.76   445.81   630.28
  Page    4 TrimBox:    148.17   210.76   445.81   630.28
  Page    4 ArtBox:     148.17   210.76   445.81   630.28
  Page    4 MediaBox:     0.00     0.00   595.00   842.00
  File size:      6888764 bytes
  Optimized:      yes
  PDF version:    1.4

:

  • *Box : 4 , PostScript: , .

  • MediaBox: PDF.

  • TrimBox: , MediaBox, . MediaBox, PDF ( ) .

  • Page size: + , TrimBox.

  • rot: . 0, 90, 180 270 .

:

  • "", .
  • "", .
  • , .

!,....

  • ... /Rotation PDF ( pdfinfo rot: info) , PDF- "" ;

  • ... "" /TrimBox inside a 'portrait' shaped/MediaBox` , , "" " " "( ) ...

? , . , "" "" . , ...

+8

Source: https://habr.com/ru/post/1718397/


All Articles