DrawCCITT with TIFF RAW data

  • Hi,

    I am using TIFFReadRawStrip from LibTIFF to read raw data from a TIFF image and store it into a buffer. So, the pure data is read. None of the TIFF tags, only image data in COMPRESSION_CCITTFAX4 format.

    The problem is that I'm trying to use DrawCCITT method from wPDF and it is not working. The raw data are written in the PDF but when I try to open it, an error message appears saying that there are problems with the PDF and the image is not showed.

    Here is part of code:

    //_rInfoTIFF.Image is a PChar buffer.
    // pageWidth = imageWidth; pageHeight = imageHeight

    _rPDFPrinter.DrawCCITT(0, 0, pageWidth, pageHeigth , imageWidth, imageHeigth, wpCCITT_42D, _rInfoTIFF.Image, _rInfoTIFF.BufSize);

    The buffer is correctly filled. Databuffer is written into pdf file.
    Am I doing something wrong?

  • This is your header in PDF file

    If I change it to this one

    Everything works like a charm!

    So, my question is, why DrawCCITT is not working correctly?

  • Zitat von wpsupport

    The build posted on 14.6.2011 includes the changed code which writes correct PDF code.

    I'm sorry to say that but it is not working yet.

    I got PDF Error (15) when I try to load it in acrobat reader.

    This is your code:

    Code
    3 0 obj<</Type/XObject/Subtype/Image/Name/wpt1/Width 1664/Height 2398/BitsPerComponent 1 /ColorSpace/DeviceGray /DecodeParms <</BlackIs1 false /EndOfLine false /EndOfBlock false /K 1 /Columns 1664 /Rows 2398>> /Length 27194/Filter [/CCITTFaxDecode] >>stream


    It should be:

    Code
    3 0 obj
    <<
    /Type/XObject/Subtype/Image
    /Name/wpt1
    /Width 1664
    /Height 2398
    /BitsPerComponent 1 /ColorSpace/DeviceGray /DecodeParms <</BlackIs1 false /EndOfLine false /EndOfBlock false 
    /K -1 /Columns 1664 /Rows 2398>> /Length 27194
    /Filter /CCITTFaxDecode >>
    stream

    I changed /K parameter (with a minus signal) and removed the brackets in /Filter. With this changes, it works.

    Did you guys test it?