i am currently evaluating different solutions to print pdf files. I tried spire.pdf.
It does work pretty decently. However i encountered some issues with the pdf files that I need to print.
Some text parts are not printed at all. They are just missing. To clarify. The document which I print is a product label which will be applied on barrels.
Those product labels do have a barcode and security warnings in multiple different languages. Apparently russian, china and the arabic translations are missing.
So I assumed that missing fonts might be the issue. I though that the libary is using all the fonts which are installed on the system. So I installed the language packs with the specific fonts on the windows server. Sadly it did not solve my issue. The text parts are still missing.
I am not sure if I identified the issues correctly. Any suggestions how I can solve that issue?
That's pretty much the code which is used to start the printing:
- Code: Select all
public static bool PrintPDFs(string pdfFileName)
{
try
{
var printCfg = CustomPrintCfg.LoadFromAppSettings();
using (PdfDocument document = new PdfDocument(pdfFileName))
{
if (!string.IsNullOrEmpty(printCfg.PrinterName))
{
document.PrintSettings.PrinterName = printCfg.PrinterName;
}
document.PrintSettings.SelectSinglePageLayout(Spire.Pdf.Print.PdfSinglePageScalingMode.ActualSize, false, printCfg.PrinterCustomScaling);
document.PrintSettings.Landscape = true;
if (printCfg.PrintPaperSize != null)
{
document.PrintSettings.PaperSize = new PaperSize("CustomSize",
printCfg.PrintPaperSize.Value.width, printCfg.PrintPaperSize.Value.height);
}
if (printCfg.PrintPaperMargin != null)
{
document.PrintSettings.SetPaperMargins(printCfg.PrintPaperMargin.Value.top,
printCfg.PrintPaperMargin.Value.bottom,
printCfg.PrintPaperMargin.Value.left,
printCfg.PrintPaperMargin.Value.rigth);
}
document.Print();
}
return true;
}
catch (Exception ex)
{
_logger.Error(ex);
return false;
}
}