SetDisplayMode: Set Initial Display Mode [ 18 ]
Description
This function enables users to specify how the document will appear upon opening it with a PDF Viewer. Two distinct modes may be specified by this function: Zoom level and Layout display. It takes 3 character string parameters:
- zoom: indicates how document page will initially appear upon opening PDF document. Four values are supported:
- fullpage → displays the entire page on screen
- fullwidth → display part of pages using the maximum width of windows
- real → uses real size, which is equivalent to 100% zoom
- default → uses PDF viewer default mode
- layout: indicates how pages will initially appear upon opening PDF document. Four values are supported:
- singlepage → displays pages one by one
- continuous → displays pages contuously
- two → displays 2 pages side by side, on 2 columns
- default → uses PDF viewer default mode
- y_locat: reserved for futur use
C calling syntax
void SetDisplayMode (char *zoom, char *layout, char *y_locat)
Cobol calling syntax
CALL "SetDisplayMode" using by value ZOOM, LAYOUT, Y_LOCAT.
C sample code
#include "fpdf.h" static char f_ini ??(??) = ??< "ini??/??/demofpdf.ini" ??>; static char f_out ??(??) = ??< "pdf??/??/demo_c.pdf" ??>; /* ----------------------------------------------------------------- */ int main (int argc, char *argv []) ??< NewPdfy (f_ini, 1); SetCompression (false); AddPage("P"); SetFont ("Times", "B", 24); Text (20, 25, "FPDF4ZOS for mass production #1"); AddPage("P"); SetFont ("Times", "B", 24); Text (20, 25, "FPDF4ZOS for mass production #2"); SetAuthor ("GMK - inspired by PHP fpdf package"); SetCreator ("Creator for FPDF4ZOS basics"); SetTitle ("Title for FPDF4ZOS basics"); SetSubject ("Subject for FPDF4ZOS basics"); SetKeywords ("FPDF4ZOS,Basics,GMK,Aba,Ima"); SetDisplayMode ("fullpage", "two", "0"); FlushPdf (f_out, 2, "CUSTOMER", "demo_c"); ??>
Cobol sample code
Procedure division. Set Pt0 to Address of T0. Set Pt1 to Address of T1. Set Pt2 to Address of T2. * String 'DD:FINI' Low-Value delimited by size into T0. Move 2 to I. Call "NewPdfy" Using by value Pt0, I returning PdfRC. * Move 0 to FLAG. Call "SetCompression" Using by value FLAG. String 'P' Low-Value delimited by size into T0. Call "AddPage" Using by value Pt0. * Move 20 to W. String 'Arial' Low-Value delimited by size into T0. String 'N' Low-Value delimited by size into T1. Call "SetFont" Using by value Pt0, Pt1, W. * String 'FPDF4ZOS for mass production' Low-Value delimited by size into T0. Move 20 to X. Move 25 to Y. Call "Text" Using by value X, Y, Pt0. * String 'GMK - inspired by PHP fpdf package' Low-Value delimited by size into T0. Call "SetAuthor" Using by value Pt0. String 'Creator for FPDF4ZOS basics' Low-Value delimited by size into T0. Call "SetCreator" Using by value Pt0. String 'Title for FPDF4ZOS basics' Low-Value delimited by size into T0. Call "SetTitle" Using by value Pt0. String 'Subject for FPDF4ZOS basics' Low-Value delimited by size into T0. Call "SetSubject" Using by value Pt0. String 'FPDF4ZOS,Basics,GMK,Aba,Ima' Low-Value delimited by size into T0. Call "SetKeywords" Using by value Pt0. * String 'fullpage' Low-Value delimited by size into T0. String 'two' Low-Value delimited by size into T1. String '0' Low-Value delimited by size into T2. Call "SetDisplayMode" Using by value Pt0,Pt1,Pt2. * Move 2 to Flag. String 'DD:FOUT' Low-Value delimited by size into T0. String 'CUSTOMER' Low-Value delimited by size into T1. String 'DEMOCBL0' Low-Value delimited by size into T2. Call "FlushPdf" using by value Pt0, FLAG, Pt1, Pt2 *
Description of sample code
This piece of code illustrates the properties setting functions found in FPDF4ZOS interface. It opens a PDF context, inserts a page, configures a font, writes a short string, set miscellanous properties of document and flushes result on a PDF file. - NewPdfy() --> Initialisation of a pdf context - AddPage() --> As it says - SetFont() --> set current font - Text() --> Write a piece of Text at position [x,y] - SetCompression() --> Instructs that PDF streams will not be compressed - SetAuthor() --> Set Author property within PDF document - SetSubject() --> Set Subject property within PDF document - SetCreator() --> Set Creator property within PDF document - SetTitle() --> Set Title property within PDF document - SetKeywords() --> Set Keywords property within PDF document - SetDisplayMode() --> Set Initial display behavior upon opening the PDF document - FlushPdf() --> Output PDF file taking into account all the instructions invoked since NewPdfy or previous FlushPdf
See sample source code in 'C' as well as PDF execution result - NB: For encrypted PDFs, user password is USER-PSWD