Telerik Forums
Telerik Document Processing Forum
8 answers
255 views

I need to load a PDF document and extract text.

Is this possible with PDFProcessing?

Thank you,

Guido

Mikko
Top achievements
Rank 1
Veteran
 answered on 12 Apr 2021
5 answers
62 views

I have a form in a blazor web app that I need to export the content from to a pdf.

The form fields are rich textboxes that can have varying degrees of content, from single lines to who knows how many.

If I export this first to html, and then feed that html into your pdfprocesser, will it be able to automatically create as many pages as it needs or do I need to do calculations to see what will fit on a page and I create the new pages myself?

Dimitar
Telerik team
 answered on 05 Apr 2021
11 answers
31 views

Hello, I have a project adopted from the code in the ManipulatePages example project from Telerik, the FitAndPositionMultiplePagesOnSinglePage routine to be precise.

Except instead of taking four pages and putting them on one, I'm taking two 5.5x8.5 pages and putting them on a new 11x8x5 page, left to right.

It's working great, when the input PDF is properly formatted.

I have a handful of PDFs that were created in some unknown way that appear to be malformed.  When they are fed through my project, the odd pages never make it to the right side of the output.  It looks like, among other things, the CropBox size isn't the same as the MediaBox size on the source doc, which I suspect is a source (maybe not THE source) of the problem.

It seems I should be able to read the content of the pages on the source doc and insert them into a new page on the output doc, instead of just copying the page from PdfFileSource.Pages[] to essentially rebuild the page, instead of copying the page?

However, I'm at a loss as to how to read the source page, as PdfFileSource.Pages don't seem to expose the content?

Help is appreciated! :)

Thanks,

Charles

Dimitar
Telerik team
 answered on 31 Mar 2021
9 answers
13 views

I have a requirement to write cell values that have space at the end of the value. I investigated the file and the space is written in the file is just that the space="preserve" is not added and the excel will not display it.

Does telerik support this case or should I look for other solutions?

Tanya
Telerik team
 answered on 17 Mar 2021
5 answers
35 views

Hello, I'm trying out the DevCraft trial to do conversion from pdf to pdfa, however the .Export method throws a nullreference exception far inside the Telerik-components. Not sure how to proceed, since the error tells me nothing.

I followed the example shown here: https://docs.telerik.com/devtools/document-processing/libraries/radpdfprocessing/howto/comply-with-pdfa-standard

The exception thrown:

The type initializer for 'Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.ColorSpaces.IccProfileObject' threw an exception.
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.ColorSpaces.IccProfileObject.get_SRgbProfile()
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.DocumentStructure.OutputIntent..ctor()
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.DocumentStructure.DocumentCatalog.CopyPagePropertiesFrom(IRadFixedDocumentExportContext context)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Model.Elements.DocumentStructure.DocumentCatalog.CopyPropertiesFrom(IRadFixedDocumentExportContext context)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Export.PdfExporter.Export(IRadFixedDocumentExportContext context, Stream output)
   at Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.PdfFormatProvider.ExportOverride(RadFixedDocument document, Stream output)
   at Telerik.Windows.Documents.Common.FormatProviders.FormatProviderBase`1.Export(T document, Stream output)
   at Telerik.Windows.Documents.Common.FormatProviders.BinaryFormatProviderBase`1.Export(T document)
   at PdfaConverter.Tjenester.Converters.PdfConverter.ConvertToPdfa(string base64) in E:\Repositories\PdfaConverter\PdfaConverter\Tjenester\Converters\PdfConverter.cs:line 21
   at ConsoleTest.Program.Konverter(String inputPath, String outputPath, IConverter converter, String filetype) in E:\Repositories\PdfaConverter\ConsoleTest\Program.cs:line 51
   at ConsoleTest.Program.KonverterPdfToPdfa() in E:\Repositories\PdfaConverter\ConsoleTest\Program.cs:line 24
   at ConsoleTest.Program.Main(String[] args) in E:\Repositories\PdfaConverter\ConsoleTest\Program.cs:line 17

 

My code:

public string ConvertToPdfa(string base64)
{
    PdfFormatProvider provider = new PdfFormatProvider();
    var document = provider.Import(Convert.FromBase64String(base64));
 
    PdfExportSettings settings = new PdfExportSettings();
    settings.ComplianceLevel = PdfComplianceLevel.PdfA2B;
    provider.ExportSettings = settings;
 
    return Convert.ToBase64String(provider.Export(document));
}
loe
Top achievements
Rank 1
 answered on 17 Mar 2021
3 answers
15 views

I want to use a then close a RadFlowDocument. 

My current process (will post code):

Open existing RadFlowDocument (word document).

Use RadFlowDocumentEditor to ReplaceText

Save the RadFlowDocument (now edited) as a new RadFlowDocument.  (now it is open on my machine).

Serialize the saved document to send it as an e-mail attachment.

Open the initial RadFlowDocument again

Use RadFlowDocumentEditor to ReplaceText again with a different value

Now I can't serialize the RadFlowDocument because it is open on my machine.

I'm using C# and Blazor

 

Code Sample (This is mostly from https://github.com/telerik/document-processing-sdk/blob/master/WordsProcessing/GenerateDocument/DocumentGenerator.cs)

private RadFlowDocument _document;

protected void OnMySendCommand(GridCommandEventArgs args)

{

OpenFile(fileName);

RadFlowDocumentEditor editor = new RadFlowDocumentEditor(_document);

editor.ReplaceText("Invoice_Number", "T1234567", false, false);

Save("docx", newFileName);

byte[] output = File.ReadAllBytes(newFileName + ".docx");

InsertEmail("myemail@my.com", "Test word file", "Test 1234567", output, "T1234567", true);

 

//Next invoice:

OpenFile(fileName);

editor = new RadFlowDocumentEditor(_document);

editor.ReplaceText("Invoice_Number", "T9999", false, false);

Save("docx", newFileName);

byte[] output2 = File.ReadAllBytes(newFileName + ".docx"); //Error now says:  The process cannot access the file 'E:\Workspace\Intranet\CPE\CPE\Pages\Classes\Invoices\InvoiceTemplate2.docx' because it is being used by another process.

//To Be Clear - it did replace the text and save it to my machine but now can't access the file because it is in use.  

//If necessary, I could save each file with a different file name.  But I would still want to close them programmatically.

}

 

Thanks for any help!

 

Dimitar
Telerik team
 answered on 17 Mar 2021
5 answers
25 views

Hello,

Could someone point me in the right direction for adding a line chart to a PDF. 

In the past I've rendered charts in a browser and exported the image so I can drop it into a PDF document.  This requires user interaction to load the page into a browser in order to render the chart.

I am keen to understand if I can utilise some of the Telerik chart functionality to render a chart when the PDF is generated (I'm currently using RadFixedDocument) - or is it a case of actually drawing the chart?

Thanks

Chris

Dimitar
Telerik team
 answered on 17 Mar 2021
3 answers
57 views

Real beginner question here but need some pointers on sizing in a PDF document. 

Can anyone explain sizing in PdfProcessing?

First question - How is the page size defined for RadFixedDocument, does is default to A4 or is there some kind of measurement setting applied by default?  Does this same metric apply to the rest of the document (e.g. is it all mm/pixels or some other measurement)

RadFixedDocument document = new RadFixedDocument();

Second question

How is image size in pixels relative to the sizing on the page itself.  In the sample below, imageSource.Width is pixels taken from the actual image, how does that translate to a relative size on the page?

 

Martin
Telerik team
 answered on 12 Mar 2021
3 answers
11 views

Hi,

 

I'd like to suggest you split your assemblies so they are more efficient for server side use.  Currently if you want to do some PDF processing on the server from the namespace `Telerik.Windows.Documents.Fixed.FormatProviders.Pdf.Streaming` you end up loading presentation framework dlls on the server which is unnecessary.  If you look at the manifest for Telerik.Windows.Documents.Core.dll you will see

 

.assembly extern PresentationFramework
{
  .publickeytoken = (31 BF 38 56 AD 36 4E 35 )                         // 1.8V.6N5
  .ver 4:0:0:0
}
.assembly extern System.Xaml
{
  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .z\V.4..
  .ver 4:0:0:0
}
.assembly extern System.Drawing
{
  .publickeytoken = (B0 3F 5F 7F 11 D5 0A 3A )                         // .?_....:
  .ver 4:0:0:0
}
.assembly Telerik.Windows.Documents.Core
{

This ends up loading unnecessary dlls, including System.Windows.Forms in IIS (if you are hosting the server in IIS).

Dimitar
Telerik team
 answered on 11 Mar 2021
2 answers
12 views

I have a requirement to write the value "#N/A" but as an error not the text.

I tried to use SetCell with value "#N/A" but it seems that excel will not recognize this cell as an error because when the file is opened with an excel in another language the value remains "#N/A" (In German for instance the value should be converted to "#NV")

Dan
Top achievements
Rank 1
Iron
Veteran
 answered on 08 Mar 2021
Narrow your results
Selected tags
Tags
+? more
Top users last month
Matthias
Top achievements
Rank 5
Bronze
Bronze
Iron
Psyduck
Top achievements
Rank 4
Bronze
Bronze
Iron
Liu
Top achievements
Rank 1
Iron
Alex
Top achievements
Rank 1
Veteran
Iron
Iron
George C.
Top achievements
Rank 2
Iron
Veteran
Top users last month
Matthias
Top achievements
Rank 5
Bronze
Bronze
Iron
Psyduck
Top achievements
Rank 4
Bronze
Bronze
Iron
Liu
Top achievements
Rank 1
Iron
Alex
Top achievements
Rank 1
Veteran
Iron
Iron
George C.
Top achievements
Rank 2
Iron
Veteran