04-11-2016 03:56 AM
Dear Guys,
Can anyone give me an idea about how to generate a screenshot of a panel and save it in a .PDF format. I found that there are some options to save them in .jpg, .png etc.
Hope someone might have figured how to do that in Labwindows.
Thanks
Raunak
04-11-2016 06:44 AM
In this question there are two different aspects you need to deal with: a.taking the screenshot and b.saving to PDF.
If your application has a single panel or one parent panel with some child panels embedded you can simply use GetPanelDisplayBitmap instruction to obtain a bitmap image in memory of the panel. On the other hand, if your application is multpanel (or if you want to take a shot of the entire screen, including areas not pertaining to your application) you can look at this example I posted some while ago.
The second aspect is to create a PDF. The simplest way is to use one of the multiple applications that create a "pdf printer" and use PRintPanel to simply generate the PDF (depending on the application you use, some user interaction may be needed). Alternatively, you could try integrating into your application some library to genreate PDF files: I have tested succesfully HARU PDF library and created an example of how to create a report with text and graphics with it: you can see it here.
04-11-2016 07:47 AM
Hi,
I used the PDFGen by Andre Renaud found on github. With minor modification, I was able to make an instrument (pdf.fp) and include it in my toolbox. Also added a function that adds CVI panel bitmap to the file using the AllocBitmapData() and GetBitmapData() functions. PDFGen supports 24 bits RGB only. On 32 bit RGB, you have to convert it to 24 bits.
I also tried libharu, but was not successful. Maybe you have to use an older version to succeed.
Best Regards,
Jan
04-12-2016 02:42 AM
Hello Gaus,
Since I am new to Labwindows can you tell me step by step how to use the functions.
Or if you have a smaple of it, can you please share it with me.
Regards
Raunak