Telerik Forums
Telerik Document Processing Forum
1 answer
1.2K+ views
Hi there, after many wasted hours of trying to find the right documentation, I am still unable to find where or how one would add markup to a pdf. 

If possible, could you please point me in the right direction, or make a simple tutorial for us? 

I am currently using RadFixedDocument, and have been able to, through a list of data, render those items as text fields on the pdf. 

I am just unable to add a string which contains HTML, and have it render accordingly. 

It just renders as the string it is. 

Dimitar
Telerik team
 answered on 09 Aug 2021
4 answers
551 views

Hi

Using Telerik.Windows.Documents.Spreadsheet.Model.Workbook class, it seems there is no VLOOKUP function, although there is a LOOKUP function which works almost the same way. The lack of VLOOKUP specifically impacts my ability to load existing Excel documents. Is there a way to add a VLOOKUP function to the SpreadProcessing engine?

Thanks,

Guy

Duncan
Top achievements
Rank 1
Iron
 answered on 08 Aug 2021
0 answers
183 views

We are migrating to telerik but our main issue is that XlsFormatProvider keep gaving OutOfMemoryException when importing files  either on stream or bytes, and this where easily imported on same machines using ASPOSE dlls

 

is there a way to have this sorted out another library i should use or different class?

Fernando
Top achievements
Rank 1
 updated question on 03 Aug 2021
1 answer
350 views

I need to put a series of aligned checkboxes in a specific location on a pdf.

We are able to fill in all the text fields and I have a destination added to the nameddestinations and I can draw text into it with the fixedcontenteditor, but I can not figure out how to put checkboxes on the form.

 

  document.NamedDestinations.Add("services", new Location() { Page = document.Pages[0], Left = 500, Top = 400 });


                NamedDestination destination = null;
                document.NamedDestinations.TryGetValue("services", out destination);

                if (destination != null)
                {
                    var loc = destination.Destination as Location;
                    var editor = new FixedContentEditor(destination.Destination.Page);

                    editor.Position.Translate(loc.Left.Value, loc.Top.Value);

                    CheckBoxField checkBoxField = new CheckBoxField("SampleCheckBox");
                    checkBoxField.IsChecked = true;

                    
                    editor.DrawText("Found the text box place!");
                }
Dimitar
Telerik team
 answered on 30 Jul 2021
3 answers
1.3K+ views

We are using a RadFixedDocument and RadFixedDocumentEditor to try to create a sample PDF

I can not find any documentation showing how to actually change the font info. Where are the specifics? Here is the code I have tried.

 

RadFixedDocument document = new RadFixedDocument();

            using (RadFixedDocumentEditor editor = new RadFixedDocumentEditor(document))
            {            

                List list = editor.Lists.AddList(ListTemplateType.BulletDefault);
                editor.ParagraphProperties.ListId = list.Id;
                editor.ParagraphProperties.ListLevel = 0;

                editor.InsertParagraph();
               // editor.CharacterFormatting.FontFamily.LocalValue = new FontFamily("Times New Roman");
                editor.InsertRun(new FontFamily("Times New Roman"), new FontStyle(3) , new FontWeight(15) , "Blazor Demo:");

                editor.ParagraphProperties.ListLevel = 1;
                editor.InsertParagraph();
                editor.InsertRun("This is a prototype to explore the various Architectual Elements needed for a SPOT rewrite.");

                editor.InsertParagraph();
                editor.InsertRun("Explore Blazor in regards to moving from a ASP.Net WebForm development team to Blazor MVC structure with.Net Core.");

                editor.InsertParagraph();
                editor.InsertRun("✓Use of EntityFramework within Blazor /.Net Core.");

                editor.InsertParagraph();
                editor.InsertRun("✓Basic Search screen with search fields.");

                editor.InsertParagraph();
                editor.InsertRun("✓Basic Edit screen with field validation both RealTime and on submitting.");

                editor.InsertParagraph();
                editor.InsertRun("✓Telerik Blazor controls, specially the Grid with Sorting and Paging, Dialogs, Pop_up windows.");

                editor.InsertParagraph();
                editor.InsertRun("✓BootStrap use with Blazor for page support of any screen resolution(within reason!).");

                editor.InsertParagraph();
                editor.InsertRun("✓Logging.");
                editor.InsertRun("✓Pass Fortify! Test with current SPOT settings.");

                editor.InsertParagraph();
                editor.InsertRun("✓Custom field validation(SSN / FIN, Phone number).");

                editor.InsertParagraph();
                editor.InsertRun("✓Creating our own Blazor components for fields like SSN.");

                editor.InsertParagraph();
                editor.InsertRun("✓Handle error messages from the server.");

                editor.InsertParagraph();
                editor.InsertRun(" Explore configuration files ");

                editor.InsertParagraph();
                editor.InsertRun(" Global Exception Handling and Logging ");

                editor.InsertParagraph();
                editor.InsertRun("✓Validation messages Resource file and i18n ");

                editor.InsertParagraph();
                editor.InsertRun(" Explore validation messages store in the DB.");

                editor.InsertParagraph();
                editor.InsertRun(" Authentication ");

                editor.InsertParagraph();
                editor.InsertRun("✓Session Timeout ");

                editor.InsertParagraph();
                editor.InsertRun(" Does it work with XUNIT ?");

                editor.InsertParagraph();
                editor.InsertRun("✓Does it work with Resharper ?");

                editor.InsertParagraph();
                editor.InsertRun("✓Popup windows and confirmation dialogs.");

                editor.InsertParagraph();
                editor.InsertRun("✓Calling stored procedures from EF core.");

                editor.InsertParagraph();
                editor.InsertRun(" SSRS Reporting Viewer and report interfacing."); //Dave talk to Cynthia, Cynthia says talk to Chou, Zhang

                editor.InsertParagraph();
                editor.InsertRun(" PDF generation "); //Dave do a pdf of this list

                editor.InsertParagraph();
                editor.InsertRun(" Unhandled Exception Handling(i.g.Reload message)");

 

}

                
Martin
Telerik team
 answered on 23 Jul 2021
2 answers
362 views

Can I add Bookmarks at PDF page ? How ?

 

Thanks

Martin
Telerik team
 answered on 22 Jul 2021
9 answers
746 views

Is it possible to create an index page with bookmarks to various other pages.  For example

 

PDF TITLE

1. Background

2. Contents

3. Summary

 

Where click on 1 would go to Page 5, click on 2 would go to page 10, etc... ?

Martin
Telerik team
 answered on 22 Jul 2021
1 answer
687 views

Hi Team,

1.I want to load css file when import css file(bootstrap) and then export to a pdf file, but I find I lost all the css style, my code is below, did I miss something?

                    Telerik.Windows.Documents.Flow.FormatProviders.Html.HtmlFormatProvider htmlProvider
                        = new Telerik.Windows.Documents.Flow.FormatProviders.Html.HtmlFormatProvider();
                    // Create a document instance from the content. 
                    HtmlImportSettings importSettings = new HtmlImportSettings();
                    importSettings.LoadImageFromUri += (s, e) =>
                    {
                        // Load the data representing the resource  
                        SystemNet.WebClient webClient = new SystemNet.WebClient();
                        byte[] data = webClient.DownloadData(e.Uri);

                        // Pass the loaded data to the arguments 
                        string extension = SystemIO.Path.GetExtension(e.Uri).Substring(1); // Get the extension without the dot 
                        e.SetImageInfo(data, extension);
                    };
                    importSettings.LoadStyleSheetFromUri += (s, e) =>
                    {
                        string styles = fs.File.ReadAllText(Server.MapPath("~") + e.Uri);
                        e.SetStyleSheetContent(styles);
                    };
                    htmlProvider.ImportSettings = importSettings;
                    htmlProvider.ImportSettings.DefaultStyleSheet = string.Empty;
                    RadFlowDocument document = htmlProvider.Import(htmlStr);
                    Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider pdfProvider
                        = new Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider();
                    // Export the document. The different overloads enables you to export to a byte[] or to a Stream. 
                    byte[] pdfBytes = pdfProvider.Export(document);

2. Can I use the code like below to set the default style to empty?

                    htmlProvider.ImportSettings.DefaultStyleSheet = string.Empty;
 

'

 

 

Ivan Ivanov
Telerik team
 answered on 19 Jul 2021
1 answer
2.5K+ views

When writing an application to convert HTML documents to PDF documents on the server side, my HTML document gets resized and becomes weirdly formatted. The before and after conversion is depicted below. I believe its because the original HTML page is much larger than the resulting PDF, causing some formatting issues when it is squished. Is there a way I can resize the HTML page before it is added to the PDF so that this does not happen? Or does anyone have any ideas about what is causing this in the first place?

It is not a problem with importing the HTML file itself, as importing to HTML and exporting back to HTML leaves a near identical result.

Thank you for your help.

 

Dimitar
Telerik team
 answered on 30 Jun 2021
1 answer
475 views

This code creates a document with 3 tables of increasing height. However, when measured each has the same height. How can a table's height be measured in a way that will account for text that wraps onto multiple lines?

Thanks,

Tim

 

        protected void AddTable(string header, string text, RadFixedDocumentEditor editor)
        {
            Table table = new Table();
            RgbColor bordersColor = new RgbColor(149, 179, 215);
            Border border = new Border(1, Telerik.Windows.Documents.Fixed.Model.Editing.BorderStyle.Single, bordersColor);
            table.Borders = new TableBorders(border);
            table.DefaultCellProperties.Borders = new TableCellBorders(border, border, border, border);
            table.DefaultCellProperties.Padding = new Thickness(5);
            table.Margin = new Thickness(10);

            TableRow tableRow = table.Rows.AddTableRow();
            TableCell tableCell = tableRow.Cells.AddTableCell();
            tableCell.Borders = new TableCellBorders(new Border(BorderStyle.None));

            Block block = tableCell.Blocks.AddBlock();
            block.HorizontalAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.HorizontalAlignment.Center;

            block.InsertText(header);

            tableRow = table.Rows.AddTableRow();
            tableCell = tableRow.Cells.AddTableCell();
            block = tableCell.Blocks.AddBlock();
            block.InsertText(text);

            double th = table.Measure().Height;
            editor.InsertTable(table);
            block = new Block();
            block.InsertText(th.ToString());
            editor.InsertBlock(block);
        }

        protected void btnTest_Click(object sender, EventArgs e)
        {
            RadFixedDocument radFixedDocument = new RadFixedDocument();
            using (RadFixedDocumentEditor editor = new RadFixedDocumentEditor(radFixedDocument))
            {
                AddTable("Table 1", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore", editor);

                AddTable("Table 2", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.", editor);

                AddTable("Table 3", "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.", editor);
            }

            PdfFormatProvider pdfFormatProvider = new PdfFormatProvider();
            using (FileStream fileStream = File.Open(@"C:\Temp\Test.pdf", FileMode.Create))
            {
                pdfFormatProvider.Export(radFixedDocument, fileStream);
            }
        }

                
Dimitar
Telerik team
 answered on 23 Jun 2021
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?