I wrote a piece of code to convert pdf to ZPL, which requires 4 nuget packages:
Code:
static void Main(string[] args)
{
string filePath = @"";
byte[] bytes = File.ReadAllBytes(filePath);
String file = Convert.ToBase64String(bytes);
int pageNum = PageCount(bytes);
List<string> strs = new List<string>();
for (int i = 0; i < pageNum; i++)
{
strs.Add(Conversion.ConvertPdfPage(file, dpi: 100, page: i));
}
Console.WriteLine("Press any key to continue...");
Console.ReadLine();
}
public static int PageCount(byte[] pdf)
{
using (var stream = new MemoryStream(pdf))
{
using (var reader = new PdfReader(stream))
{
using (var document = new PdfDocument(reader))
{
return document.GetNumberOfPages();
}
}
}
}
The package also provides a method to convert Bitmap to ZPL:
Conversion.ConvertPdfPage(Bitmap bitmap)
I have not found a way to convert html to ZPL, but there should be many ways to convert it to PDF or images.
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.