Telerik Forums
Telerik Document Processing Forum
1 answer
569 views

I want to report bug with this code:

byte[] file = File.ReadAllBytes("Test.pdf");  
            RadFixedDocument document = null;
            var prov = new PdfFormatProvider();
            using (var input = new MemoryStream())
            {
                input.Write(file, 0, file.Length);
                document = prov.Import(input);
            }
When I tried to import my document to RadFixedDocument  it says:
Ex: {"Stack empty."}
Stack trace:
   at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
   at System.Collections.Generic.Stack`1.Peek()
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Import.Parser.PostScriptReader.PushToken(PdfPrimitive primitive)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Import.Parser.PrimitiveParsers.ArrayParser.End()
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Import.Parser.PostScriptReader.<BuildStateMachine>b__8(PostScriptReaderArgs b)
   at Telerik.Windows.Documents.Data.StateMachine.State`1.ExecuteActionIfNotNull(Action`1 action, TArgs arguments)
   at Telerik.Windows.Documents.Data.StateMachine.State`1.Enter(TArgs arguments)
   at Telerik.Windows.Documents.Data.StateMachine.StateMachine`1.GoToState(State`1 state, TArgs arguments)
   at Telerik.Windows.Documents.Data.StateMachine.StateMachine`1.GoToNextState(TArgs arguments)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Import.Parser.PostScriptReader.Read(IPdfImportContext context, Int64 endPosition)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Import.Parser.PostScriptReader.Read(IPdfImportContext context)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Import.ContentStreamInterpreter.ReadContentPrimitives()
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Import.ContentStreamInterpreter.Execute()
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.DocumentStructure.ContentStream.ParseContentData(Byte[] data, IRadFixedDocumentImportContext context, IResourceHolder resourceHolder, IContentRootElement contentRoot)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.DocumentStructure.Page.CopyPropertiesTo(PostScriptReader reader, IRadFixedDocumentImportContext context, RadFixedPage fixedPage)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.DocumentStructure.DocumentCatalog.CopyPagePropertiesTo(PostScriptReader reader, IRadFixedDocumentImportContext context)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.DocumentStructure.DocumentCatalog.CopyPropertiesTo(PostScriptReader reader, IRadFixedDocumentImportContext context)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Import.RadFixedDocumentImportContext.BeginImportOverride()
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Import.BaseImportContext.BeginImport(Stream pdfFileStream)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Import.PdfImporter.Import(Stream input, IPdfImportContext context)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider.ImportOverride(Stream input)
   at Telerik.Windows.Documents.Common.FormatProviders.FormatProviderBase`1.Import(Stream input

Please fix this issue.

Tanya
Telerik team
 answered on 31 Jul 2019
3 answers
171 views

Good morning,

When going through the PDF with PdfProcessing, it gives me weird text in some elements which I presume is metadata of the pdf.
As for other PDFs who are not created out of Telerik it works fine...

I also checked the Telerik forum a lot, desperately finding a possible and proper solution/alternative for this, but unfortunately.   

I just simply need to read normal text out of my Telerik report, I don't want to export the text, I only wanna extract that text so I can draw an image under it.

My question is simple : Does Telerik have solutions to deal with this issue?

I have attached a snippet of my problem when I'm debugging in Visual Studio and the Telerik Report I try to read.
Thanks

Kurt Berlanger

Tanya
Telerik team
 answered on 30 Jul 2019
8 answers
537 views
How can I add QR-code to the Word file in a specific place?
Андрей
Top achievements
Rank 1
 answered on 29 Jul 2019
1 answer
129 views
Can I convert a lot of wmf files to 1 pdf file using Telerik tools?  Thanks.
Georgi
Telerik team
 answered on 19 Jul 2019
1 answer
365 views

I'm trying to write a simple script to merge two files together. 

The files that are created show as corrupt. Is there something im doing wrong?

Sub Main()
      Dim file1 As Byte() = ReadFile("e:\test1\test1.pdf")
      Dim result As New IO.MemoryStream
      Dim fileWriter As New PdfStreamWriter(Result, True)
 
      Dim pdfSource As New PdfFileSource(New IO.MemoryStream(file1))
      For Each pg As PdfPageSource In pdfSource.Pages
          fileWriter.WritePage(pg)
      Next
 
      Dim b As Byte()
      b = Result.ToArray()
      Dim writer As IO.FileStream = IO.File.OpenWrite("e:\test1\abc12222.pdf")
      writer.Write(b, 0, b.Length)
      writer.Close()
 
  End Sub
  Function ReadFile(filename As String) As Byte()
      Dim io As New IO.FileInfo(filename)
      Dim fs As IO.FileStream = io.OpenRead
      Dim b() As Byte
      ReDim b(io.Length)
      fs.Read(b, 0, io.Length)
      fs.Close()
      Return b
  End Function
Peshito
Telerik team
 answered on 04 Jul 2019
1 answer
153 views

hi sir,

 

              I compress the main level with five level of sub folder using telerik it compress in to one single folder.But i want same like as before compress(i want to follow same folder structure while extract).

the below image show as original

http://prntscr.com/o7djqa

this one i need

http://prntscr.com/o7dkmt

but it show 

http://prntscr.com/o7dkmt

i send the project it has two button button one work i use oridanry zip format but button2 not work properly i use telerik

https://www.dropbox.com/s/i5pwsbbthkab5jy/WebSitesss.rar?dl=0

 

Tanya
Telerik team
 answered on 02 Jul 2019
4 answers
727 views

Hello,

I have a RadFlowDocument that I am exporting to PDF via the standard flow PDFFormatProvider. If the document has some text that used the Arial Narrow font that is either bold, italicized or both the PDF output is always showing just plain Arial Narrow. This seems to be the only font that is having this problem.

Has anyone else encountered this or have any suggestions on how to fix it?

Thanks,

-Tom

Georgi
Telerik team
 answered on 19 Jun 2019
3 answers
417 views
Is it possible while creating a document with WordsProcessing to create a table of content just like I can do that using Microsoft Word Interop?
Peshito
Telerik team
 answered on 17 Jun 2019
3 answers
248 views
Trying to create pdf to print address labels on existing 3 column Avery 8460 form. I am using Telerik.Windows.Documents.Fixed.Model.RadFixedDocument and RadFixedDocumentEditor with Telerik.Windows.Documents.Fixed.Model.Editing.Tables.Table but can't get everything to line up. I'm thinking using Block with position and size would be better. Can anyone point me in the right direction? ASP.NET C# Any examples out there? Thanks Fred
Tanya
Telerik team
 answered on 13 Jun 2019
1 answer
932 views

Hi all, 

I'm using RadPdfProcessing for ASP.NET MVC to create pdf template for financial documents. Sometimes content of some tables can be various length. In this case I'd like to move lower blocks/tables to a new page and generate pdf document with two pages. I'm using RadFixedDocument and FixedContentEditor to create tables/blocks on the document.  Piece of ode below:

  public static RadFixedDocument CreateDocument()
{
      RadFixedDocument document = new RadFixedDocument();
      RadFixedPage page = new RadFixedPage();          
       page.Size = new Size(600, 750);           
             
      FixedContentEditor editor = new FixedContentEditor(page);
      document.Pages.Add(page);
 
      editor.Position.Translate(defaultLeftIndent + 330, defaultTopIndent);
            DrawTable(editor, maxWidth);
 
            editor.Position.Translate(defaultLeftIndent, defaultTopIndent + 70);
            DrawTitle(editor, maxWidth);
 
            editor.Position.Translate(defaultLeftIndent, defaultTopIndent + 110);
            DrawTableWithDetails(editor, maxWidth);
            
            editor.Position.Translate(defaultLeftIndent, defaultTopIndent + 220);
            DrawReceiverTable(editor, maxWidth);
         
             private static void DrawTable(FixedContentEditor editor, double maxWidth)
        {
            Table table = new Table();
            table.LayoutType = TableLayoutType.AutoFit;
            table.DefaultCellProperties.Padding = new Thickness(1);
 
            #region FIRST ROW
            TableRow firstRow = table.Rows.AddTableRow();
            TableCell firstCell = firstRow.Cells.AddTableCell();
            Block firstBlock = firstCell.Blocks.AddBlock();
            firstBlock.TextProperties.FontSize = 10;
            firstBlock.TextProperties.Font = FontsRepository.Helvetica;
            firstBlock.InsertText("xxxxxxxxx");
 
            TableCell secondCell = firstRow.Cells.AddTableCell();
            Block secondBlock = secondCell.Blocks.AddBlock();
            secondBlock.TextProperties.FontSize = 10;
            secondBlock.TextProperties.Font = FontsRepository.Helvetica;
            secondBlock.InsertText(" xxxxxxxxx");
            #endregion
            editor.DrawTable(table, new Size(maxWidth, double.PositiveInfinity));
 
        }
 
        private static void DrawTitle(FixedContentEditor editor, double maxWidth)
        {
            Block block = new Block();
            block.HorizontalAlignment = Telerik.Windows.Documents.Fixed.Model.Editing.Flow.HorizontalAlignment.Center;
            block.TextProperties.Font = FontsRepository.HelveticaBold;
            block.TextProperties.FontSize = 16;
            block.InsertText("xxxxxxxxx");
            block.InsertText("<xxxxxxxxx>");
            editor.DrawBlock(block, new Size(maxWidth, double.PositiveInfinity));
        }
 
        private static void DrawTableWithDetails(FixedContentEditor editor, double maxWidth)
        {
            Table table = new Table();
            table.LayoutType = TableLayoutType.FixedWidth;
            table.DefaultCellProperties.Padding = new Thickness(1);
            Border border = new Border();
            Border whiteBorder = new Border(0, BorderStyle.None, new RgbColor(255, 255, 255));
            table.DefaultCellProperties.Borders = new TableCellBorders(border, border, border, border);
            #region FIRST ROW
            TableRow firstRow = table.Rows.AddTableRow();
            TableCell firstCell = firstRow.Cells.AddTableCell();
            Block firstBlock = firstCell.Blocks.AddBlock();
            firstBlock.TextProperties.Font = FontsRepository.HelveticaBold;
            firstBlock.InsertText("xxxxxxxxx");
            TableCell secondCell = firstRow.Cells.AddTableCell();
            Block secondBlock = secondCell.Blocks.AddBlock();
            secondBlock.TextProperties.Font = FontsRepository.HelveticaBold;
            secondBlock.InsertText("xxxxxxxxx");
            #endregion
            #region SECOND ROW
            TableRow secondRow = table.Rows.AddTableRow();
            firstCell = secondRow.Cells.AddTableCell();
            firstCell.Borders = new TableCellBorders(border, border, border, whiteBorder);
            firstBlock = firstCell.Blocks.AddBlock();
            firstBlock.TextProperties.FontSize = 10;
            firstBlock.InsertText("xxxxxxxxx");
            secondCell = secondRow.Cells.AddTableCell();
            secondCell.Borders = new TableCellBorders(border, border, border, whiteBorder);
            secondBlock = secondCell.Blocks.AddBlock();
            secondBlock.TextProperties.FontSize = 10;
            secondBlock.InsertText("xxxxxxxxx");
            #endregion
            editor.DrawTable(table, new Size(maxWidth, double.PositiveInfinity));
        }
 
        private static void DrawReceiverTable(FixedContentEditor editor, double maxWidth)
        {
            Table table = new Table();
            table.LayoutType = TableLayoutType.FixedWidth;
            table.DefaultCellProperties.Padding = new Thickness(1);
            Border border = new Border();
            Border whiteBorder = new Border(0, BorderStyle.None, new RgbColor(255, 255, 255));
            table.DefaultCellProperties.Borders = new TableCellBorders(border, border, border, border);
            #region TABLE CONTENT
            TableRow firstRow = table.Rows.AddTableRow();
            TableCell firstCell = firstRow.Cells.AddTableCell();
            Block firstBlock = firstCell.Blocks.AddBlock();
            firstBlock.TextProperties.Font = FontsRepository.HelveticaBold;
            firstBlock.InsertText("xxxxxxxxx");
 
            TableRow secondRow = table.Rows.AddTableRow();
            firstCell = secondRow.Cells.AddTableCell();
            firstCell.Borders = new TableCellBorders(border, border, border, whiteBorder);
            firstBlock = firstCell.Blocks.AddBlock();
            firstBlock.TextProperties.FontSize = 10;
            firstBlock.InsertText("xxxxxxxxx");
            #endregion
            editor.DrawBlock(table, new Size(maxWidth, double.PositiveInfinity));
        }
}
Nikolay Demirev
Telerik team
 answered on 13 Jun 2019
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
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
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?