Menu

Compression not working in Libharu

2016-10-19
2020-10-21
  • Siddharth Mittal

    The compression is not working and the value returend by the following line is 4129. The documentation about errors says that 4129 means "Invalid value set for compression".

    HPDF_STATUS Status = HPDF_SetCompressionMode(pdf, HPDF_COMP_ALL);
    

    My code looks like follwoing:

                //Create the PDF
                HPDF_Doc pdf = HPDF_New(error_handler, NULL);
                if (!pdf) 
                    return 0;
                HPDF_STATUS Status = HPDF_SetCompressionMode(pdf, HPDF_COMP_ALL);
                //HPDF_STATUS Status = HPDF_SetCompressionMode(pdf, HPDF_COMP_IMAGE);
    
     

    Last edit: Siddharth Mittal 2016-10-19
  • Pierre Clouthier

    If you step into the code, you will see you are getting the error because the ZLIB compression library was not compiled into your copy of HaruPDF.

    First: comment out this line in ..\win32\include\hpdf_config.h:

    /* zlib is not available */
    //#define LIBHPDF_HAVE_NOZLIB
    

    Second: find, download and unzip the ZLIB code. You can obtain the source from the following Website:

    http://www.zlib.net/

    Third: tell HaruPDF where it can find the ZLIB code, and recompile HaruPDF.

    You should now be able to use compression.

    Ain't Open Source grand?

     
  • kalyan

    kalyan - 2020-10-21

    Hi ,i am using this code for creating new pdfDoc object but it is not creating and printing error:cannot create pdfDoc object.
    pdf = HPDF_New (error_handler, "s");
    if (!pdf) {
    printf ("error: cannot create PdfDoc object\n");
    return 1;
    }
    can anybody help me?

     
  • kalyan

    kalyan - 2020-10-21

    and I checked it with the geterror code it is showing 4133 means HPDF_INVALID_DOCUMENT .

     

Log in to post a comment.