Hi,
Is there any way to convert/rasterize an existing PDF file to JPG file(s) using PDFProcessing library?
Regards
Blas
As explained in https://www.telerik.com/forums/size-of-pdf-document
RadPdfProcessing does not embed the whole font but instead embeds only the font subset of the used characters which guarantees minimum font size
I want to use a docx as a template for PDF, so from your sample github https://github.com/telerik/document-processing-sdk/tree/master/WordsProcessing/ContentControls
I use Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider.ExportToFixedDocument to create a RadFixedDocument
then use Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider to export to final PDF.
The problem is the docx is using non standard font, so when I embed the font set (normal, italic, bold, italic bold) the final PDF size reached 3MB with just simple text and no image. This PDF is definitely embedding the full font sets, not the subset.
Is this scenario unsupported or bug?
I modified your DocumentGenerator.cs in ContentControls_NetStandard project. Must copy the segoeui.ttf and seguili.ttf to the SampleData folder.
//overwrite this
private void Save(RadFlowDocument document)
{
IFormatProvider<RadFlowDocument> formatProvider = new DocxFormatProvider();
string path = "CVTemplate.docx";
using (FileStream stream = File.OpenWrite(path))
{
formatProvider.Export(document, stream);
}
Console.WriteLine("Document generated.");
ProcessStartInfo psi = new ProcessStartInfo()
{
FileName = path,
UseShellExecute = true
};
Process.Start(psi);
//modification
ExportToFixedDocumentPdfFromRadFlowDocumentDocx(document);
}
private void ExportToFixedDocumentPdfFromRadFlowDocumentDocx(RadFlowDocument document)
{
//handle png image for NetStandard
Telerik.Windows.Documents.Extensibility.JpegImageConverterBase jpegImageConverter = new Telerik.Documents.ImageUtils.JpegImageConverter();
Telerik.Windows.Documents.Extensibility.FixedExtensibilityManager.JpegImageConverter = jpegImageConverter;
using (FileStream stream = File.Create("ExportedToFixedDocumentPdfFromRadFlow_with_embeddedFont.pdf"))
{
// Read the font file -- copy these 2 ttf to sample folder
byte[] fontDataNormal = File.ReadAllBytes($"{SampleDataFolder}segoeui.ttf");
byte[] fontDataLight = File.ReadAllBytes($"{SampleDataFolder}seguili.ttf");
// Register the font set
Telerik.Documents.Core.Fonts.FontFamily fontFamily = new Telerik.Documents.Core.Fonts.FontFamily("Segoe UI");
Telerik.Documents.Core.Fonts.FontFamily fontFamily2 = new Telerik.Documents.Core.Fonts.FontFamily("Segoe UI Light");
Telerik.Windows.Documents.Fixed.Model.Fonts.FontsRepository.RegisterFont(
fontFamily,
Telerik.Documents.Core.Fonts.FontStyles.Normal,
Telerik.Documents.Core.Fonts.FontWeights.Normal, fontDataNormal);
Telerik.Windows.Documents.Fixed.Model.Fonts.FontsRepository.RegisterFont(
fontFamily2,
Telerik.Documents.Core.Fonts.FontStyles.Normal,
Telerik.Documents.Core.Fonts.FontWeights.Normal, fontDataLight);
//export the docx RadFlowDocument to RadFixedDocument
var radFixedDocument = (new Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider()).ExportToFixedDocument(document);
var fixedFormatProvider = new Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider();
fixedFormatProvider.Export(radFixedDocument, stream);
}
}
Hello,
I have the following code that loads a PDF :
byte
[] file = File.ReadAllBytes(@
"c:\big.pdf"
);
RadFixedDocument doc =
null
;
var prov =
new
PdfFormatProvider();
using
(var input =
new
MemoryStream())
{
input.Write(file, 0, file.Length);
doc = prov.Import(input);
}
On import I am getting the following exception :
Unable to cast object of type 'Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Types.PdfReal' to type 'Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Types.PdfName'.
I attached the pdf used to this. Could you please let me know what the problem is? (Telerik version used is 2017.1.116.40)
Thank you.
Hi All,
I'm new to Telerik. This is the first time I'm working on Telerik.
What I need to achieve is to populate a report as a pdf.
To get the report content, I will query the database, get all the necessary fields and add them to radFlowDocument Table.
I Need to Add images as header and Footer too.
The content is generated dynamically. I'm not saving it anywhere.
Im using webforms.
Please guide me with your valuable comments.
Hi,
empty asp net core project
when trying to export a empty file (code from examples) and always get the error:
"Index and count must refer to a location within the string (Parameter 'count')" (see on screenshot)
(the export logic is bound to the "Privacy" route in the "Home" controller)
windows 7, visual studio 2022, telerik asp net core 2021.3.1109
project attachet
Hi,
I'm using the Telerik spreadsheet component to open an excel file embedded in a Winforms page.
I notice that dependent dropdowns do not work anymore, they show as empty.
What's the best way to have a dependent dropdown shown with Telerik?
I've tried multiple methods like https://www.contextures.com/xldataval02.html or with Index/Match combination in the Data Validation, all work directly in Excel .. but once opened in the embedded page with Telerik these dependent dropdowns don't work anymore and show as empty.
I notice the named ranges dissappear once opened with the component.
Any advice / suggestions on this?
Thx in advance!
Hey there,
I have tried to use RadFixedDocumentEditor in order to have a continuous flow on the document. Before that, I was using FixedContentEditor and changing the position of the elements with the FixedContentEditor:
Ex: pageEditor.Position.Translate(351, 915) -- where pageEditor is FixedContentEditor instance which takes 2 arguments: offSetX and offSetY.
However, I can't seem to figure out how should I change the position of the elements (blocks, tables etc) when using RadFixedDocumentEditor?
Any advice would be much appreciated.
Thanks ever so much