We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

No support for bar code fields

Using the following code and the attached word document, we are not getting bar codes to render in the output file.
using (var stream = new FileStream(infile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
using (var wordDocument = new WordDocument(stream, infile.EndsWith("x", StringComparison.CurrentCultureIgnoreCase)
? FormatType.Docx
: FormatType.Doc))
using (var converter = new DocIORenderer())
converter.Settings.ChartRenderingOptions.ImageFormat = ExportImageFormat.Jpeg;
converter.Settings.EmbedFonts = true;
converter.Settings.PreserveFormFields = true;
converter.Settings.PdfConformanceLevel = Syncfusion.Pdf.PdfConformanceLevel.Pdf_A2B;
var pdfDocument = converter.ConvertToPDF(wordDocument);
using (var outStream = new FileStream(outfile, FileMode.Create))
Is there planned support for this?

Attachment: barcodedoc_9f509d60.zip

1 Reply

VA Vijayasurya Anandhan Syncfusion Team February 3, 2020 02:15 PM UTC

Hi Rick,

Thank you for contacting Syncfusion support.

At present, our Essential DocIO library doesn’t support DisplayBarcode field. On further checking with the DisplayBarcode field, it
 is an older file format feature and also, we don’t have any plans to implement this feature. 

From the given details, we have found that your end requirement is to preserve the Barcode in Word to PDF conversion. As a workaround, we have prepared a sample to meet your requirement which can be downloaded from the following link.

In this sample we have done the following things:
1. Loaded the Word document.
2. Iterate all the fields and gets the field
with "DISPLAYBARCODE" field code.
3. Generated barcode image using the barcode value using our Essential PDF library.
4. Removed the field and replaced it with the generated barcode image.
5. Saved the generated PDF.   

Please let us know if you have any questions.

Vijayasurya A 

Live Chat Icon For mobile
Up arrow icon