Export To Image Using Database? 追蹤

0
Avatar
Legacy Poster

Hi Everyone

 

I was just wondering if it was possible to export to an image using the template label I have created, which pulls in various fields via an excel spreadsheet. So for example I would open up my template label, select a couple of labels from the database list then export them both to something usable like .PDF. .JPG rather than printing out a hard copy. I already know how to do this when the label has been created without a database I was just wondering if it could be done without :)

 

Thanks in advance.

 

Stewart

 

 

3 意見

0
Avatar
Ian Cummings
版主
評論操作 永久連結

You can print a print job to PDF through the use of a PDF printer driver.  PDF Creator or CutePDF are both capable and usable in this respect.

 

If controlling BarTender via the automation interface then you could call the ExportPrintPreviewToFile or  ExportPrintPreviewRangeToFile method.  See the BarTender Help system for a full reference.

 

Public Sub Demo()
   ' Initialize a new BarTender print engine. 
   using btEngine As New Engine()
      ' Start the BarTender print engine.
      btEngine.Start()

      ' Open a format document. 
      Dim btFormat As LabelFormatDocument = btEngine.Documents.Open("C:\Format1.btw")

      ' Export the print preview to an image file. 
      Dim sPath As String = "C:\PrintPreview" 
      Dim sFileName As String = "Preview%PageNumber%.jpg" 
      Dim btMessages As Messages = Nothing
      btFormat.ExportPrintPreviewToFile(sPath, sFileName, ImageType.JPEG, ColorDepth.ColorDepth256, New Resolution(300), Color.Green, OverwriteOptions.DoNotOverwrite, True, True, btMessages)

      ' Close the current format without saving.
      btFormat.Close(SaveOptions.DoNotSaveChanges)

      ' Stop the BarTender print engine.
      btEngine.Stop()
   End Using 
End Sub
0
Avatar
Legacy Poster
評論操作 永久連結

Hi

Thanks very much this does work but I now have another slight issue.

The labels are being exported to a default blank A4 page problem is my labels are only 120mm x 60mm and I would like them cropped to fit if possible. I entered a custom size exactly to the size of the label and then another one with an extra 20mm all the way around but Bartender is giving me an error message saying "Printer area too small, would you like to automatically adjust to the nearest paper size" I have no option to ignore like in most software, if I click adjust to nearest paper size it is a 120mm x 60mm label on a blank A4 page.

Do you know if there is a way around this?


Kind Regards,

Stewart

0
Avatar
Ian Cummings
版主
評論操作 永久連結

Are you using the PDF driver method?

 

If yes then I would suppose you need to create a custom stock size in the PDF driver itself and then select that in the BarTender "Page Setup" dialog.

登入寫評論。