Can someone help me figure out what is wrong here? I'm getting ad horribly vague Null exception.
var docxProvider = new Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider();
var pdfProvider = new Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider();
RadFlowDocument document = new RadFlowDocument();
byte[] docBytes = File.ReadAllBytes(path);
document = docxProvider.Import(docBytes); ERROR HERE
var resultBytes = pdfProvider.Export(document);
File.WriteAllBytes(resultPath, resultBytes);
The document i'm trying to load contains tables and images within the tables (jpeg barcodes)
I have verified that pretty much every other tool i use can read the file without issue.
The goal is ultimately to export the file as a PDF.
Error details:
{"Object reference not set to an instance of an object."}
at Telerik.Windows.Documents.Flow.FormatProviders.Docx.Model.Elements.Document.ParagraphPropertiesElement.OnAfterRead(IDocxImportContext context)I am trying to convert HTML to a PDF document with 0.25" margins. The left and right margins are being set correctly, but the top and bottom margins remain 0.5". My code is below, a screenshot of the generated PDF is attached.
StringBuilder sb = new StringBuilder();
foreach (string row in data)
sb.AppendLine(row);
HtmlFormatProvider provider = new HtmlFormatProvider();
RadFlowDocument html = provider.Import(sb.ToString());
foreach (Section section in html.Sections)
{
section.PageMargins = new Telerik.Windows.Documents.Primitives.Padding(24, 24, 24, 24);
// Code snippet from function that adds header inserted below
}
PdfFormatProvider pdf = new PdfFormatProvider();
return pdf.Export(html);
Thanks in advance for the help.
Darwin Pinder
Hi,
we have editable PDFs which are stored in a database. We used to be able to pull the PDFs, import them through the Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider to get a RadFixedDocument, iterate through the fields of this document and fill them with data. Afterwards, we exported the PDF through the PdfFormatProvider and wrote them to a file. This gave us the original PDF but filled with the required data.
This does not work anymore, as the resulting exported PDF is visually broken. We have no clue why that happens, maybe you can help us fix this.
I attached a small sample project with our work flow including one of the PDFs we try to fill out and the resulting PDF for you to analyze.
Thanks a lot in advance.
Hello,
I've been using Telerik.Web.Pdf to automate filling in the following EPA form from their website: EPA Form 3540-1- Notice of Arrival of Pesticides and Devices | US EPA
This has worked well until the 2024.4.1112 update. Now using the standard import method:
var provider = new PdfFormatProvider();
using Stream stream = System.IO.File.OpenRead(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources\\EPA-3540-1.pdf"));
var document = provider.Import(stream, TimeSpan.FromSeconds(10));
I get a Telerik.Windows.Docments.Fixed.Exceptions.NotSupportedActionException, with message "Action is not supported: Named"
I don't see any PDFImportSettings I can play with to possibly disable (Javascript?) and process as with the .3.806 version. Are there any suggestions for me to try?
firstly loading the document i have use
// Load the PDF document
var provider = new PdfFormatProvider();
var loadedDocument = provider.Import(inDocByte,null);
and after some functinality to export the document i have used below
Telerik.Documents.ImageUtils.ImagePropertiesResolver defaultImagePropertiesResolver = new Telerik.Documents.ImageUtils.ImagePropertiesResolver();
Telerik.Windows.Documents.Extensibility.FixedExtensibilityManager.ImagePropertiesResolver = defaultImagePropertiesResolver;
provider.Export(document, memoryStream, null);
outDocPdf = memoryStream.ToArray();
what was the problem can you tell me the solution for that exception
Unable to cast object of type 'Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Types.PdfLiteralString' to type 'Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Types.PdfName'. |