SetCompression: Set stream compression mode [ 17 ]
Description
Instructs PDF engine whether the streams which will be created should be compressed or not. This function takes one integer parameter which is a true or false value. True means streams will be compressed while false means they will NOT be compressed.
Developper Notes:
- By default, PDF streams are systematically compressed to lower their volumes.
- It is a rare occurence to come across uncompressed streams within PDF files. However, this possibility comes handy when a specific point should be checked. In fact, the engine reads a default value in the configuration file which is systematically taken into account when a PDF context is created by means of NewPdfy() function and this function enables the program to override this initial value.
C calling syntax
void SetCompression (int flag)
Cobol calling syntax
Call "SetCompression" using by value FLAG
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