# IPI_ImageToPageSegment() This subprocedure is used to convert an image which was previously loaded by [IPI_LoadImage()](https://isupport.katointegrations.com/ipi/ipi_loadimage.md) into a page segment (*PAGSEG) which can be used with AFPDS printing on the IBM i. The dimensions of the page segment being created can be specified in inches using the Width and Height subfields of the IPI_PageSegmentDS_t to resize the output. ## Subprocedure Prototype | Field | Description | |---|---| | `Dcl-Pr IPI_ImageToPageSegment Ind ExtProc('IPI_ImageToPageSegment');` | Returns *OFF if an error occurs during processing, *ON otherwise. | | ` pImageDS LikeDS(IPI_ImageDS_t) Const;` | Contains image data previously loaded by IPI_LoadImage() | | ` pTargetPageSegmentDS LikeDS(IPI_PageSegmentDS_t) Const;` | Contains configuration information about the page segment to create. | | ` pErrorDS LikeDS(IPI_ErrorDS_t) Options(*NoPass:*Omit);` | Optional parameter that, if passed, will contain error data returned from the subprocedure. If it is not passed, exceptions will instead be "thrown" and must be caught by a MONITOR block. | | `End-Pr;` | | ## Data Structures ### IPI_ImageDS_t | Field | Description | |---|---| | `Dcl-Ds IPI_ImageDS_t Qualified Template Inz;` | | | ` Image Pointer Inz(*Null);` | **Internal use only** | | ` MaxSize Uns(10);` | **Internal use only** | | ` UsedSize Uns(10);` | **Internal use only** | | ` Format Char(8);` | **Internal use only** | | `End-Ds;` | | ### IPI_PageSegmentDS_t | Field | Description | |---|---| | `Dcl-Ds IPI_PageSegmentDS_t Qualified Template Inz;` | | | ` ObjectName Char(10);` | Specify the object name used to create the page segment | | ` LibraryName Char(10) Inz('*LIBL');` | Specify the library where the page segment will be created **Default Value:** `*LIBL` | | ` Width Packed(5:3);` | Specify the desired output width in inches | | ` Height Packed(5:3);` | Specify the desired output height in inches | | `End-Ds;` | | ### IPI_ErrorDS_t | Field | Description | |---|---| | `Dcl-Ds IPI_ErrorDS_t Qualified Template Inz;` | | | ` Subproc VarChar(132);` | Subprocedure which received error | | ` MessageCode Char(7);` | Message ID of error message | | ` Message VarChar(1024);` | Error message text | | `End-Ds;` | |