print a report with text and image on a label

5 posts, 1 answers
  1. Roman
    Roman avatar
    5 posts
    Member since:
    Apr 2019

    Posted 20 May Link to this post

    Hi there

    I'm trying to print a report with some data from our system on it. The report should be printer as a label. The label has a width of 102mm and a height of 102mm. I'm using this code to print the label:

    01.IReportDocument repDocList = new AddrLabel();
    02. 
    03.// set printer settings
    04.PrinterSettings printSet = new PrinterSettings();
    05.printSet.Copies = 1;
    06.printSet.PrinterName = LabelPrinterName;
    07. 
    08.// create print controller
    09.PrintController printCtrl = new StandardPrintController();
    10. 
    11.// create report processor
    12.ReportProcessor repProc = new ReportProcessor();
    13.repProc.PrintController = printCtrl;
    14. 
    15.InstanceReportSource repSrc = new InstanceReportSource();
    16.repSrc.ReportDocument = repDocList;
    17. 
    18.// print report
    19.repProc.PrintReport(repSrc, printSet);

    The report contains text and image. I attached two images. One image is the expected report how it should be printed on the label. We printed that manually on windows photo gallery application to test if our printer is able to print images properly. The second image is how the telerik report is printed. As you can see it doesn't print the image properly (only black & white). It also prints the report on two pages and moves it down and to the right.

    I'm wondering if it's possible to print a report on a label and if yes: how?
    We're using a TSC TC310 label printer.

    Best Regards,
    Roman

  2. Answer
    Silviya
    Admin
    Silviya avatar
    359 posts

    Posted 23 May Link to this post

    Hi Roman,

    Please open the report in a Report Designer and check its PageSettings properties: more importantly, the PaperKind and PaperSize including margins, and if the Report Designer points that the content can be gathered in the given physical page size. You can run design-time print preview to check how the physical page will look with the processed data.

    If you need further help, please open a new support ticket and send us the problematic report with test data (for example in CSV format) to test it locally.

    Best Regards,
    Silviya
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. Roman
    Roman avatar
    5 posts
    Member since:
    Apr 2019

    Posted 23 May in reply to Silviya Link to this post

    Hi Silviya,

    Thanks for your answer. It helped a lot. I know can print the report on one label. But the coloring does not work yet. I cannot find any settings for the report or for the image to be printed properly as in my attached file "expected_report.png" above. Is there any possibility to print it not only black & white but in grayscale?

    Regards,
    Roman
  4. Silviya
    Admin
    Silviya avatar
    359 posts

    Posted 23 May Link to this post

    Hi Roman,

    I tested the gray scale printing issue locally, but couldn't reproduce it. I created a simple report and printed it through the Standalone report designer on a physical printer, and in PDF file with Color output in both cases set to the corresponding equivalent of 'Gray Scale'. The document was printed correctly (entirely in gray scale).
    This issue is most probably related to the driver settings of the local printer.

    In Telerik Reporting Printing is equivalent to Image Rendering, so I suggest to export the report in .TIFF and test printing the generated image with a third party application in gray scale. If the printed file is correctly converted to gray scale, consider setting the OutputFormat of the Device Info settings for IMAGEPrint rendering extension to TIFF. This can be done by adding the following code to the App.config file of the application:
    .....
      
    <configuration>
      <configSections>
      <section
          name="Telerik.Reporting"
          type="Telerik.Reporting.Configuration.ReportingConfigurationSection, Telerik.Reporting"
          allowLocation="true"
          allowDefinition="Everywhere"/>
      </configSections>
        
    .....
      
      <Telerik.Reporting>
        <extensions>
          <render>
            <extension name="IMAGEPrint" description="Print Rendering Description">
              <parameters>
                <parameter name="OutputFormat" value="TIFF"/>
              </parameters>
            </extension>
          </render>
        </extensions>
      </Telerik.Reporting>
      
    .....
      
    </configuration>

    Note that by default the documents are rendered for printing in EMF, which is a vector format. TIFF is a raster format, hence if the printer resolution (DPI) is higher that the resolution used to render the report, the document printed through TIFF may look rasterized.

    If the problem persists, I would ask you to open a new support ticket and send us a sample application reproducing the issue to perform local tests.

    Best Regards,
    Silviya
    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  5. Roman
    Roman avatar
    5 posts
    Member since:
    Apr 2019

    Posted 27 May in reply to Silviya Link to this post

    Hi Silviya

    Thanks for the support. We could solve the problem :)

    Best Regards,
    Roman
Back to Top