Telerik Forums
Telerik Document Processing Forum
1 answer
75 views

I'm creating a spreadsheet Workbook, then exporting it to PDF. Each cell I write has a custom style where the FontSize is being set to 9 (and I'm also setting up fills and font effects, like bold).

When I get through writing the data to the Worksheet(s) in the Workbook, I then call AutoFitWidth on the Columns that have data.

Finally, I use the PdfFormatProvider to write the entire Workbook to a PDF file.

My problem is that text items in the cells are being clipped, even when there is room to fit them after calling AutoFitWidth.

For example:

It seems to be worse on strings with all caps. Sometimes it's just half a letter, other times it's multiple letters (the ATMOSPHERICCORR is supposed to be ATMOSPHERICCORROSION).

Here's another export in a different format:

As you can see, there's two problems based on calculating the required width. First is that AutoFitWidth is not giving enough space (mostly in the second example), but as you can see in the first example, even when there is enough horizontal space, it's still clipping off the text area within the cell.

Is the estimation assuming no caps, or is the font size/font family throwing it off (9pt)? Or am I missing something where I can force it to make more space?

Dimitar
Telerik team
 answered on 29 May 2023
1 answer
32 views

Hi - I'm trying to open accessible Word document (with stuff like tags, alternative text on images, etc.), but when I'm saving in to PDF all of that is gone. Looking at this: https://docs.telerik.com/devtools/document-processing/libraries/radpdfprocessing/howto/comply-with-pdfa-standard I've tried to set `ComplianceLevel` but nothing has changed, pdf is inaccessbile. Should I set something additional? Is this supported?

Version I'm using is: 2023.1.104, platform is .NET 7

I've attached the code that I'm running and the template that I'm working on.

Dimitar
Telerik team
 answered on 26 May 2023
0 answers
61 views

Hi there,

 

I need to create a pdf with various different tabs. So, I work with RadPdfProcessing.

In order to create a next page when there is no more place on the current page, I set a method that measures the available size on the page (without margin) and the size of the object to draw, before drawing it. If there is enough space, I draw it on current page, if not, I create a new page and draw it on.
But when I run my code, some tables are drawn in the margin of my page, as you can see on attached pictures.
I don't understant why. And when debugging, measures are working fine...
Could someone explain me what I'm missing or doing wrong please?

Here is my code :

Code about measuring object and page creation

        public static readonly Size _pageSize = new(Unit.MmToDip(210), Unit.MmToDip(297));
        public static readonly Thickness _margins = new(Unit.MmToDip(15));

        public static DocumentContainer CreateNewPage(RadFixedDocument document)
        {
            var page = document.Pages.AddPage();
            var editor = new DocumentContainer(page, _pageSize, new Padding(_margins.Top, _margins.Right, _margins.Bottom, _margins.Left));
            //if not first page, position the editor between margins 
            if(document.Pages.Count != 1) 
                editor.Position.Translate(_margins.Left, _margins.Top);
            return editor;
        }

        public static DocumentContainer CheckRemainingSpaceAndCreateNewPageIfNeeded(IBlockElement elementToDraw, DocumentContainer editor, RadFixedDocument document)
        {
            var remainingHeight = editor.PageHeight - _margins.Bottom  - editor.Position.Matrix.OffsetY;
            var neededSize = elementToDraw.Measure(new Size(editor.PageInternWidth, editor.PageInternHeight));

            if(remainingHeight < neededSize.Height)
            {
                return CreateNewPage(document);
            }

            return editor;
        }

 

Code about table creation

        public static Table CreateTable(BorderStyle borderStyle = BorderStyle.None)
        {
            return new Table
            {
                Borders = new TableBorders(new Border(borderStyle)),
                LayoutType = TableLayoutType.FixedWidth,
            };
        }

And the code about table drawing


        private Table DrawOneStyleTable(...)
        {
            var oneCellPadding = new Thickness(Unit.MmToDip(5));
            var anotherCellPadding = new Thickness(Unit.MmToDip(5), Unit.MmToDip(2), Unit.MmToDip(5), Unit.MmToDip(2));

            //Add table
            Table table = Helper.CreateTable();
            table.DefaultCellProperties.Padding = new Thickness(5);

            table.Borders = new TableBorders(new Border(2, BorderStyle.Single, mycolor));

            //Add rows

            _editor = Helper.CheckRemainingSpaceAndCreateNewPageIfNeeded(table, _editor, _document);
            _editor.DrawTable(table, _editor.PageInternWidth);
            return table;
        }

        private Table DrawSecondStyleTable(...)
        {
            //Add table and row
            Table table = Helper.CreateTable();
            //Add content

            _editor = Helper.CheckRemainingSpaceAndCreateNewPageIfNeeded(table, _editor, _document);
            _editor.DrawTable(table, _editor.PageInternWidth);
            return table;
        }

 

Please do not hesitate to ask me more information if needed.

 

Thank you in advance for your help,
Regards,
Adrian

Adrian
Top achievements
Rank 1
Iron
 asked on 25 May 2023
2 answers
48 views

Hi all,

 

I need to create some profile cards on a document based on the style template attached here. At the end of the process, the document should be exported in pdf.

I have tried a lot of things with RadWordsProcessing and RadPdfProcessing but I'm not sure I would be able to obtain the exact same result because of style limitations like rounded corners unavailable, for example.

Does anybody have any idea how I could create something the most similar possible? With any Telerik Document Processing tool.

I also tried to make a table (structured as in attached picture) but I didn't succeed to create the table with a colored background or image background (on all the table) and with the profile picture which should be place in a circle shape, ahead the table background. 

As I'm new to Telerik, my knowledge is limited, but I didn't find any information that helps me.  On the contrary, I only found information that make me doubt about the feasibility of this project.

 

Any help would really be appreciated,

Thank you in advance,

Adrian

 

Adrian
Top achievements
Rank 1
Iron
 answered on 15 May 2023
4 answers
557 views

Hello,

I have a problem. I want to create a table which should be right-aligned.

But when I try to set table.Alignment to Right It does not work.

I export this document into PDF.

 

Here is a sample code and the result screenshot.

 

1.RadFlowDocument document = new RadFlowDocument();
2.Table table = document.Sections.First().Blocks.AddTable();
3.table.Alignment = Alignment.Right;
4.TableRow row = table.Rows.AddTableRow();
5.TableCell cell = row.Cells.AddTableCell();
6.cell.Blocks.AddParagraph().Inlines.AddRun("sample text");
Richard
Top achievements
Rank 1
Iron
 answered on 12 May 2023
0 answers
46 views

I encountered this error in console when the application is initially rendered or run. We are using telerik UI for blazor.  Never encountered with this issue before, do anyone have any idea why this error is occurred and any possible solutions to it?

 

Anup
Top achievements
Rank 1
 updated question on 11 May 2023
1 answer
126 views

Hi all,

 

I'm trying to import a word document as template, and change some text from this document with RadWordsProcessing in order to fill this document automatically.

In order to do that, I assume I must import the document as a RadFlowDocument and then change some text with the Replace method and finally export the modified document. But, when I import the word document and export it without any change, all text in text boxes or in shapes has disappeared. Is there any step or any configuration I missed?

Here is my code :

    RadFlowDocument document;
    DocxFormatProvider provider = new DocxFormatProvider();
    using (Stream input = File.OpenRead(myTemplateFilePath)
    {
        document = provider.Import(input);
    }

    //Change my text here with replace method
    //RadFlowDocumentEditor editor = new RadFlowDocumentEditor(document); 
    //editor.ReplaceText("oldText",  "newText");

    IFormatProvider<RadFlowDocument> formatProvider = new DocxFormatProvider();
    using (FileStream stream = File.OpenWrite(myResultFilePath))
    {
        formatProvider.Export(document, stream);
    }

    Console.WriteLine("Document generated.");

 

Pictures of my template file and my result file are attached here.

 

Thank you in advance for your help,
Regards,

Adrian

Aleks
Telerik team
 answered on 05 May 2023
1 answer
60 views

Hi,

We would like to know if we can add extra fields to a signed pdf document without invalidating the signatures and also if we open the pdf to be able to trace the addons.  

Please see the attached image.

If possible provide us  sample code how we can achieve that in case your library has this functionality

thanks

john

Yoan
Telerik team
 answered on 05 May 2023
1 answer
92 views

Hi,

I have some issues converting doc or docx files to pdf.

Attachment has the code sample and 2 documents.

Problem_with_footer.docx after transformation does not render bold chars and does not display footer at all..

Changes_Signature_position.doc after transformation the position of Signature place is not correct.

 

Any  help would be appreciated

Thanks

John

Yoan
Telerik team
 answered on 04 May 2023
1 answer
79 views

I need to rotate the text vertically.

It seems the TextRotation is unavailable when using Telerik.Documents.SpreadsheetStreaming.SpreadCellStyle.

How do I apply text rotation to a style using SpreadsheetStreaming?

 

Thanks,

 

Jim

Anna
Telerik team
 answered on 28 Apr 2023
Narrow your results
Selected tags
Tags
+? more
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?