Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Tue Mar 03, 2020 3:45 pm

Hi there, I'm trying to print raw zpl to a Zebra label printer but the spire pdf code that i'm using is throwing an error i.e. "Invalid/Unknown/Unsupported format". Is there a conversion process that i need to follow to convert the raw zpl before printing?

I've attached the zpl data for reference. Any help will be greatly appreciated.

Thanks,
Patrick.

kentap1975
 
Posts: 3
Joined: Fri Nov 15, 2019 10:49 am

Wed Mar 04, 2020 6:41 am

Hi,

Thanks for your inquiry.
Sorry that our Spire.PDF doesn't support converting raw ZPL or printing raw ZPL.
If there is any other question, welcome to get it back to us.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Wed Mar 04, 2020 1:48 pm

Hi Betsy, thanks very much for your prompt reply.

I've decided to come at this from a different angle but still need your help.

OK, I'm calling a web service and this time it's not returning raw zpl but a pdf byte stream as I have been informed by the sender. I've copied the byte stream from the clipboard and pasted into notepad for your reference. File attached. I cannot get it to print! Only a blank page comes out. There is no error and when i pause the printer you can see the job in the queue.

Here's my code. PDFString is the PDF byte stream that's returned.

Dim MS As New MemoryStream(Encoding.UTF8.GetBytes(PDFString))
docBase = Spire.Pdf.PdfDocument.MergeFiles({MS})
doc.PDFStandard = docBase
doc.PrintSettings.SelectSinglePageLayout(Spire.Pdf.Print.PdfSinglePageScalingMode.ActualSize)
doc.PrintSettings.PrinterName = printerName
'silent printing
doc.PrintSettings.PrintController = New StandardPrintController()
doc.Print()
MS.Dispose()

Any ideas?

Thanks,
Paddy.

kentap1975
 
Posts: 3
Joined: Fri Nov 15, 2019 10:49 am

Thu Mar 05, 2020 3:18 am

Hi Paddy,

Thanks for your inquiry.
Is the text file PDFString? I used below code to convert the text to a PDF file, but the result PDF is damaged. I have attached it.
Code: Select all
        Dim PDFString As String = File.ReadAllText("Test.txt")
        Dim MS As New MemoryStream(Encoding.UTF8.GetBytes(PDFString))
        File.WriteAllBytes("20801.pdf", MS.ToArray())

As for your issue, could you please firstly check if your PDF stream is correct? Could you please provide your input PDF file for our direct testing?

Besides, I noticed you merged files, could you please also provide all files so that we could check if the merged process causes the issue?

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Thu Mar 05, 2020 3:37 pm

Hi Betsy,
your reply got me thinking so I contacted the customer's software developers and they agreed that they had sent me incorrect sample code! The web service was sending a pdf file. And the sample code was doing a responseStream.ReadToEnd() which converts to a string. This was corrupting the data :-)

Thanks very much for your help in this matter.

kentap1975
 
Posts: 3
Joined: Fri Nov 15, 2019 10:49 am

Fri Mar 06, 2020 1:42 am

Hi,

Glad to hear you have managed to solve the issue.
If there is any question while using our product, please feel free to contact us.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.PDF