Skip to main content

Search

Search

SDK does not work.

Comments

3 comments

  • Avatar
    Andy Hurst

    The support on here isn't always the greatest... But Bartender is easy to use once you've got it working. I use it for labels and to just generate a ton of PDFs because it's easy and you can lay things out how you want easily. I'm using .net 4.8. Make sure your app is the same 32/64 bit as your bartender install. You should be able to just add a reference to the Seagull.BarTender.Print  under Add Reference -> Assemblies-> Extensions. From there add a using Seagull.BarTender.Print; at the top and 

    Engine btApp = new Engine(true);
    LabelFormatDocument label = engine.Documents.Open($"C:\labels\mylabel.btw"<- label path, "PDF"<-printer Name, or just PDF);

    label.SubStrings["FieldSetOnLabel"].Value = "text to show";

    //if you have a table of data you can fire it to your label like this. It's a bit complicated to get the formatting setup though
    //Seagull.BarTender.Print.Database.JSONDatabase db = //(Seagull.BarTender.Print.Database.JSONDatabase)label.DatabaseConnections[0];
    //db.EmbeddedData = jsonData;

    string filePath = HostingEnvironment.MapPath($"C:\Temp\MyNewFile.pdf");

    // Print the label to a PDF
    label.PrintSetup.PrintToFile = true;
    label.PrintSetup.PrintToFileName = filePath;

    Result printResult = label.Print(labelName, out Messages messages);

    //print the label to a printer

    label.PrintSetup.PrinterName = actualPrinterPath;
    label.PrintSetup.PrintToFile = false;
    label.PrintSetup.PrintToFileName = null;

    Result printResult = label.Print(labelName, out Messages messages);

    0
  • Avatar
    knfsdkfsdsdf kjbfdskjfsdkfds

    Hi Andy!

    Your comment about the "X86 and X64 part" helped! Thank you!

    In your comment its about printing a .btw to a .pdf file. I wonder is it also possible to print a .pdf file to paper?

    0
  • Avatar
    Andy Hurst

    There's two print calls in the above code.  The first one will print to a file and the second one will print it to a printer. You can print to whatever printer you want. You just need to have bartender installed on the box that your app is running on and have the printer installed.

    //print the label to a printer

    label.PrintSetup.PrinterName = actualPrinterPath;
    label.PrintSetup.PrintToFile = false;
    label.PrintSetup.PrintToFileName = null;

    Result printResult = label.Print(labelName, out Messages messages);

    0

Please sign in to leave a comment.