PICTools Programmer's Reference
PDF_UNION

PDF_UNION: OP_D2PDF, OP_PDF2D

 
Copy Code
typedef struct {
   DWORD                        Reserved0;
   BYTE PICHUGE*                Reserved1;
   BYTE PICHUGE*                Reserved2;
   BYTE PICHUGE*                Reserved3;
   BYTE PICHUGE*                Reserved4;
   BYTE PICHUGE*                Reserved5;
   BYTE PICHUGE*                Reserved6;
   BYTE PICHUGE*                Reserved7;
   BYTE PICHUGE*                Reserved8;
   PICFLAGS                     PicFlags;
   PICFLAGS                     PicFlags2;
   DWORD                        Compression; 
   DWORD                        WidthPad;
   DWORD                        StripSize;
   DWORD                        NumOfPages;
   DWORD                        LumFactor;
   DWORD                        ChromFactor;
   DWORD                        SubSampling;
   DWORD                        EncodeModeJBIG2;
   DWORD                        PageFlagsJBIG2;
   DWORD                        RegionFlagsJBIG2;
   DWORD                        Looseness;
   DWORD                        Rate;
   DWORD                        CompFileSize;
   double                       TargetPSNR;
} PDF_UNION;

Fields:

Name Description

Reserved0

Reserved1

Reserved2

Reserved3

Reserved4

Reserved5

Reserved6

Reserved7

Reserved8

This field is not currently used and must be set to 0.


PicFlags

Flags that control the D2PDF and PDF2D operations are:

Value

Meaning

PF_MultiImage

If set, then this DIB input image is to be appended to an existing PDF file to create or add to a multi-image PDF file.  The existing PDF file is input to OP_D2PDF using the Put queue (see also RES_PUTQ_GET_NEED_DATA).

PF_WidthPadKnown

Set if the padded length of one DIB line (WidthPad) has been set by the application.  Otherwise the length is computed by Pegasus.

PF_NoDibPad

Set if the input image is not padded to a DWORD boundary.  DIB pixel lines are ordinarily padded so that the number of bytes in a line is an integral number of DWORDs.

PF_SwapRB

Input/output values are in RGB order instead of BGR order.

PF_IsGray

For sequential JPEG compression, set this flag to ensure 8-bit gray indexed images are compressed as a 8-bit gray scale JPEG.

PF_YieldGet

For OP_D2PDF, specifies that the RES_GET_DATA_YIELD response is desired.  Ignored by OP_PDF2D.

PF_YieldPut

For OP_PDF2D, specifies that the RES_PUT_DATA_YIELD response is desired.  Ignored by OP_D2PDF.

PicFlags2

Flags that control the D2PDF and PDF2D operations are:

Value

Meaning

PF2_SwapBW

If set for OP_PDF2D for a 1bpp image, then the color table indexes for black and white are swapped.

PF2_NoYccTransform

For sequential JPEG and JPEG2000 compression, set this flag to force omitting the color transform to YCbCr from uncompressed input RGB, RGBA, or CMYK before compressing.  Otherwise, the color transform to YCbCr is used.

PF2_AcrobatCmyk

Set this flag to create sequential JPEG CMYK compressed images compatible with Acrobat instead of being compatible with Photoshop.  Acrobat complements C/M/Y before application the YCbCr conversion and otherwise doesn't complement.  Photoshop doesn't complement C/M/Y before applying the YCbCr conversion and otherwise complements.

PF2_ForceLossless

(PDFCompress_J2K) Compress the image losslessly using the reversible color-space and wavelet transforms.  Overrides Rate and CompFileSize.

Compression

Field that specifies the type of compression to use in writing PDF files and the type of compression used for images being extracted. 

Possible values are:

Value

Meaning

PDFCompress_Default

If the input DIB is 1 bit per pixel, than the compression type used is PDFCompress_G4, else PDFCompress_SequentialJPEG is used.

PDFCompress_None

The input DIB is not compressed.  Only 1, 8, and 24 bit input DIBs are valid.

PDFCompress_G31D

The input DIB is compressed using CCITT G3 1 dimensional encoding.  Only 1 bit, black and white images are valid as input.

PDFCompress_G32D

The input DIB is compressed using CCITT G3 2 dimensional encoding.  Only 1 bit, black and white images are valid as input.

PDFCompress_G4

The input DIB is compressed using CCITT G4 encoding.  Only 1 bit, black and white images are valid as input.

PDFCompress_JBIG2

The input DIB is compressed using lossless JBIG2 encoding.  Only 1 bit, black and white images are valid as input.

PDFCompress_SequentialJPEG

The input DIB is compressed using sequential JPEG encoding.  4 and 8 bit indexed, 16 5/5/5, 16 5/6/5, 24 RGB, 32 RGBA, and 32 CMYK are accepted as input.

PDFCompress_J2K

The input DIB is compressed using JPEG2000 encoding.  8 bit indexed, 24 RGB, and 32 RGBA are accepted as input.

WidthPad

Specifies the width of an uncompressed DIB pixel line in bytes.  WidthPad takes into account the number of bits needed to represent a pixel and any padding that may be required at the end of each line.  WidthPad will be output by Pegasus unless the PF_WidthPadKnown flag is set in PicFlags.  If PF_WidthPadKnown is set, then WidthPad must be input by the application. 

StripSize

Specifies the minimum buffer size needed to hold one strip of input data and is set by Pegasus.  The operation acts on the input data one strip at a time, so at least one complete strip of input data should be added to the Get queue at a time, except at the end of the image.  Thus, this is also the minimum buffer size for the Get queue.

NumOfPages

In OP_PDF2D, specifies the number of pages in the PDF document after REQ_INIT.

LumFactor

Specifies the desired luminance compression factor [0..255].  The luminance compression factor is used to adjust the default luminance quantization table values. When LumFactor is 32, the default luminance quantization table values are used as is.

When LumFactor and ChromFactor are 0, the quality is highest and the compression ratio is virtually non-existent.  When LumFactor and ChromFactor are 255, the quality is lowest and the compression ratio is highest.

ChromFactor

Specifies the desired chrominance compression factor [0..255].  The chrominance compression factor is used to adjust the default chrominance quantization table values. When ChromFactor is 32, the default chrominance quantization table values are used as is.

When LumFactor and ChromFactor are 0, the quality is highest and the compression ratio is virtually non-existent.  When LumFactor and ChromFactor are 255, the quality is lowest and the compression ratio is highest.

SubSampling

Specifies the desired sub-sampling. This field, together with ChromFactor and LumFactor, controls the compression ratio and the compressed image quality.  Note that, in all cases, Y is not sub-sampled.

Value

Meaning

SS_111

Cb and Cr aren't sub-sampled.

SS_211

Cb and Cr are sub-sampled 2 to 1 horizontally, not vertically.

SS_411

Cb and Cr are sub-sampled 2 to 1 vertically and horizontally.

SS_211v

Cb and Cr are sub-sampled 2 to 1 vertically, not horizontally.

EncodeModeJBIG2

Specifies the encode mode for the JBIG2 encoder to use for the page.

Value

Meaning

JBIG2_EncodeMode_Lossless_Generic_MQ

Fast, great lossless compression, use for any content, uses MQ arithmetic coding.

JBIG2_EncodeMode_Lossless_Generic_MMR

Fast, very good lossless compression, use for any content, similar to G4 coding, uses Huffman/MMR coding.

JBIG2_EncodeMode_Lossless_Text_MQ

Great lossless compression possible, use for text or symbols, uses MQ arithmetic coding.

JBIG2_EncodeMode_Lossless_Text_MMR

Very good lossless compression possible, use for text or symbols, uses Huffman/MMR coding.

JBIG2_EncodeMode_Lossless_Text_SPM_MQ

Potentially best lossless compression for text or symbols, uses MQ arithmetic coding.

JBIG2_EncodeMode_Lossless_Text_SPM_MMR

Potentially best lossless compression for text or symbols, uses Huffman/MMR coding plus MQ arithmetic coding.

JBIG2_EncodeMode_Lossy_Text_MQ

Great lossy compression for text or symbols, uses MQ arithmetic coding.

JBIG2_EncodeMode_Lossy_Text_MMR

Very good lossy compression for text or symbols, uses Huffman/MMR coding.

JBIG2_EncodeMode_Lossy_Halftone_MQ

Good lossy compression for halftones, uses MQ arithmetic coding.

JBIG2_EncodeMode_Lossy_Halftone_MMR

Good lossy compression for halftones, uses Huffman/MMR coding.

PageFlagsJBIG2

Flags

Value

Meaning

JBIG2_PageFlags_IsLossless

Set by OP_PDF2D if the compressed image indicates the page is lossless. Used by OP_D2PDF to set the lossless indicator bit in the page header of the compressed bitstream.

JBIG2_PageFlags_IsStriped

Set by OP_PDF2D if the compressed image indicates the page is encoded in stripes, each of which is no longer than MaxStripSize.

RegionFlagsJBIG2

Value

Meaning

JBIG2_RegionFlags_InvertedRegion

Invert bits prior to symbol analysis; may provide better compression if text is light bits against a dark background instead of the otherwise assumed dark bits against a light background; only used by the text region encoding modes.

Looseness

A value between 0 and 100 that tells OP_JBIG2P how loose to be when matching symbols and compressing text using either of the lossy text region encoding modes: JBIG2_EncodeMode_Lossy_Text_MQ or JBIG2_EncodeMode_Lossy_Text_MMR. The larger the number, the greater the compression and the greater the risk of introducing errors. Set to 50 for a reasonably small filesize and low risk of error. If set to 0, the compression will be lossless.

Rate

(PDFCompress_J2K) The number of thousandths of a bit per pixel in the compressed image - used to control degree of compression; overrides custom compression settings if set. If set to 0 then the degree of compression is set by CompFileSize.

CompFileSize

(PDFCompress_J2K) Desired compressed file size in bytes; overrides Rate or custom compression settings if set. If 0 then the Rate field is used to determine compression size.  If Rate is also 0, then the compressed file size is not arbitrarily limited in size but will depend on the compressibility of the image and on the other compression settings.

TargetPSNR

(PDFCompress_J2K) Set this to the desired compressed image quality as measured by Peak-Signal-to-Noise-Ratio.

 

 


©2022. Accusoft Corporation. All Rights Reserved.

Send Feedback