Hello,
I'm having an issue with text justification not being maintained when going from a Docx > PDF.
I have to do a little bit of a conversion dance (to get fonts embedded), but basically I'm importing some HTML into a RadDocument, exporting that RadDocument as a DocX, importing that DocX into a RadFlowDocument and then finally exporting that to PDF.
The HTML has the text justified and the DocX also shows the text justified, but when it comes out in the PDF the text is no longer justified. Do you have any suggestion on how to fix this?
Thanks!
-Tom
Hi I'm trying to read a zip file which contains multiple files. Few of the files inside is named in Japanese (and Chinese).
My file: こんにちわ.csv becomes vhtjd.csv instead. I hope you can guide me.
Here is my code:
using (ZipArchive zip = new ZipArchive(stream, ZipArchiveMode.Read, true, System.Text.Encoding.UTF8))
{
foreach (ZipArchiveEntry e in zip.Entries)
{
string file= e.Name.ToString();
}
}
Hi,
I'd like to ask if there are ways to detect if the zip file is password protected. Just to give you a background of what I want to accomplish. I have a application that extract zip files. Zip files may be password protected and/or not password protected. By doing that, I will know if I will prompt a dialog box so that the user will enter the zip file password.
Initially, I tried to extract the file without the Encryption parameter to test if it can be extracted. Unfortunately, the files still get extracted only that it contains some funny characters.
using (ZipArchive zip = new ZipArchive(stream))
{
foreach (ZipArchiveEntry e in zip.Entries
{
using (Stream sw = File.Create(Path.Combine(FileDestination, e.FullName)))
{
Stream enterySTream = e.Open();
Telerik.WinControls.Zip.Extensions.ZipFile.CopyStreamTo(enterySTream, sw);
sw.Flush();
}
}
}
I have the latest Winforms Telerik version installed.
Thank you.
Hi,
I'm using PdfProcessing to create invoices from a template and I have included a header and a footer. Following my template, the body
is a Table with TableRow and TableCell. In each row I have a text, big or small, the lenght of the text influence the height of the cell. I don't have issues so far.
When my text
contains \n (carriage return) then I use this code to have my new line:
string[] lines = invoice.Libelle.Split('\n');
for (int l = 0; l < lines.Count(); l++)
{
editor.InsertText(lines[l]);
if (l + 1 < lines.Count())
{
editor.InsertBreak(BreakType.LineBreak);
}
}
But I get
an error when I try to generate invoice:
Message
d'erreur :
Width and Height must be non-negative.
Sur la méthode :
Void .ctor(Double, Double)
La trace de la pile :
at System.Windows.Size..ctor(Double width, Double height) at
Telerik.Windows.Documents.Fixed.Model.Editing.Tables.TableCell.get_DesiredSize()
at Telerik.Windows.Documents.Fixed.Model.Editing.Tables.TableCell.Measure(Size
availableSize) at
Telerik.Windows.Documents.Fixed.Model.Editing.Tables.Table.CalculateRowHeights()
at Telerik.Windows.Documents.Fixed.Model.Editing.Tables.Table.Measure(Size
availableSize) at
Telerik.Windows.Documents.Fixed.Model.Editing.Tables.Table.Draw(FixedContentEditor
editor, Rect boundingRect) at
Telerik.Windows.Documents.Fixed.Model.Editing.Flow.SectionInfo.InsertBlockElement(IBlockElement
blockElement) at
Telerik.Windows.Documents.Fixed.Model.Editing.RadFixedDocumentEditor.InsertBlock(IBlockElement
block) at
Telerik.Windows.Documents.Flow.FormatProviders.Pdf.Export.PdfExporter.ExportSection(Section
section, RadFixedDocumentEditor editor) at
Telerik.Windows.Documents.Flow.FormatProviders.Pdf.Export.PdfExporter.ExportDocument(RadFlowDocument
document, RadFixedDocumentEditor editor) at
Telerik.Windows.Documents.Flow.FormatProviders.Pdf.Export.PdfExporter.Export() at
Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider.ExportToFixedDocument(RadFlowDocument
document) at Facturation_FacturePdf.<>c__DisplayClass3.b__2(FactureForPrintEntity
f) in
So, I find
out the issue. Contrary to this editor.InsertBreak(BreakType.LineBreak), with editor.InsertText(Environement.NewLine) I
don’t get an error but I have a big space between my two lines. So I remove the old code and I use this simple instruction :
editor.InsertText(invoice.Libelle.Replace("\n", " \n"));
I have a carriage return but I still have the same problem, a big space.
I have two questions:
1) What are the differences between these two instructions and why I get an error ?
2) Is it possible to remove or reduce the space between two lines using my last code?
3) There is maybe an other way?
The error
comes not always but only in specific invoices and depends on the text inside
my cell. I can post the code if you need it.
NB : In
addition, I use negative padding in my cells to have a good height, I don’t
know if this influence the error.
Hello, I have the following situation:
My application has a set of actions defined by the adminsitrator, in this case I have two actions where the application extracts a single sheet from a given xlsx file, fills it with data. Later another action extracts the other sheet from the same xlsx file, fills it with data too. And then the application, as it notices that the file being modified is the same resulting file, tries to merge back both sheets in a single xlsx file.
My problem is, both sheets have some complex styling, and after trying to merge both sheets in a single file, everything stays in place except for some font styles/colors/... Is there any way to achieve a merge of both sheets without losing those styles?
I'm attaching some screenshots, in case you need the original file let me know how to send it.
Thanks
Hello,
I'm importing an html which contains table (100x6), This process is becoming very time consuming when my cells have borders. See the times below:
Code:
var provider =
new
HtmlFormatProvider();
Provider.Import(html);
With borders => 12 seconds (https://jsfiddle.net/kya78c0m/)
No borders => 1 seconds (https://jsfiddle.net/3eucxd2e/)
Is there any way to reduce this time when I'm using borders?
Hi,
We are getting the following exception when importing a PDF:with version 2016.2.815
Type: System.NotImplementedException
Message: The method or operation is not implemented.
Source: Telerik.Windows.Documents.Fixed
TargetSite:
Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.ColorSpaces.ColorBase
GetColor(Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Types.PdfArray)
StackTrace: at
Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.ColorSpaces.IccBased.GetColor(PdfArray
components)
at
Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Operators.Color.SetColorNBase.LoadPatternColor(ContentStreamInterpreter
interpreter, IPdfContentImportContext context, Pattern patternColorSpace)
at
Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Operators.Color.SetColorNBase.Execute(ContentStreamInterpreter
interpreter, IPdfContentImportContext context)
at
Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Import.ContentStreamInterpreter.Execute()
at
Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.DocumentStructure.ContentStream.CopyPropertiesTo(PostScriptReader
reader, IPdfImportContext context, IResourceHolder resourceHolder, IContentRootElement
contentRoot)
at
Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.DocumentStructure.Page.CopyPropertiesTo(PostScriptReader
reader, IPdfImportContext context, RadFixedPage fixedPage)
at
Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.DocumentStructure.DocumentCatalog.CopyPropertiesTo(PostScriptReader
reader, IPdfImportContext context)
at
Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Import.RadFixedDocumentImportContext.BeginImport(PostScriptReader
reader)
at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider.ImportOverride(Stream
input)
I assume there is something about the PDF and its colours that is not supported in the PdfProcessing classes. Any idea what that might be and how we can work around it?