When Bold and Italic properties are set in the TrueType font file`s OS/2 table they are not respected and the OpenTypeFontSource`s Bold and Italic properties are not correct.
A small line is drawn in the top left corner when converting a paragraph with a shading color to a PDF
Workaround:
var table = header.Blocks.AddTable();
table.PreferredWidth = new TableWidthUnit(TableWidthUnitType.Percent, 100);
var row = table.Rows.AddTableRow();
var cell = row.Cells.AddTableCell();
cell.Shading.BackgroundColor = new ThemableColor(Colors.Red);
var head = new Run(doc);
head.Text = "Test";
var paragraph = cell.Blocks.AddParagraph();
paragraph.TextAlignment = Telerik.Windows.Documents.Flow.Model.Styles.Alignment.Center;
paragraph.Inlines.Add(head);
When invoking the FontsRepository.TryCreateFont() method to create Font from an installed TrueType font with font properties set (FontStyles.Italic, FontWeights.Bold) the name of the created font is not correct.
FontBase font;
bool isRegistered = FontsRepository.TryCreateFont(new FontFamily("Helvetica"), FontStyles.Italic, FontWeights.Bold, out font);
Expected:<Helvetica-BoldOblique>
Actual:<Helvetica,Italic>
Wrong calculations of new lines and white spaces between characters due to a wrong calculated character`s BoundingRect.
This results in missing whitespaces and/or characters split between lines.
According to the Pdf Specification: A given object number must not have an entry in more than one subsection within a single section.
The object on line 7 has object number 2, the same as of object on line 5.
Currently, when registering *.pfb font file with FontsRepository.RegisterFont method an exception is thrown during the font creation.
WORKAROUND: The font file may be converted to TTF format (*.ttf) which is successfully registered.
Some Shading elements are not property imported which leads to unexpected drawings on the exported (previewed in the PdfViewer) document.
When importing a document with a missing state separator (e.g. linefeed) in the object stream (ObjStm) an exception is thrown: System.InvalidCastException: 'Unable to cast object of type 'Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Types.PdfDictionary' to type 'Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Types.PdfInt'.'
А possible workaround could be handling the exceptions: Handling Exceptions.
When importing a document containing a CIDFont with default width (DW) set as PdfReal (double) an exception is thrown: System.InvalidCastException: 'Unable to cast object of type 'Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Types.PdfReal' to type 'Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Types.PdfInt'.'
44 0 obj
<< /BaseFont /NotoSansMono-Medium /CIDSystemInfo << ... >> /CIDToGIDMap /Identity /DW 600.00000 ... /Subtype /CIDFontType2 /Type /Font >>
endobj
According to the PDF Specification: DW - integer - (Optional) The default width for glyphs in the CIDFont. Default value: 1000.
PDF / X: the X stands for exchange; a PDF / X document can in principle be processed by any printing company. This means, for example, that only CMYK colors may be used, that all fonts must be present in the PDF, that the document must not be encrypted, and so on.
Hi,
I am trying to convert a HTML body to a PDF using HtmlFormatProvider and PdfFormatProvider.
It works well when I try to create a pdf with "normal" characters, but when I use characters like "åäö" the characters is either missing or replaced with other character.
I have found a similiar issue but that was due to the fact that the person was using .net core I am using .net framework.
Am I missing something when I am converting it to a PDF or is there a limitation with special characters like "åäö".
private string CreateAndStorePdf(string htmlBody)
{
Telerik.Windows.Documents.Extensibility.JpegImageConverterBase jpegImageConverter = new Telerik.Documents.ImageUtils.JpegImageConverter();
Telerik.Windows.Documents.Extensibility.FixedExtensibilityManager.JpegImageConverter = jpegImageConverter;
var provider = new HtmlFormatProvider();
var document = provider.Import(htmlBody);
var exportProvider = new PdfFormatProvider();
var fixedExportProvider = new Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider();
var fileName = "_original.pdf";
try
{
using (var outputStream = new MemoryStream())
{
exportProvider.Export(fixedExportProvider.ExportToFixedDocument(document), outputStream);
outputStream.Seek(0, SeekOrigin.Begin);
var pdfBytes = new BinaryReader(outputStream).ReadBytes((int)outputStream.Length);
return fileName;
}
}
catch (Exception ex)
{
Log.Error(ex, "The pdf could not be created.");
return null;
}
}
When using the RadFixedDocument.Pages.AddPage() method RadFixedPages are created without PageNumber set.
Such behavior is observed when exporting a RadFlowDocument to a RadFixedDocument using the ExportToFixedDocument as well.