THBPdf Download Contact Us Buy Online Developerse-mail me

Detect landscape format




Message-ID:<a88ea599-e116-4c56-8e81-9370c881f08b@z1g2000yqn.googlegroups.com>
Subject:

Detect landscape format


Date:Tue, 17 Feb 2009 15:38:02 +0100


Hej volks,

i'm using pdffonts/pdfinfo on my linux box to determine different
properties of a pdf file. The last thing i'm missing is a check for
landscape format. Pdfinfo gives the same page sizes for a normal and a
landscape pdf:

normal.pdf:
Page size:      595.22 x 842 pts (A4)

landscape.pdf:
Page size:      595 x 842 pts (A4)

Anyone a clue how to determine if the file is in landscape format?

Thanks alot,
mowsen




Message-ID:<w-GdnQAaIfr7nwHUnZ2dnUVZ8uOdnZ2d@posted.plusnet>
Subject:

Re: Detect landscape format


Date:Wed, 18 Feb 2009 13:43:18 +0100


mowsen@googlemail.com wrote:
> Hej volks,
> 
> i'm using pdffonts/pdfinfo on my linux box to determine different
> properties of a pdf file. The last thing i'm missing is a check for
> landscape format. Pdfinfo gives the same page sizes for a normal and a
> landscape pdf:
> 
> normal.pdf:
> Page size:      595.22 x 842 pts (A4)
> 
> landscape.pdf:
> Page size:      595 x 842 pts (A4)
> 
> Anyone a clue how to determine if the file is in landscape format?

width > depth works for me :-)

   BugBear




Message-ID:<695d04fa-3e8b-4d40-ba8a-46e1ff21daf7@r41g2000yqm.googlegroups.com>
Subject:

Re: Detect landscape format


Date:Thu, 19 Feb 2009 10:01:22 +0100


> width > depth works for me :-)
>
> =A0 =A0BugBear

what program do you use?





Message-ID:<70695oFn1khqU1@mid.individual.net>
Subject:

Re: Detect landscape format


Date:Fri, 20 Feb 2009 00:43:52 +0100


mowsen@googlemail.com wrote:
>> width > depth works for me :-)
>>
>>    BugBear
> 
> what program do you use?

$ pdfinfo mydoc.pdf | grep 'Page size'
Page size:      612 x 792 pts (letter)

$ pdfinfo mydoc.pdf | grep 'Page size' |\
   awk '{if($3<$5)print "portrait"; else print "landscape"}'
portrait

///Peter




Message-ID:<13c38299-654d-4668-89bb-99f59a2dc90b@f29g2000vbf.googlegroups.com>
Subject:

Re: Detect landscape format


Date:Fri, 20 Feb 2009 13:44:49 +0100


> $ pdfinfo mydoc.pdf | grep 'Page size'
> Page size:      612 x 792 pts (letter)
>
> $ pdfinfo mydoc.pdf | grep 'Page size' |\
>    awk '{if($3<$5)print "portrait"; else print "landscape"}'
> portrait


the wired thing is that pdfinfo gives me wrong dimensions on my sample
landscape.pdf. i assume it gives wrong page sizes when the pdf is
actually not landscape but was rotated 180=B0! my solution is a small
java app with iText as follows which gives the right dimensions:


import java.io.FileOutputStream;


import com.lowagie.text.*;
import com.lowagie.text.pdf.*;


public class CheckSize {

    public static void main(String[] args) {
	try {
	    String readfrom =3D args[0];
	    PdfReader reader =3D new PdfReader(readfrom);
	    System.out.println(reader.getPageSizeWithRotation(1));
	}
	catch (Exception de) {
            de.printStackTrace();
        }
    }
}




Message-ID:<22c6f40e-32e4-4860-93d5-2e7c05cc7a9f@m16g2000vbp.googlegroups.com>
Subject:

Re: Detect landscape format


Date:Fri, 20 Feb 2009 13:45:35 +0100


90=B0 of course.




Message-ID:<ScadnXJwGpf2VwPUnZ2dnUVZ8jCWnZ2d@posted.plusnet>
Subject:

Re: Detect landscape format


Date:Fri, 20 Feb 2009 16:21:15 +0100


mowsen@googlemail.com wrote:
>> $ pdfinfo mydoc.pdf | grep 'Page size'
>> Page size:      612 x 792 pts (letter)
>>
>> $ pdfinfo mydoc.pdf | grep 'Page size' |\
>>    awk '{if($3<$5)print "portrait"; else print "landscape"}'
>> portrait
> 
> 
> the wired thing is that pdfinfo gives me wrong dimensions on my sample
> landscape.pdf. i assume it gives wrong page sizes when the pdf is
> actually not landscape but was rotated 180°! my solution is a small
> java app with iText as follows which gives the right dimensions:

Well, dimensions you want :-)

It's the nice distinction between the document dimensions,
and the "viewed document" dimensions.

It depends wether you consider the viewing parameters
as part *OF* the document, or something which is applied
*TO* the document.

It's not really a right/wrong thing. Both have their uses.

   BugBear




 

|THBPdf| |Download| |Developers|