Telerik Forums
Telerik Document Processing Forum
3 answers
545 views

Hi guys,

this is my problem, I want to zip a folder that contains several pdf files.

I can do it! Ok, I created a zip that contains my pdf files.

But I found all pdf files corrupted, some files I can open it, but it has white page!

I attach my 2 project: 1st is my little library, 2nd it my test project

Thi is my code,

My little library and test project console:

01.//My method of my little class library
02.public void CreateZipToAllFiles(string parFolderToArchive,
03.                                string parZipName,
04.                                string parDestinationZipFile)
05.{
06.    LastError = "";
07. 
08.    try
09.    {
10.        //Apro lo il canale per la creazione del file zip
11.        using (Stream stream = File.Open(string.Format(@"{0}\{1}",
12.                                         parDestinationZipFile,
13.                                         parZipName), FileMode.Create))
14.        {
15.            //Credo l'archivio logico di compressione
16.            using (ZipArchive archive = new ZipArchive(stream,
17.                                                       ZipArchiveMode.Create, false, null))
18.            {
19.                //Leggo dalla cartella i file trovati
20.                foreach (var fileInfo in new DirectoryInfo(parFolderToArchive).GetFiles())
21.                {
22.                    //Creo un movimento per ogni file trovato
23.                    using (ZipArchiveEntry entry = archive.CreateEntry(fileInfo.Name))
24.                    {
25.                        using (StreamReader sr = new StreamReader(fileInfo.FullName, true))
26.                        {
27.                            //Archivio il file corrente nel file zip
28.                            StreamWriter writer = new StreamWriter(entry.Open());
29. 
30.                            while (sr.Peek() >= 0)
31.                                writer.Write((char)sr.Read());
32.                             
33.                            writer.Flush();
34.                        }
35.                    }
36.                }
37.            }
38.        }
39.    }
40.    catch (Exception ex)
41.    {
42.        StringBuilder sb = new StringBuilder("ZipForNav.CreateZipToAllFiles");
43.        sb.AppendLine(ex.Message);
44. 
45.        if(ex.InnerException!=null)
46.        {
47.            sb.AppendLine(ex.InnerException.Message);
48.        }
49. 
50.        LastError = sb.ToString();
51.    }
52.}
53. 
54.//Test by project console
55.static void Main(string[] args)
56.{
57.    Zip.ZipForNav zip = new Zip.ZipForNav();
58.    zip.CreateZipToAllFiles(@"C:\Temp\Folder to zip", "myzipfile.zip", @"C:\Temp\Destination folder");
59. 
60.    if (zip.LastError != "")
61.        Console.Write(zip.LastError);
62.    else
63.        Console.Write("OK");
64. 
65.    Console.ReadLine();
66.}

Nikolay Demirev
Telerik team
 answered on 22 Jul 2015
1 answer
148 views

1.  Asp.net page is normal page created by telerik(not mvc), user can  input value.

2. I want click one button,i can convert current asp.net page  to pfd and send email(this pdf should save in server,and pfd as the attached )

Petya
Telerik team
 answered on 21 Jul 2015
4 answers
281 views

 The mailmerge method doesn't display on intellisense, or if i just type it in, it doesnt still work.  Says its not a member of radflowdocument.

Screenshot attached showing all the other methods, properties, etc.

I have these references:

<assemblies>
        <add assembly="Telerik.Windows.Documents.Core, Version=2015.2.623.40, Culture=neutral, PublicKeyToken=5803CFA389C90CE7"/>
        <add assembly="Telerik.Windows.Documents.Fixed, Version=2015.2.623.40, Culture=neutral, PublicKeyToken=5803CFA389C90CE7"/>
        <add assembly="Telerik.Windows.Documents.Flow, Version=2015.2.623.40, Culture=neutral, PublicKeyToken=5803CFA389C90CE7"/>
        <add assembly="Telerik.Windows.Documents.Flow.FormatProviders.Pdf, Version=2015.2.623.40, Culture=neutral, PublicKeyToken=5803CFA389C90CE7"/>
        <add assembly="Telerik.Windows.Maths, Version=2015.2.623.40, Culture=neutral, PublicKeyToken=5803CFA389C90CE7"/>
        <add assembly="Telerik.Windows.Zip, Version=2015.2.623.40, Culture=neutral, PublicKeyToken=5803CFA389C90CE7"/>

 

Any ideas why?  Appreciate it.

David
Top achievements
Rank 1
 answered on 17 Jul 2015
2 answers
567 views

I am trying to create a multi-section PDF report and am getting this error when doing the second .InsertTable:

System.ArgumentException: The document element is associated with another parent.

Something like this:

var pdfDocument = new RadFixedDocument()
{
    DocumentInfo =
    {
        Title = packageTitle,
        Author = packageRunBy
    }
};
pdfDocument.Destinations.AddPageHorizontalFit();
var pdfEditor = new RadFixedDocumentEditor(pdfDocument);

foreach (var report in reports)
{

if (pdfDocument.Pages.Count > 0) pdfEditor.InsertSectionBreak();

var reportTable = new Table();

// Build the Table

pdfEditor.InsertTable(reportTable); // Errors here on the second time around the loop

}

Petya
Telerik team
 answered on 16 Jul 2015
1 answer
81 views
Upon exporting data from gridview the attached format of data is displayed. Please guide me to make it correct
Kostadin
Telerik team
 answered on 10 Jul 2015
4 answers
472 views

I have been scouring the documentation looking for help on the following:

  1. How to set the Overall PDF Orientation to Landscape
  2. How to set the Margins
  3. How to set Footer and Header on all or some pages

My scenario is fairly simple.  I am creating a Table and inserting it into the RadFixedDocument using ​.InsertTable(MyTable).  Now I need to set the PDF to Landscape, reduce the Margins and set some Header / Footer information

Dan
Top achievements
Rank 1
 answered on 09 Jul 2015
3 answers
363 views

Are there any examples of dynamically generating a PDF report that is essentially a formatted table containing data by looping through an object - using this new PdfProcessing control?  

Dan
Top achievements
Rank 1
 answered on 07 Jul 2015
9 answers
670 views
Hi!

I'm trying to add files to a zip package and my filename contains swedish characters (ÅÄÖåäö).
This characters are converted into \+' .

Something with the encoding of my filenames isn't right.
How can I fix this?

Regards
Per
Radoslav
Telerik team
 answered on 06 Jul 2015
2 answers
205 views

Hi, I am new to PDFProcessing, was following the example codes, but could not compile...Error 2 Argument 1: cannot convert from 'Telerik.Windows.Pdf.Documents.Fixed.Model.RadFixedPage' to 'Telerik.Windows.Documents.Fixed.Model.Common.IContentRootElement' 

Error 1 The best overloaded method match for 'Telerik.Windows.Documents.Fixed.Model.Editing.FixedContentEditor.FixedContentEditor(Telerik.Windows.Documents.Fixed.Model.Common.IContentRootElement)' has some invalid arguments 
 

I am using version 2015.1.331.40, runtime version v4.0.30319

 

RadFixedDocument document = new RadFixedDocument();
RadFixedPage page = document.Pages.AddPage();
FixedContentEditor editor = new FixedContentEditor(page);
editor.DrawText("Hello RadPdfProcessing!");
PdfFormatProvider provider = new PdfFormatProvider();
using (Stream output = File.OpenWrite("Hello.pdf"))
{
provider.Export(document, output);
}

cwk
Top achievements
Rank 2
 answered on 22 Jun 2015
5 answers
338 views

When I try the examples to download a pdf from chrome, the pdf displays in the viewer but when I click save icon it tries to save with the page name of: 

defaultcs.aspx

How can I get it to save/prompt for save as PDFDocument.pdf?

Marty

 

Kostadin
Telerik team
 answered on 03 Jun 2015
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?