04-15-2013 09:27 AM
Hi all,
Is it possible to print the texts on one page in different fonts and sizes? It seems like PrintTextBuffer prints all the texts onto one page at once and there is no chance to change the format. Thanks,
LT
Solved! Go to Solution.
04-15-2013 11:47 PM
Attributes for printing are set with SetPrintAttribute with the proper attribute. Specifically, if you use ATTR_EJECT_AFTER attribute to 0, the printer won't eject the paper after printing. With this option you sgould be able to set different print attributes for different parts of texts. When you have finished preparing the page, set ATTR:EJECT_AFTER to 1 and perform the last print function to have the page printed.
This is not the most confortable way of printing, though: CVI offers alternatives like NIReports or report printing with Word or Excel, provided the products are installed on the target system. There is also the possibility to use aditional libraries to create reports in PDF format like the HARU Pdf library I used for this example
04-18-2013 08:45 AM
Thanks, Roberto. But it doesn't work. ATTR_EJECT_AFTER can hold the paper, but the printing attributes can not be changed. For examle, I have these codes:
SetPrintAttribute (ATTR_PRINTER_NAME, "");
SetPrintAttribute(ATTR_ORIENTATION, VAL_PORTRAIT);
SetPrintAttribute(ATTR_EJECT_AFTER, 0);
SetPrintAttribute(ATTR_PRINT_POINT_SIZE, 10);
PrintTextBuffer ("This is the teststring printed with LabWindows/CVI 1!", "");
SetPrintAttribute(ATTR_PRINT_POINT_SIZE, 30);
PrintTextBuffer ("This is the teststring printed with LabWindows/CVI 2!", "");
SetPrintAttribute(ATTR_EJECT_AFTER, 1);
The two lines were printed on one page, but the font size was always 10. Do you have any idea?
Also, as soon as I call SetPrintAttribute(ATTR_EJECT_AFTER, 1), the paper is ejected. This is different from the description of ATTR_EJECT_AFTER: "Specifies whether to eject the paper from the printer AFTER the next call to a printing function." But I guess this is not an important issue.
Thanks!
04-18-2013 10:10 AM
I must admit that I give you that suggestion but I have not used those functions in several years ; testing your function on my system now (CVI 2009SP1 on Win7 with HP LaserJet printer) I have the same results as you.
Due to the limitations of this printing method I moved rapidly to other ways of printing: there are numerous discussions that you can find in the forums about reporting, but basically you can:
The first one is probably the fastest one: you are already accustomed to create panels and after a short trial you can define the correct panel/control aspect to obtain a good report; it permits you also a limited preview if you want to.
04-18-2013 10:16 AM
One format one page may be acceptable in my project. If it's not, I'll go for Solution 1. Thank you very much!
04-19-2013 03:38 AM
OK for that. In the meanwhile I posted a suggestion for a report printing tool in CVI that you may want to support with Kudos.