Print Preview Follow




I'm little bit struggling with getting appropriate preview image file, that I can use later in my application for showing (in pictureBox) users how their label will look like.


I have a lot of layouts connected to SQL database and this is my approach:


 private Engine btEngine = new Engine(); //BT engine instances
 private string path = string.Empty; //path for storing label preview
 private LabelFormatDocument btFormat = null; //declaration of label format
btEngine.Start(); //start BT engine
btFormat = btEngine.Documents.Open(labelData.Layout); //open appropriate layout
 btFormat.DatabaseConnections.QueryPrompts["RecordNo"].Value = order.LabelNo; //promp query
 path = Path.GetTempFileName(); //set path to temporary image file
 btFormat.ExportImageToFile(path, ImageType.JPEG, Seagull.BarTender.Print.ColorDepth.ColorDepth24bit, new Resolution(575, 270), OverwriteOptions.Overwrite); //export image preview file
 previewPictureBox.ImageLocation = path; //set picture in picture box
btEngine.Stop(); //stop BT engine

Everything is working just fine, but I'm ending with image that is not prompt, all i can get is preview of general layout - not filled with data from database. The result is the same just like if I'll use LabelFormatThumbnail which is not what I want.


Could you please help me solve this tricky situation?



Thanks in advance!


Shotaro Ito
Comment actions Permalink

Legacy Poster
Comment actions Permalink

Method ExportPrintPreviewToFile() is working perfectly.


Thank you.

Please sign in to leave a comment.