In Development
Last Updated: 13 Mar 2024 17:09 by ADMIN

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:


               
In Development
Last Updated: 04 Apr 2024 06:43 by ADMIN
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)
In Development
Last Updated: 29 Mar 2024 10:37 by ADMIN
SearchResult's GetWordBoundingRect returns the Rect of only the first word of the whole match.
In Development
Last Updated: 01 Mar 2024 10:43 by ADMIN
Import-export causes missing characters with a specific document.
In Development
Last Updated: 15 Apr 2024 08:37 by ADMIN
When parsing a CFF Type1 font a NullReferenceException is thrown.
In Development
Last Updated: 19 Mar 2024 09:08 by ADMIN
In scenarios with negative font and/or negative horizontal scaling the text is not rendered correctly.
In Development
Last Updated: 28 Mar 2024 12:22 by ADMIN

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

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

In Development
Last Updated: 16 Apr 2024 11:02 by ADMIN
In Development
Last Updated: 18 Apr 2024 12:11 by ADMIN

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 });
   }

In Development
Last Updated: 18 Apr 2024 12:13 by ADMIN
When merging documents with exactly the same font but different character widths, some characters are rendered with the wrong width.