SDK does not work. 追蹤

0

Hello all,

What i need: Help to get the SDK operable in runtime.

I can't get the SDK to work in runtime.

My company assigned tasked me with trying to find iout "If BarTender is worth using it in custom applications". In order for me make applications i need to load the .dll's that makes up the API's.

Here is what i did:
Install the full trial version of BarTender (BT2021_R7_172970_Full_x64.exe)

Imported recursivly all  *.DLL under C:\Program Files\Seagull\BarTender 2021\SDK
Imported all files under C:\Program Files\Seagull\ into project.
Copied all files from C:\Program Files\Seagull\BarTender 2021\SDK to C:\tmpFile (Full controll access), rereferenced assemblies in the projects to C:\tmpFIle\*.

I tried the above steps in dotnetframework 4.7 and .NET 5.0.

Nothing works, what am i doing wrong?

Kind regards,

A prospective customer.

3 意見

0
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);

登入寫評論。