Show page numbers, repeat page headings, crop away white space around content, make a block use 100% of the page height

1 Answer 224 Views
PdfProcessing
Fabian
Top achievements
Rank 1
Fabian asked on 10 Jan 2023, 10:10 AM

Hi,

some of those are briefly mentioned in the docs, others have been subject in previous requests in this forum. Nevertheless, I could not succeed doing these things. It is really hard to describe what i want properly, but i try my best:

- I want the content to take more space of the A4 page, means i want to crop away some of the white space of the top, right, bottom and left to make more room for the content.

- I want a table to take up 100% of the page's height and then in one column have one text block to be positioned at the top and another text block at the bottom. Similar to using flexbox in css and have it "justify-content: space-between", see the "text block" elements in the attached jpeg

- I need page numbers on each page. This was requested a number of times, but it seems like it was still not implemented. Is this correct? What is the best way to do this in 2023? see the numbers at the bottom in the jpeg

- I want to add a repeating page header to each page. see the Repeating Heading element in the jpeg

I created a rough layout design, which is attached as jpeg. Imagine the layout to be a table with currently one row and two columns.

I also took the current c# code and attached it.

1 Answer, 1 is accepted

Sort by
0
Yoan
Telerik team
answered on 12 Jan 2023, 06:31 AM

Hello Fabian,

  1. Modifying the page margins can be achieved through the RadFixedDocumentEditor 
    RadFixedDocumentEditor editor = new RadFixedDocumentEditor(document);
    //Thickness(left, top, right, bottom)
    editor.SectionProperties.PageMargins = new Thickness(20,0,20,0);
  2. Regarding positioning, a better approach would be to use three cells rather than two. One for the content (with RowSpan = 2) and two for each text block. Each cell exposes properties like VerticalAlignment, Padding, RowSpan, ColumnSpan, etcthat help determine the positioning of content. I have allowed myself to modify the provided code snippet to best simulate the described example in the image. I have attached it along with a sample output document. Feel free to refer to it and examine it if needed (Note: DefaultCellProperties.Borders are set, to help visualize the cells for easier positioning of content).
  3. We do not yet have a page numbering functionality for PdfProcessing. A workaround would be to do it manually.
  4. As of now, we don't support repeating header functionality. The workaround I can offer is to set it manually. You can refer to the Create Repeating Table Header Row in the PdfProcessing example.

For points 3. and 4. you can also check the SDK Draw header and footer with page numbers example as well.

I am also sending you a link for the PdfProcessing: Implement headers and footers in RadFixedDocumentEditor item, that you might be interested in. You can vote for and subscribe to it to track its progress.

We apologize for the inconvenience we might have caused you.

If you have any further questions or feedback, feel free to share it with us.

Regards, Yoan Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Fabian
Top achievements
Rank 1
commented on 17 Jan 2023, 10:52 AM

Thanks Yoan, that solved all my issues perfectly. I wished I would have found this info in the docs.
Tags
PdfProcessing
Asked by
Fabian
Top achievements
Rank 1
Answers by
Yoan
Telerik team
Share this question
or