Telerik Forums
Telerik Document Processing Forum
1 answer
261 views

I would like to copy some pages from original document tonew pdf Document.

my Source code is based on merge document example proveded Telerik documenttaion:

Public Function ExtractPagesToPDF(pdfDocument() As Byte, pages() As Integer) As Byte() Implements IPdfPageExtractor.ExtractPagesToPDF
        Dim ms = New MemoryStream()
        Using pdfWriter = New PdfStreamWriter(ms)
            pdfWriter.Settings.DocumentInfo.Author = "TMS"
            pdfWriter.Settings.WriteAnnotations = True
            Using pdfStream = New MemoryStream(pdfDocument)
                Dim document = New PdfFileSource(pdfStream)
                For Each index In pages
                    If index >= document.Pages.Count Then
                        Throw New ArgumentException($"Page index {index} > Document page count {document.Pages.Count}.")
                    End If
                    pdfWriter.WritePage(document.Pages(index))
                Next
                ms.Position = 0
                Return ms.ToArray()
            End Using
        End Using
    End Function

if I try open  new document with with Telerik WPF RadPdfViewer my programm throws exception:

NotSupportedException: StartXRef keyword cannot be found.

Do I  miss some settings?

 
Martin
Telerik team
 answered on 03 Oct 2022
1 answer
172 views

Hi,

I am looking for writing Japanese characters using FixedContentEditor. Can u please suggest the code. 

 

Thanks in advance.

Aishwarya

Martin
Telerik team
 answered on 27 Sep 2022
1 answer
427 views

I'm using the HTMLFormatProvider to import HTML content into a RadFlowDocument. This content contains inline <svg> XML. When I use a PdfFormatProvider to attempt to export the HTML page as a PDF, the image is blank. Is it possible to export the SVG as part of that PDF when it is not a file but the actual SVG xml in the page?

 


                string htmlContent = task.Result;

                HtmlFormatProvider htmlProvider = new HtmlFormatProvider();
                
                RadFlowDocument document = htmlProvider.Import(htmlContent);
               
                PdfFormatProvider pdfProvider = new PdfFormatProvider();

                Telerik.Windows.Documents.Extensibility.JpegImageConverterBase jpegImageConverter = new JpegImageConverter();
                Telerik.Windows.Documents.Extensibility.FixedExtensibilityManager.JpegImageConverter = jpegImageConverter;
                
                foreach(Section section in document.Sections)
                {
                    section.Rotate(Telerik.Windows.Documents.Model.PageOrientation.Landscape);
                    section.PageMargins = new Telerik.Windows.Documents.Primitives.Padding(10);
                }
                byte[] pdfBytes = pdfProvider.Export(document);

Dimitar
Telerik team
 answered on 15 Sep 2022
0 answers
204 views

Hello,

Using a RadFlowDocument, I must generate dynamic headers for columns of data. There is no template or way to know ahead of time what headers are needed, so we have to recursively extract data and render tables/rows within outer cells, to align the data w/ the proper column. Overall this works fine. However, tables do not, as far as I can tell, stretch to fit the space their cells, so I'm left with these gaps (in blue in first attached image), as the overall height of the main header row is set by the column with the largest/tallest data, in this case the group of columns with the red borders. 

Is there any way to get the inner tables to stretch to fill that available height?

Note: The different color backgrounds and borders in attached image are for debugging purposes

The general structure of Cells/Rows/Tables that I end up with following this recursive build is described in the second attached image. Rows are red, cells are green, and tables are blue. Perhaps there is another way to build the header that I am not considering. 

Thank you

Edit: I solved the problem changing tactics. I queried the list of headers for a maximum depth and created that number of rows. Added the rows to a list and passed the list to the recursive function. Instead of creating a new table for each subcategory, the code now just adds the item to the proper row, index based on the item's depth, and with proper RowSpan and ColumnSpan values, I'm able to get the desired placement. Image added for comparison. 

Jeff
Top achievements
Rank 1
 updated question on 14 Sep 2022
1 answer
181 views

Using Document Processing library in .NET 6 Blazor application.

is Telerik.Windows.Documents cross-platform or only for Windows?

 

 

 

 

Dimitar
Telerik team
 answered on 05 Sep 2022
1 answer
831 views

Hi,

I'm trying to add a PNG image into a PDF file, but it doesn't work. I app crash when I reach the following instructions :

PdfFormatProvider provider = new PdfFormatProvider();
File.WriteAllBytes (path, provider.Export (document));

Adding a JPG image works fine. If I don't add the PNG, It works fine too.

I'm working with Telerik UI for Xamarin. How can I add this PNG ? It's a PNG with transparancy, does it matter ?

Thank you !

 

Dimitar
Telerik team
 answered on 10 Aug 2022
1 answer
303 views
Is there a way to determine if text in a cell has the effect of Strikethrough?
Dimitar
Telerik team
 answered on 01 Aug 2022
1 answer
441 views

I have a large PDF file with a combination of paragraphs and tables and would like to export from PDF to Docx in order to format the tables. Then after formatting the tables, would like to export that back to PDF.

I can manage the code logic for the tables but do not see how to export from PDF to Word or Docx. In addition I do not see how to programmatically go through the PDF components using the Telerik Document Processing API.  Could you please help?

Dimitar
Telerik team
 answered on 22 Jul 2022
1 answer
441 views

Hi,

I have used the below code to get letters bold in creating the pdf .

block.TextProperties.TrySetFont(new FontFamily("Calibri Light (Headings)"), FontStyles.Normal, FontWeights.Bold);

But I am not able to see the result in pdf . Provide me if any solution available. 

I have used the FixedContentEditor in creating the pdf.

            RadFixedDocument radFixedDocument = new RadFixedDocument();
            RadFixedPage page = radFixedDocument.Pages.AddPage();
            FixedContentEditor editor = new FixedContentEditor(page);

Thanks in advance

Svilen
Telerik team
 answered on 20 Jul 2022
1 answer
659 views

 

We are using the PDFFormatProvider and RadFlowDocument to convert the HTML string to PDF file.  We need a sample code to add the watermark image to the PDF file. 

Language : C#:

Please find the attached code

ex pdfProvider.Export(document);

 

Thanks

 

Regards,

Babu Durairaji

Dimitar
Telerik team
 answered on 20 Jul 2022
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?