Skip to content

PNG Images Support

gal kahana edited this page Sep 10, 2017 · 1 revision

PNG Images are supported in PDFWriter, through the usage of LibPng. Both transparent and opaque images are supported, making the PNG offering of PDFWriter quite unique.

In a similar fashion to JPG and TIFF, PNG images can be used in the context of DrawImage, the high level method.

Also, similarly there's a more customized usage of PNG images available, in which a Form XObject is created from the PNG, that can be placed wherever desired, one or more times.

The following options are available:

  • PDFFormXObject* PDFWriter::CreateFormXObjectFromPNGFile(const string& inPNGFilePath)
  • PDFFormXObject* PDFWriter::CreateFormXObjectFromPNGFile(const string& inPNGFilePath, ,ObjectIDType inFormXObjectID)
  • PDFFormXObject* PDFWriter::CreateFormXObjectFromPNGStream(IByteReaderWithPosition* inPNGStream)
  • PDFFormXObject* PDFWriter::CreateFormXObjectFromPNGStream(IByteReaderWithPosition* inPNGStream, ,ObjectIDType inFormXObjectID)

The first two methods accept the file path to the PNG file. The second method allows for Forward Referencing. The later two methods accept a custom stream that can be used to non-file sources of PNG. Read more about using streams in Custom input and output.

Clone this wiki locally