Completed
Last Updated: 15 May 2024 17:23 by Gregory
Release 2024.2.426 (2024 Q2)

This is the code used for merging:

        private  void MergeDifferentDocumentsPagesWithFixed()
        {
            string[] documentsToMerge =
            {
                "14301-STOCK_Proforma.pdf",
                "14302-STOCK_Proforma.pdf",
                "14303-STOCK_Proforma.pdf",
                "14304-STOCK_Proforma.pdf",
                "14305-STOCK_Proforma.pdf",
                "14330-STOCK_Proforma.pdf"
            };
            RadFixedDocument doc = new RadFixedDocument();
            PdfFormatProvider provider = new PdfFormatProvider();
            foreach (string current_item in documentsToMerge)
            {
                string path = @"..\..\Samples\" + current_item;
                RadFixedDocument docToMerge;
                if (!File.Exists(path))
                {
                    continue;
                }
                using (Stream stream = File.OpenRead(path))
                {
                    docToMerge = provider.Import(stream);
                }
                doc.Merge(docToMerge);
            }


            string outputFilePath = @"..\..\mergedFixed.pdf";
            File.Delete(outputFilePath);

            using (Stream output = File.OpenWrite(outputFilePath))
            {
                provider.Export(doc, output);
            }
            Process.Start(new ProcessStartInfo() { FileName = outputFilePath, UseShellExecute = true });


        }

Workaround:  

   private void MergeDifferentDocumentsPages(string resultFileName)
   {
       string[] documentsToMerge =
       {
           "14301-STOCK_Proforma.pdf",
           "14302-STOCK_Proforma.pdf",
           "14303-STOCK_Proforma.pdf",
           "14304-STOCK_Proforma.pdf",
           "14305-STOCK_Proforma.pdf",
           "14330-STOCK_Proforma.pdf"
       };

       File.Delete(resultFileName);
       using (PdfStreamWriter fileWriter = new PdfStreamWriter(File.OpenWrite(resultFileName)))
       {
           foreach (string documentName in documentsToMerge)
           {
               string path = @"..\..\Samples\" + documentName;
               using (PdfFileSource fileToMerge = new PdfFileSource(File.OpenRead(path)))
               {
                   foreach (PdfPageSource pageToMerge in fileToMerge.Pages)
                   {
                       fileWriter.WritePage(pageToMerge);
                   }
               }
           }
       }


      
       Process.Start(new ProcessStartInfo() { FileName = resultFileName, UseShellExecute = true });
   }

Completed
Last Updated: 15 May 2024 06:30 by ADMIN
Release 2024.2.426 (2024 Q2)
A dictionary with an invalid entry cannot be imported correctly and breaks the import process. 
Completed
Last Updated: 15 May 2024 06:30 by ADMIN
Release 2024.2.426 (2024 Q2)

I have the following form:

From the screen shot above you can see that the line above 75 is perfectly ok i.e. it doesn't go and intersect with the lines of the 72

but when i perform the following code


            var InputFileWithInteractiveForms = "C:\\Users\\Abhishek.Shrestha\\Downloads\\Template\\form-ub04.pdf";
            var finaldPDFName = "C:\\Users\\Abhishek.Shrestha\\Downloads\\TestABCPDF\\output2322.pdf";
            List<byte[]> filledupForms = new List<byte[]>();
            PdfFormatProvider provider = new PdfFormatProvider();
                
                RadFixedDocument document = provider.Import(File.ReadAllBytes(InputFileWithInteractiveForms));

                var formfields = document.AcroForm.FormFields;

                var formFieldsCopy = new List<FormField>(document.AcroForm.FormFields);

                // Iterate over the copied form fields and replace the dot character in their names for solving merging issue
                foreach (var field in formFieldsCopy)
                {
                    field.Name = field.Name.Replace(".", "");
                }
                
               //added this as the values were being hidden by editable fields
                document.AcroForm.ViewersShouldRecalculateWidgetAppearances = true;

                filledupForms.Add(provider.Export(document));
                File.WriteAllBytes(finaldPDFName, provider.Export(document));

I get the following output:


               
Completed
Last Updated: 15 May 2024 06:29 by ADMIN
Release 2024.2.426 (2024 Q2)
Import-export causes missing characters with a specific document.
Completed
Last Updated: 15 May 2024 06:29 by ADMIN
Release 2024.2.426 (2024 Q2)
InvalidOperationException is thrown when exporting font that is available but not used.

The stack trace is as follows:
   at System.Linq.Enumerable.Max(IEnumerable`1 source)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.Fonts.Cid.CidSet.CopyPropertiesFrom(IPdfExportContext context, FontBase font)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.Fonts.CidFontDescriptor.CalculateCidSet(IPdfExportContext context, CidFontBase font)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.Fonts.CidFontDescriptor.<>c__DisplayClass34.<CopyPropertiesFrom>b__30()
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Utilities.PdfObjectsExtensions.ToPrimitive[P,T](PdfProperty`1 pdfProperty, Func`2 convertToPrimitive, Func`1 getDefaultValue)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.Fonts.CidFontDescriptor.CopyPropertiesFrom(IPdfExportContext context, FontBase font)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.Fonts.CidFontObject.CopyPropertiesFromOverride(IPdfExportContext context, FontBase font)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.Fonts.CidFontObject.CopyPropertiesFrom(IPdfExportContext context, FontBase font)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.Fonts.Type0FontObject.CopyPropertiesFromOverride(IPdfExportContext context, FontBase font)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Export.PdfExporter.WriteFontsFromContext(PdfWriter writer, IPdfExportContext context)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Export.PdfExporter.Export(IRadFixedDocumentExportContext context, Stream output)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider.ExportOverride(RadFixedDocument document, Stream output)
   at Telerik.Windows.Documents.Common.FormatProviders.FormatProviderBase`1.Export(T document, Stream output)
Completed
Last Updated: 15 May 2024 06:29 by ADMIN
Release 2024.2.426 (2024 Q2)
Completed
Last Updated: 15 May 2024 06:29 by ADMIN
Release 2024.2.426 (2024 Q2)
When parsing a CFF Type1 font a NullReferenceException is thrown.
Completed
Last Updated: 15 May 2024 06:29 by ADMIN
Release 2024.2.426 (2024 Q2)

A page with a negative value rotation is exported as a blank image.

Workaround: Use only the Enum Rotation values (Rotate0, Rotate90, Rotate180, Rotate270).

Completed
Last Updated: 15 May 2024 06:28 by ADMIN
Release 2024.2.426 (2024 Q2)
When merging documents with exactly the same font but different character widths, some characters are rendered with the wrong width.

Completed
Last Updated: 15 May 2024 06:28 by ADMIN
Release 2024.2.426 (2024 Q2)

If  row has a property set on it (for example "hidden" or a style), but it does not otherwise have any cells in it, the application might run into an infinite loop. The xml will look like this:

	<sheetData>
		<row r="1" spans="1:2" x14ac:dyDescent="0.35">
			<c r="A1"><v>1</v></c>
			<c r="B1"><v>2</v></c>
		</row>
		<row r="2" spans="1:2" s="1" customFormat="1" x14ac:dyDescent="0.35"/>
	</sheetData>

The last row has formatting applied, so it is present as an element, but has no cells. This file (when the xml is not formatted) will cause an infinite loop on import.

Completed
Last Updated: 15 May 2024 06:27 by ADMIN
Release 2024.2.426 (2024 Q2)
NullReferenceException caused by a Hyperlink Field during nested Mail Merge.
Completed
Last Updated: 15 May 2024 06:27 by ADMIN
Release 2024.2.426 (2024 Q2)
The text in the footer remains under the image while drawing the PDF content.
Completed
Last Updated: 15 May 2024 06:27 by ADMIN
Release 2024.2.426 (2024 Q2)

The attached gif file illustrates the inability to open the newly added file with the password: 

Sub Main()
	Dim sZipFilePath As String = "..\..\test.zip"
	File.Delete(sZipFilePath)

	CreateArchive(sZipFilePath)
	Dim decryptionSettings As DecryptionSettings = EncryptionSettings.CreateDecryptionSettings()
	AddHandler decryptionSettings.PasswordRequired, AddressOf DecryptionSettings_PasswordRequired
	Dim compressionSettings As CompressionSettings = Nothing
	Dim encoding As Encoding = Nothing
	Using oFS As FileStream = File.Open(sZipFilePath, FileMode.OpenOrCreate)


		Using oArchive As ZipArchive = ZipArchive.Update(oFS, encoding, compressionSettings, decryptionSettings)
			Using entry As ZipArchiveEntry = oArchive.CreateEntry("newText.txt")
				Dim writer As StreamWriter = New StreamWriter(entry.Open())
				writer.WriteLine("Hello world!")
				writer.Flush()
			End Using
		End Using
	End Using
End Sub

Private Sub CreateArchive(sZipFilePath As String)
	Using stream As Stream = File.Open(sZipFilePath, FileMode.Create)
		Dim _encryptionSettings As PasswordEncryptionSettings = EncryptionSettings.CreatePkzipPasswordEncryptionSettings()
		_encryptionSettings.Password = "telerik"
		Dim compressionSettings As CompressionSettings = Nothing
		Dim encoding As Encoding = Nothing

		Using archive As ZipArchive = ZipArchive.Create(stream, encoding, compressionSettings, _encryptionSettings)

			Using entry As ZipArchiveEntry = archive.CreateEntry("text.txt")
				Dim writer As StreamWriter = New StreamWriter(entry.Open())
				writer.WriteLine("Hello world!")
				writer.Flush()
			End Using
		End Using
	End Using
End Sub

Private Sub DecryptionSettings_PasswordRequired(ByVal sender As Object, ByVal e As PasswordRequiredEventArgs)
	e.Password = "telerik"
End Sub

 

Workaround: Until this bug is fixed the obsolete API could be used instead: 

ZipArchive archive = new ZipArchive(stream, ZipArchiveMode.Create, true, encoding, compressionSettings, encryptionSettings)
and
ZipArchive oArchive = new ZipArchive(stream, ZipArchiveMode.Update, true, encoding, compressionSettings, decryptionSettings)

Completed
Last Updated: 21 Mar 2024 05:53 by ADMIN
Release 2024.1.305 (2024 Q1)

Styles with names only different in spaces are treated as one.

Workaround:

var rtf = File.ReadAllText(fileName);
rtf = this.RenameStyleDifferentInOnlySpaces(rtf);
var document = provider.Import(rtf);

...

private string RenameStyleDifferentInOnlySpaces(string rtf)
{
    HashSet<string> styles = new HashSet<string>();

    string pattern = @"{\\(?:\*\\c)?s([0-9]+)[^}]*\n?[^}]*\\[^' ]* ?'?([^;]*)";

    var matches = Regex.Matches(rtf, pattern);
    foreach (Match match in matches)
    {
        string styleName = match.Groups[2].Value.Replace(" ", string.Empty);
        if (styles.Contains(styleName))
        {
            styleName = this.ReplaceOldStyleName(ref rtf, styles, match).Replace(" ", string.Empty);
        }

        styles.Add(styleName);
    }

    return rtf;
}

private string ReplaceOldStyleName(ref string rtf, HashSet<string> styles, Match match)
{
    string oldStyleName = match.Groups[2].Value;
    StringBuilder styleNameBuilder = new StringBuilder(oldStyleName + "0");
    while (styles.Contains(styleNameBuilder.ToString().Replace(" ", string.Empty)))
    {
        styleNameBuilder.Append("0");
    }

    string oldMatch = match.Groups[0].Value;
    string newMatch = oldMatch.Replace(oldStyleName, styleNameBuilder.ToString());
    rtf = rtf.Replace(oldMatch, newMatch);
    return styleNameBuilder.ToString();
}

Completed
Last Updated: 14 Mar 2024 09:00 by ADMIN
Release 2024.1.305 (2024 Q1)

Merge two documents (use the attached ones) that already have embedded files with the same names.

Observed: 

Image

Completed
Last Updated: 14 Mar 2024 09:00 by ADMIN
Release 2024.1.305 (2024 Q1)
The import action is successful, but then exporting the document throws the following exception: 
   at Telerik.Windows.Documents.Core.Fonts.Type1.Type1Format.Type1FontSource.GetFontFamily()
Completed
Last Updated: 14 Mar 2024 09:00 by ADMIN
Release 2024.1.305 (2024 Q1)

Hi there I have a pdf and whenever I try to Import the PDF file into PdfFormatProvider.Import method for flattening purposes, it throws null reference exception.

I have added a sample .net project with PDF added as source. You just need to run the project on your end. I am using version 2023.3.1106 of document processing library.

I am using ASP.NET 4.8 framework.

Thanks

Completed
Last Updated: 14 Mar 2024 09:00 by ADMIN
Release 2024.1.305 (2024 Q1)
This exception was originally thrown at this call stack:
    Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.DocumentStructure.DocumentCatalog.CopyEmbeddedFilesTo(Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Import.Parser.PostScriptReader, Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Import.IRadFixedDocumentImportContext) in DocumentCatalog.cs
Completed
Last Updated: 14 Mar 2024 09:00 by ADMIN
Release 2024.1.305 (2024 Q1)

A strange symbol is added as a name when embedding a file with an empty string as its name argument.

Image

Completed
Last Updated: 14 Mar 2024 09:00 by ADMIN
Release 2024.1.305 (2024 Q1)
For example exporting the text "\uD83D\uDE0A" with "Segoe UI Symbol" font family should export a single smiling face. Instead the characters are skipped during the export as PdfProcessing is trying to export them as separate char values ("\uD83D" and "\uDE0A") and the font does not contain glyphs corresponding to these char codes.
1 2 3 4 5 6