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.

Wed Jul 24, 2024 2:19 am

I have written a windows service (running on Windows Server 2019) and developed on a Windows 10 machine that uses SpireNet 10.2.0 to read in data from a text file and use that to complete and print a fillable PDF. The PDF makes use of an embedded barcode TrueType font for one field. The TTF is embedded in the PDF and installed on both the development machine and server. The service is written in Visual Basic.

The applicable source is:

Dim outDoc As PdfDocument = New PdfDocument
outDoc.LoadFromFile(strTemplateName)

Dim form As PdfFormWidget = CType(outDoc.Form, PdfFormWidget)
Dim formWidgetCollection As PdfFormFieldWidgetCollection = form.FieldsWidget
Dim i As Integer

For i = 0 To formWidgetCollection.Count - 1 Step i + 1
- Dim field As PdfField = formWidgetCollection(i)
- If TypeOf field Is PdfTextBoxFieldWidget Then
- - Dim textBoxField As PdfTextBoxFieldWidget = CType(field, PdfTextBoxFieldWidget)
- - Select Case field.Name
- - - Case "BARCODE"
- - - - textBoxField.Text = PTLField(parFI.Name, ".", 2)
- - End Select
- End If
Next

outDoc.PrintSettings.PrinterName = "Microsoft Print to PDF"
outDoc.PrintSettings.PrintToFile(strNewPDFName)
outDoc.Print()
outDoc.Close()


When running this code either on my development machine or the server, the final printed PDF displays the ASCII text instead of the barcode.

Can anyone highlight what I have done wrong or what I might be missing?

DaveMcCarty
 
Posts: 1
Joined: Wed Jul 24, 2024 1:18 am

Wed Jul 24, 2024 3:18 am

Hello,

Thanks for your inquiry.
To help us investigate your case more accurately, please provide us with the following information. You can upload them here as an attachment or send them to this email: [email protected]. Thanks in advance.
1. Your input files;
2. Your font files;
3. Your complete test code, or provide a simplified project that can be run directly.

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 757
Joined: Mon Dec 27, 2021 2:23 am

Return to Spire.PDF

cron