pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andreas Lehmkuehler <andr...@lehmi.de>
Subject Re: PDActionRemoteGoTo with inherit zoom
Date Thu, 26 Jul 2012 05:51:03 GMT
Hi,

Am 22.07.2012 20:44, schrieb Coralie ERAULT:
> Hello,
>
> I'm trying to create external bookmarks with inherit zoom in external PDF
> with the PDActionRemoteGoTo class.
>
> I wrote this piece of code :
>
>
> COSArray ca = new COSArray();
>
> ca.add(COSInteger.*get*(0)); //page number
>
> COSDictionary dico =  *new* COSDictionary();
>
> COSArray ca2 = *new* COSArray();
>
> ca2.add(COSInteger.*get*(0));
>
> ca2.add(COSInteger.*get*(595));
>
> ca2.add(*null*); // zoom factor
>
> dico.setItem("XYZ", ca2);
>
> ca.add(dico);
>
> go.setD(ca);
>
> I'm expecting to have in the PDF file the following line like described  in
> the PDF reference
>
> /D [0  /XYZ 0 595 null]
Everything inside the brackets belongs to an array. The "/XYZ" is a named value 
which can be created by using one of the constants (if present in COSName) or by 
calling COSName.getPDFName("XYZ"). So, just add every single value to the first 
array and use that array as value for "D". You must not create a dictionary in 
this case.


> instead i had :
>
> /S /GoToR
>
> /F (Hello_World2.*pdf*)
>
> */D [0 15 0 R]*
>
>>>
> *
>
> endobj
> *
>
> 14 0 *obj*
> * *
>
> <<
>
> /Type /Font
>
> /*Subtype* /Type1
>
> /BaseFont /*Helvetica*-Bold
>
> /Encoding /WinAnsiEncoding
>
>>>
> *
>
> endobj
> *
>
> 15 0 *obj*
> * *
>
> <<
>
> */XYZ [0 595 null]*
>
>>>
>
> The problem is that the page is opened with a zoom of 6400%.
>
> I tried also
>
> COSArray ca = new COSArray();
>
> ca.add(COSInteger.*get*(0)); //page number
>
> ca.add(COSInteger.*get*(0));
>
> ca.add(null); //zoom
>
>
> How can i specify a zoom factor to open the external link with inherit zoom
> like described in the PDF reference ?
>
>
> [*page */XYZ *left top zoom*] Display the page designated by *page*, with
> the coordinates (*left*, *top*) positioned at the top-left corner of the
> window and the contents of the page magnified by the factor *zoom*. A null
> value for any of the parameters *left*, *top*, or zoom specifies that the
> current value of that parameter is to be retained unchanged. A *zoom *value
> of 0 has the same meaning as a null value. ]
>
>
> Thanks,
> Coralie


BR
Andreas Lehmkühler

Mime
View raw message