We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Email headers uneven

We are using a combination of email-java and words-java to convert an email to PDF. We had a working version, but it did not handle Asian character sets.

We added a font source:

LoadOptions options = new LoadOptions();
  options.setLoadFormat(loadFormat);
  FolderFontSource intradynFontSource =
             new FolderFontSource("/vault/compliancevault/cv/emails/export/webcore/fonts",
                                  true);
  try {
      Document pdf = new Document(is, options);
      pdf.setFontSettings(new FontSettings());
      pdf.getFontSettings().
                setFontsSources(new FontSourceBase[]{intradynFontSource});
      pdf.save(dest, SaveFormat.PDF);
  }

It handled the text, but the headers got out of line:

Screenshot from 2021-09-23 17-22-25.png (28.6 KB)

This happens for all email, whether they contain odd characters or not.

Excuse me, wrong screen shot:
Screenshot from 2022-01-13 18-33-46.png (16.0 KB)

@intradyn Could you please attach a sample input and output files here for testing? We will check the issue and provide you more information.

https://app.box.com/s/sh6a945qobojueq81n8s2x4689278pop

The link above will be valid for 24 hours. Please download within that time.

@intradyn Thank you for additional information. The problem occurs because the fonts in your document are substituted with Baekmuk Gulim font. And size of whitespace is different in this font. If implement IWarningCallback to warn about font substitutions, I see the following warnings on my side:

Font 'Calibri' has not been found. Using 'Baekmuk Gulim' font instead. Reason: first available font.
Font 'MS Mincho' has not been found. Using 'Baekmuk Gulim' font instead. Reason: first available font.
Font 'PMingLiU' has not been found. Using 'Baekmuk Gulim' font instead. Reason: first available font.
Font 'SimSun' has not been found. Using 'Baekmuk Gulim' font instead. Reason: first available font.
Font 'MS Gothic' has not been found. Using 'Baekmuk Gulim' font instead. Reason: first available font.
Font 'Microsoft JhengHei' has not been found. Using 'Baekmuk Gulim' font instead. Reason: first available font.
Font 'Times New Roman' has not been found. Using 'Baekmuk Gulim' font instead. Reason: first available font.
Font 'Georgia' has not been found. Using 'Baekmuk Gulim' font instead. Reason: first available font.

If also specify SystemFontSource (on Windows), the rendered document look as expected:

pdf.getFontSettings().setFontsSources(new FontSourceBase[]{new SystemFontSource(), intradynFontSource});