Telerik Forums
Telerik Document Processing Forum
0 answers
2 views


RadFlowDocument document = provider.Import(htmlContent, new TimeSpan(0, 0, 0, 30));


I have a PDF that's supposed to use bootstrap styles, and I'm having trouble applying them.  I have three divs that need to be in-line but they keep end up on their own line instead.  They are an image, then a title, then another image.  All need to be on one line.  But bootstrap, flex, whatever I throw at it, they keep going on their own lines instead, like block elements.

I want:  image/title/image

I get:

image
title
image

Here's the cshtml:


@using Kendo.Mvc.Extensions


<link href="~/Content/css/sprite.css" rel="stylesheet" />
<link href="~/Content/css/build/report.css" rel="stylesheet" />

<style>
    .row {
        --bs-gutter-x: 1.5rem;
        --bs-gutter-y: 0;
        display: flex !important;
        flex-wrap: wrap;
        margin-top: calc(-1 * var(--bs-gutter-y));
        margin-right: calc(-0.5 * var(--bs-gutter-x));
        margin-left: calc(-0.5 * var(--bs-gutter-x));
    }

    .row > * {
        flex-shrink: 0;
        width: 100%;
        max-width: 100%;
        padding-right: calc(var(--bs-gutter-x) * 0.5);
        padding-left: calc(var(--bs-gutter-x) * 0.5);
        margin-top: var(--bs-gutter-y);
    }
    .tbox {
        display: table;
        width: 100%;
        height: 100%;
        border-spacing: 0;
        table-layout: fixed;
        outline: 5px solid red;
    }

    .tcol
    {
        display: table-cell;
        float: none;
        height: 100%;
        vertical-align: top;

    }

    .col-md-10 {
        flex: 0 0 auto;
        width: 83.33333333%;
    }
</style>


<div class="row">
    <div class="col-md-offset-1 col-md-10 col">
        <div class="tbox" style="height: auto; display: flex !important">
            <div class="tcol" style="width: 25%">
                <img class="logo" src="URI" alt="official seal" />
            </div>
            <div class="tcol text-center" style="width: 25%">
                <h1 class="m-15">
                    TITLE OF PDF
                </h1>
                <h2> @Model.ProjectNumber Project Plan </h2>
                <h4 class="datestamp">@DateTime.UtcNow.UtcToApplicationTimeZone().ToString("MM/dd/yyyy")</h4>
            </div>
            @if (Model.ProgramId == (Int32)EnumRefProgram.ABCDEF)
            {
                <div class="tcol text-right" style="width: 25%">
                    <img class="logo" src="URI" alt="official seal" />
                </div>
            }
            else
            {
                <div class="tcol text-right" style="width: 25%">
                    <img class="logo" src="URI" alt="official seal" />
                </div>
            }
        </div>
    </div>
</div>

This isn't the whole document, just the relevant part I'm struggling with.  Linking bootstrap directly didn't work (and seemed like a bad idea anyways due to its size) so I just started copying in the relevant classes into the style tag.  The .row class alone should be sufficient to make the three divs (the two images and the title) all inline in one line, but it seems to have no effect in the PDF.  I also tried making one of the divs a flex container by giving it display:flex and again, no effect.  If I grab the HTML string from the debugger, the moment before it is fed into this: RadFlowDocument document = provider.Import(htmlContent, new TimeSpan(0, 0, 0, 30)); and I take that html and save it as an html document and open it in my browser, the classes work appropriately, the image/title/image display inline as desired.  So I know the mark up and the CSS are functional, but I don't get why it doesn't work with the conversion to PDF.

I'm also aware that putting flex in one of the divs inside a .row div is redundant but I was trying to figure out what wasn't working.

Jonathan
Top achievements
Rank 1
 asked on 20 Oct 2025
1 answer
9 views

Hello,

I'm trying to rewrite a PDF-generator function that creates a PDF from HTML (which is the result of an XSLT+xml transform) using another HTML to PDF library to a new function that uses the Telerik methods. That works Ok, but there are 2 things I can't figure out how to do (if even possible) :

- The HTML content consists of a table with uneven row heights, depending on the content. Some rows contain images, some don't. So, I can't determine beforehand which row needs to start on a new page. Currently, I use page-break-inside: avoid on the rows, and that works with the other library, but not with the Telerik methods. Some rows are split over two pages. How can I prevent an element from breaking up over two pages?

- With the current library, I'm able to provide a separate PDF file that is used as a background for every rendered page. That PDF is a single-page PDF with the 'corporate stationery' (don't know how that's called ;-), so the resulting PDF contains multiple pages with the HTML output in the company style. Is something like that possible with the Telerik methods?  I know how to draw a small HTML snippet on a single PDF page, but I can't figure out how to convert HTML to PDF with this background on every page.

Any help is appreciated.

Regards,
Kees

Yoan
Telerik team
 answered on 13 Oct 2025
1 answer
10 views

I am looking at this example.  Is it possible to format the text using HTML tags?

For ex: can the textboxvalue = <b>text</b>?
void ProcessTextBox(TextBoxField textBoxField, string textboxValue)
    {
        textBoxField.Value = textboxValue;
    }

https://demos.telerik.com/blazor-ui/pdfprocessing/read-and-write-form-fields

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 17 Sep 2025
4 answers
42 views

I've obtained a x509 signing certificate and able to use it with Telerik PDF processing to generate a signed PDF. The problem is that none of the signatures are valid because of the time stamp!

There doesn't appear to be any way to insert a TSA timestamp with the signing flow.

How can I fix this, the Telerik signatures are useless otherwise.


Thanks!

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 29 Jul 2025
0 answers
29 views

I am trying out the document processing library and the barcode formsource (https://docs.telerik.com/devtools/document-processing/libraries/radpdfprocessing/model/formsource/barcode).

When I add the barcode, I get a white pdf. If I leave barcode off it, everything else shows up. Any idea what i am doing wrong? 

Example file:


 internal class DocGenerator
 {
     public void CreateDocument()
     {
         var document = new RadFixedDocument();
         var page = document.Pages.AddPage();
         page.Size = new Size(595, 842); // A4 size

         var editor = new FixedContentEditor(page);

         //editor.Position.Translate(0, 0);
         //FormSource barcode = FormSource.FromBarcode(Symbology1DType.Code128, "1234567890", width: 100, height: 100);
         //editor.DrawForm(barcode, 100, 100);

         editor.Position.Translate(20, 20);

         // Title
         editor.DrawText("P 24-07-2024 12:03");
         editor.Position.Translate(300, 20);
         editor.DrawText("Person X");

         // Aisle and Pallet
         editor.Position.Translate(20, 60);
         editor.DrawText("AISLE");
         editor.Position.Translate(100, 60);
         editor.TextProperties.FontSize = 36;
         editor.DrawText("A101");

         editor.Position.Translate(20, 150);
         editor.TextProperties.FontSize = 12;
         editor.DrawText("P");
         editor.Position.Translate(100, 150);
         editor.TextProperties.FontSize = 36;
         editor.DrawText("0237");

         AddBarcode(editor);


         editor.TextProperties.FontSize = 10;
         var blackColor =  new RgbColor(0, 0, 0);
         Table table = new Table();
                     table.Borders = new TableBorders(
             new Border(1, blackColor), // Top
             new Border(1, blackColor), // Right
             new Border(1, blackColor), // Bottom
             new Border(1, blackColor) // Left
         );

         AddTableRows(table);
         editor.Position.Translate(20, 240);
         editor.DrawTable(table);

         using (Stream output = File.OpenWrite(@"c:\temp\Output.pdf"))
         {
             PdfFormatProvider flowPdfProvider = new();
             flowPdfProvider.Export(document, output, new TimeSpan(0,0,10));
         }
     }

     private void AddBarcode(FixedContentEditor editor)
     {
         editor.Position.Translate(150, 150);
         FormSource barcodeWithCenterCenterText = FormSource.FromBarcode(Symbology1DType.Code128, "1234567890", showText: true);
         editor.DrawForm(barcodeWithCenterCenterText, 100, 100);
     }

     private void AddTableRows(Table table)
     {
         string[][] rows = new[]
         {
   new[] { "P", "PNo", "Brut", "Net", "Quality", "Pattern", "Pr", "Co", "Ac"  },
   new[] { "1000", "1001", "119,50", "118,70", "P1", "", "C1", "U1" },
   new[] { "1000", "1002", "120,00", "119,40", "P1", "", "C1", "U1" },
   new[] { "1000", "1003", "112,80", "112,10", "P1", "", "C1", "U1" },
   new[] { "1000", "1004", "120,50", "120,00", "P1", "", "C1", "U1" },
   new[] { "1000", "1005", "114,40", "113,50", "P1", "", "C1", "U1" },
   new[] { "1000", "1006", "114,40", "113,70", "P1", "", "C1", "U1" },
   new[] { "1000", "1007", "104,00", "102,60", "P1", "", "C1", "U1" },
   new[] { "1002", "1008", "99,80", "99,40", "P2", "", "C2", "H1" },
   new[] { "1002", "1009", "100,40", "100,00", "P2", "", "C2", "H1" },
   new[] { "1002", "1010", "100,40", "99,40", "P2", "", "C2", "H1" },
   new[] { "1002", "1011", "73,30", "72,50", "P2", "", "C2", "H1" },
   new[] { "1002", "1012", "100,00", "99,80", "P2", "", "C2", "H1" },
   new[] { "1002", "1013", "74,30", "73,80", "P2", "", "C2", "H1" },
   new[] { "1002", "1014", "105,00", "104,30", "P2", "", "C2", "H1" }, }; foreach (var rowValues in rows) { var row = table.Rows.AddTableRow(); foreach (var value in rowValues) { var cell = row.Cells.AddTableCell(); cell.Blocks.AddBlock().InsertText(value); } } } }

 

BB
Top achievements
Rank 1
 updated question on 30 Jun 2025
1 answer
31 views

https://www.telerik.com/document-processing-libraries/pdf-processing

Folks,

For a new project I need to generate a dynamic multi page pdf and one of the mandatory requirements is that some kind of template (html, xml, word) is used for easier maintance purposes.

Is it correct that for the Telerik PDF processing Library the only way to define pdfs is directly in the c# code and not some kind of template?

Thank you

Valentin

Yoan
Telerik team
 answered on 22 May 2025
1 answer
33 views

PdfProcessing - Developer Focused Examples - Telerik Document Processing

 

Hi,

we need to generate PDF/UA comform pdfs from scratch. Is that possible with Telerik PdfProcessing? I know that PDF/A works but we need PDF/UA specifically.

 

Thank you,

Valentin

Yoan
Telerik team
 answered on 20 May 2025
1 answer
35 views
Is it possible to add text to headers based on variables/database fields? I'm trying to loop through a table and use a field within the table as a page title, but all information I could find on this points to it being impossible in Telerik. Guidance would be much appreciated. 

Thanks
Dess | Tech Support Engineer, Principal
Telerik team
 answered on 07 Apr 2025
1 answer
96 views
Im using:
var xlsxProvider = new XlsxFormatProvider();
var pdfFormatProvider = new PdfFormatProvider();

byte[] docBytes = File.ReadAllBytes(path);
Workbook workbook = xlsxProvider.Import(docBytes, null);

byte[] resultBytes = pdfFormatProvider.Export(workbook, null);
File.WriteAllBytes(resultPath, resultBytes);

to conver xlsx file to pdf. In source xlsx file a have a Table and a formula '=SUBTOTAL(109, Table2[...]) that work in xlsx, but when i export it to PDF i need to have the calculated value, but instead im getting the string  '=SUBTOTAL(109, Table2[...]) . 

Is there a simple way to force calculation of all formulas in the sheet before exporting it to PDF?
Yoan
Telerik team
 answered on 28 Feb 2025
1 answer
77 views

The contents of an uploaded .docx file is being cut-off when converted to .pdf file.

 

Code snippet:

var fileFormatProvider = new Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider(); using (MemoryStream inputFileStream = new MemoryStream()) { this.fileSystemService.GetFile(documentInfo, inputFileStream); if (fileFormatProvider != null) { var document = fileFormatProvider.Import(inputFileStream); using (MemoryStream output = new MemoryStream()) { var pdfProvider = new Telerik.Windows.Documents.Flow.FormatProviders.Pdf.PdfFormatProvider(); pdfProvider.Export(document, output); var newFile = new DocumentInfo() { NameWithPath = outputFileName, DocumentLocation = documentInfo.DocumentLocation }; this.fileSystemService.SaveFile(newFile, output); } }

 

Can someone confirm if this a Telerik side issue, or am I missing a setting or config?

 

Thanks!

Dess | Tech Support Engineer, Principal
Telerik team
 answered on 26 Feb 2025
Narrow your results
Selected tags
Tags
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Iron
Iron
Andrey
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?