Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server (Not)   Client   Old   Guides
New in version: 5.4   6.0   6.1   6.2   6.3   6.4   6.5   7.0   7.1   7.2    Statistic  


Changes the orientation of the page.

Component: DynaPDF
Version: 3.5
Mac OS X: Yes
Windows: Yes
Server: Yes
FileMaker Cloud: Yes

MBS( "DynaPDF.SetOrientationEx"; PDF; Value )


Parameter Description Example value
PDF The PDF reference returned from DynaPDF.New. $pdf
Value The new roatation value. From -360 to 360 in 90 degree steps. 90


Returns OK or error message.


Changes the orientation of the page.
The function changes the orientation of a page, incl. important page properties such as the width and height, and the coordinate system. The parameter Value must be a multiple of 90 or 0. Positive values rotate the page clockwise, negative values counter clockwise.
The zero point of the coordinate system is set to the upper left or down left point depending on the current page coordinate system (top down or bottom up).
When using a landscape paper format the functions DynaPDF.GetPageWidth and DynaPDF.GetPageHeight return the logical width and height of the page. While the real paper format is not changed the functions return the paper format as if the page would have a landscape paper format (the width and height are exchanged).
The coordinate system is also changed so that you can work with the page as if it were not rotated. Form fields and annotations are automatically rotated with the page; there is no need to rotate them manually.
Pages which are rotated with this function appear in a viewer application always in the right orientation. Also if the page is rotated, e.g. by 180 degrees the page is shown as if it were not rotated.
Since landscape or rotated paper formats require a changed coordinate system, care must be taken into account if further coordinate transformations must be applied. DynaPDF makes sure that one transformation can be applied without causing errors, e.g. rotating or translating the coordinate system, but coordinate transformations must not be nested.
See also DynaPDF.SetOrientation.


Rotate page 1 of current PDF:

Set Variable [$r; Value:MBS("DynaPDF.EditPage"; $pdf; 1)]
Set Variable [$r; Value:MBS("DynaPDF.SetOrientationEx"; $pdf; 180)]
Set Variable [$r; Value:MBS("DynaPDF.EndPage"; $pdf)]

Rotate a PDF to 90°:

Let ([
# start new PDF
PDF = MBS("DynaPDF.New");
# read in existing PDF
OpenResult = MBS("DynaPDF.OpenPDFFromContainer"; PDF; Test::InputPDF);
OpenError = MBS("IsError");
ImportResult = MBS("DynaPDF.ImportPDFFile"; PDF );
ImportError = MBS("IsError");

# edit page and rotate
r = MBS("DynaPDF.EditPage"; PDF; 1) ;
r = MBS("DynaPDF.SetOrientationEx"; PDF; 90) ;
r = MBS("DynaPDF.EndPage"; PDF) ;

# save PDF
OutputPDF = MBS("DynaPDF.Save"; PDF; GetAsText(Test::InputPDF));
SaveError = MBS("IsError");
ReleaseError = MBS("DynaPDF.Release"; PDF);

Result = If(
    // all okay?
    OpenError = 0 and ImportError = 0 and /*rotateError = 0 UND*/ SaveError = 0 and MBS( "Container.GetSize"; OutputPDF; "PDF " ) > 0;
    // than return new PDF
    // return old PDF
result )

See also

DynaPDF.SetOrientation   -   DynaPDF.SetPDFVersion

Feedback: Report problem or ask question.

MBS Realbasic tutorial videos - Pfarrgemeinde Messdiener Nickenich