Hello Aspose Team,
I am converting excel file into pdf using Aspose. After conversion bar codes are not correctly appearing in the PDF file. Please refer attachments
Original file snapshotExcal.png (137.8 KB)
PDF, after conversion from AsposePDF.png (172.0 KB)
Please put excel files(unzip D.7z) under Document-> Archive folder. After conversion PDF file appear in Publish folder. Sample application can convert a file at a time.
D.7z (237.6 KB)
@MINDNOIDA
Cause
The issue with barcodes not appearing correctly in the PDF after converting from an Excel file is likely due to barcode optimization settings or the rendering process during conversion.
Solution
To resolve this issue, enable barcode optimization in your conversion settings. This adjustment will ensure that barcodes are rendered correctly in the resulting PDF.
Code
Here’s a sample code snippet to set the barcode optimization option when converting an Excel file to PDF:
// Load the Excel file
Workbook workbook = new Workbook("input.xlsx");
// Create an instance of PdfSaveOptions
PdfSaveOptions saveOptions = new PdfSaveOptions();
// Enable barcode optimization
saveOptions.SetBarcodeOptimization(true);
// Save the workbook as a PDF
workbook.Save("output.pdf", saveOptions);
Next Steps
- Test the above code to confirm that it resolves the issue with the barcodes.
- If the problem persists, verify that the original Excel file has the barcodes correctly formatted and visible before conversion.
- Update to the latest version of Aspose.Cells, as newer versions may include fixes for barcode rendering issues.
Please implement these steps and let me know the outcome!
@MINDNOIDA,
Which version of the Aspose.Cells for .NET you are using? I tried using latest version/fix:
Aspose.Cells for .NET v25.6 (Releases | NuGet) and it works fine and as expected.
e.g.,
Sample code:
// Load the Excel file
Workbook workbook = new Workbook("e:\\test2\\D.xlsx");
// Create an instance of PdfSaveOptions
Aspose.Cells.PdfSaveOptions saveOptions = new Aspose.Cells.PdfSaveOptions();
// Save the workbook as a PDF
workbook.Save("e:\\test2\\out1.pdf", saveOptions);
Please find attached the output PDF file for your reference.
out1.pdf (88.3 KB)
Please try using Aspose.Cells for .NET v25.6 and let us know your feedback/results.