Telerik Forums
Telerik Document Processing Forum
3 answers
909 views

Hi,

i have 2 RadFixedDouments and i want to merge them in one RadFixedDocument.

Merge method works ok but i add new page for each of document.

My goal is to create one document which looks like this:

1. Content from *NameOfFirstDocument*:

-- here content --

2. Content from *NameOfSecondDocument*:

-- here content --

 

I almost done this:

- created RadFixedDocument (call it Main),

- used RadFixedDocumentEditor.InsertBlock( block with "1. Content from *NameOfFirstDocument*:" ) on Main document,

- set FixedContentEditor proper position (under block),

- foreach Content element in one and only Page in FirstDocument use FixedContentEditor.Draw to add content (as a TextFragment) on Main document,

- the same things for second document.

The problem is when i'm exporting Main document to pdf, it is cutting content of each document if it is larger than one page.

 

It looks like FixedContentEditor.Draw add lines but it does not take in account page size.

 

Any help with copying content of one RadFixedDocument to other? It's strange i cant use in any of ways a RadFixedDocumentEditor to insert other RadFixedDocument content in next lines.

 

Thanks,

Jacob.

Tanya
Telerik team
 answered on 11 Aug 2016
1 answer
176 views

Hi,

here is my sample console app:

using System.IO;
using Telerik.Windows.Documents.FormatProviders.Pdf;
using Telerik.Windows.Documents.Model;
 
namespace PdfExportTest
{
    class Program
    {
        static void Main(string[] args)
        {
            RadDocument doc = new RadDocument();
            RadDocumentEditor editor = new RadDocumentEditor(doc);
 
            Section section = new Section();
            doc.Sections.Add(section);
 
            editor.Document.CaretPosition.MoveToStartOfDocumentElement(section);
            editor.InsertLine("TEST");
 
            var provider = new PdfFormatProvider();
 
            using (Stream stream = new FileStream(@"C:\\temp\\test.pdf", FileMode.Create))
            {
                provider.Export(doc, stream);
            }
        }
    }
}

When use search option to find "TEST", Adobe Reader shows it couldn't find any matching words.

Is it known issue that Adobe Reader can't find words in exported documents?

Thanks.

Deyan
Telerik team
 answered on 10 Aug 2016
8 answers
145 views

Hi,

I have a simple Word document with JUST a line of text and a DocumentVariable in it, named VAR1. I try to set a value for it in my ASP application, and it works, but when I try to update the field using the UpdateFields() methods, it throws a NullReferenceException. I think it might be a bug in the library, because I tried on several different documents. Can you please help me figure this out? The code it's pretty straightfoward. Maybe it's something wrong with the document?

DocxFormatProvider docxProvider = new DocxFormatProvider();
RadFlowDocument document;
                
using (Stream input = File.OpenRead(docxFilePath))
    document = docxProvider.Import(input)

//document.DocumentVariables.Add("VAR_LINE1", "testline1");
document.DocumentVariables["VAR1"] = "testline1";
try
{
     document.UpdateFields(); // throws exception
} catch (Exception ex) {}

 

Thank you!

Boyko
Telerik team
 answered on 03 Aug 2016
8 answers
657 views

Hi,

I am using the PdfFormatProvider to create pdf files from RadFlowDocument, however the result is not equal to the original layout.

Lines disappear and the table cell padding is wrong.

Please find attached:

Image1: The original file displayed in the RichTextEditor

Image2: The pdf file displayed in the PDF Viewer

Using a standard pdf printer form word renders the word file OK.

 

 

Tanya
Telerik team
 answered on 02 Aug 2016
4 answers
1.4K+ views
I am using PDF processing to generate PDF's for invoicing. I am looking to use tables to hold general information on the other but curious as to what it can handle in terms of sizing capabilities.

My first inquiry is with setting the table to be a specific size, I noticed in documentation that there is a TableLayoutType.FixedWidth; but I couldn't seem to find anything to set the width.

My second inquiry is about the ability to have text in one cell go to a new line and continue. For example if one cell has a very long input of strings or numbers, if it reaches a certain length or the table, it could wrap down to the next cell and continue.

I have been looking through and using the RadPdfProcessing > Editing > Table and haven't seen much to specifically help me with this.

Any suggestions would be appreciated.
Boyko
Telerik team
 answered on 22 Jul 2016
3 answers
204 views
Hi!

I created a worksheet via SpreadProcessing, export it to PDF and all works well. Now I would like to have a footer (eg. like in Excel, footer-left, footer-center, footer-right) and maybe also a header which gets repeated on each page, in addition I need the column headers to be repeated on each page. How can I achieve that?

Regards
Neils
Boyko
Telerik team
 answered on 20 Jul 2016
4 answers
1.2K+ views

Hi,

as a proof of concept, I want to load a Docx in a Kendo Editor and save it back. So far, I'm able to

  1. load a Docx, convert it to HTML
  2. then using Telerik ASP.Net MVC Editor I'm able to modify the HTML
  3. Save it back to a new Docx document

The issues I have is that the new docx don't have the same margins as the original document and it also takes 4 pages instead of 2. You can take a look at the screenshots attached (before/after).

 

Is there a way to configure the styles and the page setup ?

 

here is the code that I use. Basically, I have a Kendo Editor in my view that loads the HTML and a button to save back the data

 

[HttpPost]
public ActionResult Editor(string editor)
{
    // HTML decode the value before using it.
    var notes = System.Web.HttpUtility.HtmlDecode(editor);
      
    var htmlProvider = new HtmlFormatProvider();
    RadFlowDocument document = htmlProvider.Import(notes);
 
    SaveDocx(document);
     
    return View();
}
 
public ActionResult Editor()
{
    RadFlowDocument sourceDoc = GetSourceDocument();
    SaveDocx(sourceDoc);
    var myHtmlContent = GetHtmlFromDocument(sourceDoc);
 
    ViewBag.MyHtmlContent = myHtmlContent;
 
    return View();
}
 
private RadFlowDocument GetSourceDocument()
{
    var docxProvider = new DocxFormatProvider();
    var stream = new MemoryStream(System.IO.File.ReadAllBytes(@"c:\Temp\TelerikMvcApp1\TelerikMvcApp1\Fiche.docx"));
    RadFlowDocument document;
 
    using (Stream input = System.IO.File.OpenRead(@"c:\Temp\TelerikMvcApp1\TelerikMvcApp1\Fiche.docx"))
    {
        document = docxProvider.Import(stream);
    }
 
    return document;
}
 
private string GetHtmlFromDocument(RadFlowDocument document)
{
    var myHtmlContent = "";
    using (MemoryStream ms = new MemoryStream())
    {
        HtmlFormatProvider htmlProvider = new HtmlFormatProvider();
        myHtmlContent = htmlProvider.Export(document);
    }
 
    return myHtmlContent;
}
 
private void SaveDocx(RadFlowDocument document)
{
    using (Stream output = System.IO.File.OpenWrite(String.Format(@"c:\Temp\TelerikMvcApp1\TelerikMvcApp1\Fiche{0}.docx", DateTime.Now.Ticks)))
    {
        DocxFormatProvider docxProvider = new DocxFormatProvider();
        docxProvider.Export(document, output);
    }
}

 

thanks

Pierre Yves
Top achievements
Rank 1
 answered on 19 Jul 2016
1 answer
330 views

Hi,

I am creating an pdf document from an html, which contains a number of images. I notice a difference between the pdf created and when viewing the html in a browser. For example the html contains css to resize the images, however it appears this does not happen during the pdf conversion process, so the images look too big.

Thanks

I use the code below to create the pdf

try {     using (var inputHtml = new MemoryStream(htmlEncoding.GetBytes(sourceString)))     {         var htmlProvider = new HtmlFormatProvider();         var document = htmlProvider.Import(inputHtml);         var editor = new RadFlowDocumentEditor(document);         using (Stream output = new FileStream(targetFolder + targetFilename, FileMode.OpenOrCreate))         {             var pdfProvider = new PdfFormatProvider();             pdfProvider.Export(document, output);         }     } }

Tanya
Telerik team
 answered on 07 Jul 2016
1 answer
228 views
I am currently converting a byte array of a spreadsheet which is stored in a database into a workbook from the XlsxFormatProvider, after doing this I am then converting this workbook into a PDF for export which all works fine. My issue is that during the conversion the formulas used to calculate values is being shown rather then the actual result.
Petya
Telerik team
 answered on 16 Jun 2016
5 answers
512 views

Hi,

please help me.

This is my problem:

I compress some files with this code

Try
            Using st As Stream = File.OpenWrite(FileZippato)
                Using zipArchive As ZipArchive = New ZipArchive(st, ZipArchiveMode.Create, False, Nothing)
                    For Each f As String In FileOrigine
                        Extensions.ZipFile.CreateEntryFromFile(zipArchive, f, Path.GetFileName(f))
                    Next
                End Using
            End Using

        Catch ex As Exception
            Globale.Log.BoxErrore(ex)
        End Try

so everything is right

when I unzip the file with

            Extensions.ZipFile.ExtractToDirectory(FileOrigine, CartellaDestinazione)

catch this exception "folder access denied".

of course access to this folder is totally free
Nikolay Demirev
Telerik team
 answered on 16 Jun 2016
Narrow your results
Selected tags
Tags
+? more
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Cynthia
Top achievements
Rank 1
Iron
Toby
Top achievements
Rank 3
Iron
Iron
Iron
Danielle
Top achievements
Rank 1
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Iron
yw
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?