LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Using PrintPanel to create PDF files

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?



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 11 of 19
(1,677 Views)

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".

 

0 Kudos
Message 12 of 19
(1,671 Views)

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.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 13 of 19
(1,667 Views)

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.

0 Kudos
Message 14 of 19
(1,663 Views)

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.

0 Kudos
Message 15 of 19
(1,659 Views)

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.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 16 of 19
(1,652 Views)

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 🙂

0 Kudos
Message 17 of 19
(1,645 Views)

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

 

 

 

0 Kudos
Message 18 of 19
(1,627 Views)

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).



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 19 of 19
(1,605 Views)