Telerik Forums
Telerik Document Processing Forum
1 answer
14 views

Hi,

Which is the better way of getting the 'as displayed' cell value?


Dim selection As CellSelection = worksheet.Cells(i, j)
Dim value As ICellValue = selection.GetValue().Value
Dim format As CellValueFormat = selection.GetFormat().Value
Dim formatResult As CellValueFormatResult = format.GetFormatResult(value)
Dim result As String 

result = value.GetResultValueAsString(format)
'vs.
result =  formatResult.VisibleInfosText   

             

Thanks,

Sid

Tanya
Telerik team
 answered on 02 Mar 2022
1 answer
18 views

Hi,

I like to use the PageSetup in RadSpreadstreamProcessing. I have an generated Excel File and I would like to set Papersize and other configurations. When I integrate it in my Code the IPageSetupExporter is not known.

using (IWorkbookExporter workbookExporter = SpreadExporter.CreateWorkbookExporter(format, documentStream))
            {
                using (IWorksheetExporter worksheetExporter = workbookExporter.CreateWorksheetExporter(nameWorksheet))
                {

                 ..........

               using (IPageSetupExporter pageSetupExporter = worksheetExporter.CreatePageSetupExporter())
                        {

                        ..................

                        }

               }

           }

I get also the message that the IWorksheetExporter doesn't include a definition "CreatePageSetupExporter"?

Has anyone an example how to use this?

Regards

John

Svilen
Telerik team
 answered on 02 Mar 2022
1 answer
19 views
I am able to modify the field correctly and get them to have the correct value. When I export/save the file the form textboxes are all rotated vertically and the only fix I have been able to do is to modify the rotation of the field text in another editor. This kind of ruins the idea of code filling the pdf forms and automating the process. PDFFormatProvider / Telerik Document Processing library is 2022.1.106. I tried rotating the field after value edit to 0,90,etc...and they have all resulted in the similar issue.
John
Top achievements
Rank 1
Iron
 answered on 24 Feb 2022
3 answers
28 views

Hello,

many problemes with this code :

 PdfFormatProvider provider = new PdfFormatProvider();
            RadFixedDocument document = provider.Import(File.ReadAllBytes(InputFileWithInteractiveForms6));

 

with pdf exemple of telerik (InteractiveForms.pdf) it is ok.

with pdf issues of Excel or Word on my pc (save as .pdf) it is ok.

 

but with pdf issues of Nuance Software.

sometime, i have this error : Object reference not set to an instance of an object

sometime : Unable to cast object of type 'Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.DocumentStructure.PdfResource' to type 'Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Types.PdfDictionary

 

the properties of my file are :

 

can you help me ?

thank you

eric

 


 

Eric
Top achievements
Rank 1
Iron
 answered on 23 Feb 2022
1 answer
36 views

Hi there,

What is the easiest way to change the font weight of a text? 

Thank you.

Svilen
Telerik team
 answered on 17 Feb 2022
1 answer
64 views

I've been scouring the docs, but I can't find anything.

I have to fall back to using a Syncfusion PDF, but I want to remove that dependency.

Svilen
Telerik team
 answered on 17 Feb 2022
10 answers
874 views

Hi,

Is there any way to convert/rasterize an existing PDF file to JPG file(s) using PDFProcessing library?

Regards

Blas

JeffSM
Top achievements
Rank 2
Veteran
Iron
 answered on 16 Feb 2022
1 answer
125 views

As explained in https://www.telerik.com/forums/size-of-pdf-document

RadPdfProcessing does not embed the whole font but instead embeds only the font subset of the used characters which guarantees minimum font size

 

I want to use a docx as a template for PDF,  so from your sample github https://github.com/telerik/document-processing-sdk/tree/master/WordsProcessing/ContentControls

I use Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider.ExportToFixedDocument to create a RadFixedDocument

then use Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider to export to final PDF.

The problem is the docx is using non standard font, so when I embed the font set (normal, italic, bold, italic bold) the final PDF size reached 3MB with just simple text and no image. This PDF is definitely embedding the full font sets, not the subset.

Is this scenario unsupported or bug?

 

I modified your DocumentGenerator.cs in ContentControls_NetStandard project. Must copy the segoeui.ttf and seguili.ttf to the SampleData folder.


 //overwrite this
        private void Save(RadFlowDocument document)
        {
            IFormatProvider<RadFlowDocument> formatProvider = new DocxFormatProvider();

            string path = "CVTemplate.docx";
            using (FileStream stream = File.OpenWrite(path))
            {
                formatProvider.Export(document, stream);
            }

            Console.WriteLine("Document generated.");

            ProcessStartInfo psi = new ProcessStartInfo()
            {
                FileName = path,
                UseShellExecute = true
            };

            Process.Start(psi);

            //modification
            ExportToFixedDocumentPdfFromRadFlowDocumentDocx(document);
        }

        private void ExportToFixedDocumentPdfFromRadFlowDocumentDocx(RadFlowDocument document)
        {
            //handle png image for NetStandard
            Telerik.Windows.Documents.Extensibility.JpegImageConverterBase jpegImageConverter = new Telerik.Documents.ImageUtils.JpegImageConverter();
            Telerik.Windows.Documents.Extensibility.FixedExtensibilityManager.JpegImageConverter = jpegImageConverter;

            using (FileStream stream = File.Create("ExportedToFixedDocumentPdfFromRadFlow_with_embeddedFont.pdf"))
            {
                // Read the font file -- copy these 2 ttf to sample folder
                byte[] fontDataNormal = File.ReadAllBytes($"{SampleDataFolder}segoeui.ttf");
                byte[] fontDataLight = File.ReadAllBytes($"{SampleDataFolder}seguili.ttf");

                // Register the font set 
                Telerik.Documents.Core.Fonts.FontFamily fontFamily = new Telerik.Documents.Core.Fonts.FontFamily("Segoe UI");
                Telerik.Documents.Core.Fonts.FontFamily fontFamily2 = new Telerik.Documents.Core.Fonts.FontFamily("Segoe UI Light");

                Telerik.Windows.Documents.Fixed.Model.Fonts.FontsRepository.RegisterFont(
                    fontFamily,
                    Telerik.Documents.Core.Fonts.FontStyles.Normal,
                    Telerik.Documents.Core.Fonts.FontWeights.Normal, fontDataNormal);
                Telerik.Windows.Documents.Fixed.Model.Fonts.FontsRepository.RegisterFont(
                    fontFamily2,
                    Telerik.Documents.Core.Fonts.FontStyles.Normal,
                    Telerik.Documents.Core.Fonts.FontWeights.Normal, fontDataLight);

                //export the docx RadFlowDocument to RadFixedDocument
                var radFixedDocument = (new Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider()).ExportToFixedDocument(document);

                var fixedFormatProvider = new Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider();
                fixedFormatProvider.Export(radFixedDocument, stream);
            }
        }

 

 

 

 

 

Martin
Telerik team
 answered on 15 Feb 2022
4 answers
71 views

Hello,

I have the following code that loads a PDF :

byte[] file = File.ReadAllBytes(@"c:\big.pdf");
RadFixedDocument doc = null;
var prov = new PdfFormatProvider();
using (var input = new MemoryStream())
{
   input.Write(file, 0, file.Length);
   doc = prov.Import(input);
}

 

On import I am getting the following exception :

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.PdfName'.

 

I attached the pdf used to this. Could you please let me know what the problem is? (Telerik version used is 2017.1.116.40)

Thank you.

Eric
Top achievements
Rank 1
Iron
 answered on 11 Feb 2022
1 answer
27 views
Hi,

We are creating a document with multiple tables using RadFlowDocument and exporting to byte array through DocxFormatProvider. Later converting to PDF document.

We are facing the problem to set the width of the table to align with complete document. Please refer the attached DocxFormatProvider_Export_toBytes.pdf which is having the tables(consider from second table) with right side space is left out.

The same is working fine when we export the RadFlowDocument to byte array through PdfFormatProvider (PDFFormatProvider_Export_toBytes.pdf).  The attached PDF documents are created through below code. 

----- Code -----

RadFlowDocument Targetdoc = new RadFlowDocument();

//Added Contents to Targetdoc 

DocxFormatProvider rfDocxProvider = new DocxFormatProvider();
byte[] docxoutput = rfDocxProvider.Export(Targetdoc);

var rPdfProvider = new PdfFormatProvider();
byte[] pdfoutput = rPdfProvider.Export(Targetdoc);

//PDF Files created

Version: 2021.1.322

We need to export from DocxFormatProvider only as we need to repeat the table header row for next pages.
Please help us to resolve table width issue.
Dimitar
Telerik team
 answered on 09 Feb 2022
Narrow your results
Selected tags
Tags
+? more
Top users last month
Benjamin
Top achievements
Rank 2
Iron
Christopher
Top achievements
Rank 1
Iron
Bernd
Top achievements
Rank 4
Bronze
Iron
Iron
Timothy J
Top achievements
Rank 1
Iron
Iron
Iron
Marian
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Benjamin
Top achievements
Rank 2
Iron
Christopher
Top achievements
Rank 1
Iron
Bernd
Top achievements
Rank 4
Bronze
Iron
Iron
Timothy J
Top achievements
Rank 1
Iron
Iron
Iron
Marian
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?