02-13-2012 02:59 PM
I was able to run the project in CVI 2010 without any problem.
Which file and line are you getting the error? Can you post here the code and the exact error text?
And the same with your project?
02-14-2012 03:56 AM
In your sample project the error I am receiving is:
PDFTextReport.c - 1 error
16, 5 syntax error; found 'integer constant' expecting '}'.
The line this refers to is:
HPDF_ARRAY_COUNT_ERR = 0x1001, // Internal error. The consistency of the data was lost.
If I block out (by this I mean using /* */) this line of code the error simply moves to the next line, if all of the error handling portion or your sample project is blocked out I get the same errors as with my test project which are:
26 Project link errors
Undefined symbol '_deflateEnd' referenced in "libhpdf.lib".
Undefined symbol '_deflate' referenced in "libhpdf.lib".
Undefined symbol '_deflateInit_' referenced in "libhpdf.lib".
Undefined symbol '__errno' referenced in "libhpdf.lib".
Undefined symbol '__CIsin' referenced in "libhpdf.lib".
Undefined symbol '__CIcos' referenced in "libhpdf.lib".
Undefined symbol '__time64' referenced in "libhpdf.lib".
Undefined symbol '_png_get_io_ptr' referenced in "libhpdf.lib".
Undefined symbol '_png_get_error_ptr' referenced in "libhpdf.lib".
Undefined symbol '_png_read_image' referenced in "libhpdf.lib".
Undefined symbol '_png_get_rowbytes' referenced in "libhpdf.lib".
Undefined symbol '_png_read_rows' referenced in "libhpdf.lib".
Undefined symbol '_png_get_color_type' referenced in "libhpdf.lib".
Undefined symbol '_png_get_PLTE' referenced in "libhpdf.lib".
Undefined symbol '_png_get_interlace_type' referenced in "libhpdf.lib".
Undefined symbol '_png_destroy_read_struct' referenced in "libhpdf.lib".
Undefined symbol '_png_get_tRNS' referenced in "libhpdf.lib".
Undefined symbol '_png_get_valid' referenced in "libhpdf.lib".
Undefined symbol '_png_read_update_info' referenced in "libhpdf.lib".
Undefined symbol '_png_set_strip_16' referenced in "libhpdf.lib".
Undefined symbol '_png_read_info' referenced in "libhpdf.lib".
Undefined symbol '_png_set_read_fn' referenced in "libhpdf.lib".
Undefined symbol '_png_set_sig_bytes' referenced in "libhpdf.lib".
Undefined symbol '_png_create_info_struct' referenced in "libhpdf.lib".
Undefined symbol '_png_create_read_struct' referenced in "libhpdf.lib".
Undefined symbol '_png_sig_cmp' referenced in "libhpdf.lib".
02-14-2012 04:22 AM - edited 02-14-2012 04:23 AM
Strange enough, you get this error from the third element on of the enum, but I possibly have an answer for this.
Which HARU library have you downloaded? I have downloaded libharu_2_0_8_dll_win32.zip. Other versions have additional include files that defines the same macros and this can make the compiler warn about it. Try with that library.
02-14-2012 04:41 AM
That seems to solve it! Thanks very much, I was trying to use a more recent version but I shall stick with this one! I am now able to run your sample project without any problems.
02-14-2012 06:19 AM
Roberto, I have come across one other thing that you might want to check. In your sample project I'm not sure that the image conversion from 32bit to 24bit works correctly, as the image in the report for me has the red parts of the image changed to blue.
02-15-2012 04:00 AM - edited 02-15-2012 04:00 AM
You are right: as clarified in the online help for Bits field in GetPitmapData, byte ordering scheme is different for 24- and 32-bit images. I didn't noted it as I usually use grayscale images in my reports.
I will update the sample project in the community area, in the meanhile you can correct the code yourself: within PrintReport () function the comversion loop must be corrected as follows:
size = width * height * 4; if (pdepth == 32) { for (i = 0, j = 0; j < size; i+= 3, j += 4) { bits[i ] = bits[j + 2]; bits[i + 1] = bits[j + 1]; bits[i + 2] = bits[j ]; } }
Thank you for making me aware of this bug.
02-15-2012 04:15 AM
Thanks, yes, I have already made the change now once I realised the order needed to be different. All works fine now! Just thought it would be worth telling you so you can change it in your sample project 🙂
02-21-2012 04:25 AM
hi roberto!
thanks for the link to that PDF-library.
i just have a problem make it work in LabView.
i imported the libhpdf.dll and hpdf.h file in LabView11 and got the new user library HARUPDF with all its VIs to create a PDF.
my question is, what initial inputs have to be created at the VI "HPDF_New" to start the creating process?
as i don't know how to create the input "error_user_fn" and i can't figure it out what it could be?
do you have a sample overview of HaruPDF-VIs creating a PDF in LabView?
do you have any advice?
thanks for your help
02-22-2012 02:05 AM
Hello tva,
I haven't tried to use Haru dll in LabVIEW till now. I can give it a try but it will take some time for I am stuck on other projects at the moment.
In any case, parameters for HPDF_New are related to a user-defined error handler function, which I don' use: I rather rely on return code from individual functions instead. As you can see in my example, I am passing a NULL value to the function so you can use the LV equivalent and still obtain a valid document handle to use in library functions. The function has failed if the return value is not a valid handle (i.e. is a NULL value).