1

I need to print a set of generated images in a table like structure with headings. These heading and images are never displayed on the screen. The images are generate QR codes for a series of URLS so they can easier be read in by a scanner. There need to be a header on each column and a text id field on each row but apart from that the rows would be 4-6 columns of QR codes (2d barcode).

I have found samples for printing images and samples for printing text and even a sample to print a datagrid shown on the screen but nothing for printing text and images in a table like structure. Could anyone help me out with a basic example. The table is expected to go over multiple pages vertically so I would also need to put the heading row on each page.

Even pointing me in the right direction would be useful.

This is for a windows application where I want to have code kick off a print job with no user interaction. Using dotnet 4.0.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Seer
  • 495
  • 5
  • 20

1 Answers1

1

See my method for creating and printing FixedDocument here including source code. This method will easily allow you to generate aligned tables with images and text and save them as XPS or print them to a printer.

Community
  • 1
  • 1
Ed Bayiates
  • 11,060
  • 4
  • 43
  • 62
  • You code looks good. I have only had a quick look and i will have a more detailed look when i get home tonight nit i did not see how you add images in the table etc. Would i just create a copy of the "AddTextBlock" method but for an image instead? Also does this mean i need to calculate the table cells etc my self as exact positions for both the columns and the rows? I have never played with printing before so just trying to get my head around it. – Seer Jul 14 '11 at 00:47
  • Just to be clear it is the table structure part with heading on the top of each page that has me a little confused with your code. IF i have read the code correctly i would need to do that myself right? Calculate the x,y for each cell and the size as well as add a header row if it is on a new page or did i miss something when i skimmed the code and example – Seer Jul 14 '11 at 00:53
  • Got a chance to play with the code a little.Very simple and easy to use I love it. Got table like layout working and understand that all now. Have not tried images yet. Just text so far. Is there a way to put a vertical line down the page for a column? Only way i could think of is a thin black image on each line in the same position. – Seer Jul 14 '11 at 03:18
  • You can add anything you want because the backing is a Canvas. To make a black line just modify the routine that creates the Canvas to add a black line where you want each time a new page is created. If you like my answer, please be sure to click the check to accept my answer. Thanks! – Ed Bayiates Jul 14 '11 at 06:31