Pages Footer styling issues...

Having trouble installing Oxygen? Got a bug to report? Post it all here.
DAN SEA
Posts: 59
Joined: Tue Sep 13, 2022 4:13 pm

Pages Footer styling issues...

Post by DAN SEA »

Hi all!
Now I'm trying to make a footer in the format:

Code: Select all

"Confidential                 Company Name                 Page    This Page Number/Total Pages"
Almost done, but there are problems:
1) the middle block (company name) is divided into 2 lines by oXygen (but it should be in one line);
2) so far I can not find a way to display the total number of pages.

I make the footer like this (for left and right pages - the same principle):

Code: Select all

 @bottom-left {
content: "Confidential"
}

 @bottom-center{
content: "Company name bla bla bla, 2022"
}

 @bottom-right{
content: "Page    "  counter (page);
}
If you can help with advice, I will be glad!

P.S. I'm using CSS for styling.
chrispitude
Posts: 907
Joined: Thu May 02, 2019 2:32 pm

Re: Pages Footer styling issues...

Post by chrispitude »

Hi Dan,

At this page:

PDF Chemistry Home > Styling for Print > Page Formatting > The @Page Rule > Page Margin Boxes

notice it says the following for bottom-center:
Using a bottom-center box together with a bottom-left or bottom-right will create a sequence of three areas of identical width, with the bottom-center box occupying the center.
I think you can temporarily add background colors to visualize your boxes:

Code: Select all

@bottom-left {
  content: "Confidential";
  background-color: yellow;
}

@bottom-center {
  content: "Company name bla bla bla, 2022";
  background-color: lightgreen;
}

@bottom-right {
  content: "Page " counter (page);
  background-color: lightblue;
}
Above the forum editor, there is a "code display" button (<>) that can format your code to preserve spaces.

If you scroll down on the main forum page, note that there is a dedicated area for PDF Chemistry questions, which is a good place for PDF/CSS-specific questions:
  • Oxygen PDF Chemistry
    • Feature Request - Are you missing a feature? Request its implementation here.
    • Common Problems - Having trouble installing Oxygen PDF Chemistry? Got a bug to report? Post it all here.
(PDF Chemistry is the product name for the HTML5 & CSS PDF transformation.)

I don't know the answer to the question about the total number of pages.

I hope this helps!
julien_lacour
Posts: 498
Joined: Wed Oct 16, 2019 3:47 pm

Re: Pages Footer styling issues...

Post by julien_lacour »

Hi Dan,

For the total number of pages, the counter is simply called "pages", the CSS should be like this:

Code: Select all

@bottom-right {
  content: "Page " counter(page) "/" counter(pages);
  background-color: lightblue;
}
Here is a link to the topic related to the page counter.

Regards,
Julien
DAN SEA
Posts: 59
Joined: Tue Sep 13, 2022 4:13 pm

Re: Pages Footer styling issues...

Post by DAN SEA »

Thank you all very much, I understand everything. I also wanted to ask this: is there any way to preserve spaces when setting the text in the CSS in the footer?
Let me explain what I want to say: I make a line like this:

Code: Select all

Confidential                 Company Name                 Page    This Page Number/Total Pages
left-aligned, as suggested here.

For this, I tried two CSS settings and both did not work (the text in the final pdf was all merged - i.e. the system removed all spaces on its own):

Code: Select all

@bottom-left
{
content: "Confidential                 Company Name                 Page  "    counter(page) "/" counter(pages);
}

Code: Select all

@bottom-left
{
content: "Confidential"   "                "   "Company Name"   "                 "   "Page  "   counter(page) "/" counter(pages);
}
The result (looks like, in both attempts):

Code: Select all

ConfidentialCompanyNamePagecounter(page)/counter(pages)
How would I make it so that spaces are preserved and not destroyed by the system?
Last edited by DAN SEA on Wed Oct 12, 2022 3:02 pm, edited 1 time in total.
Post Reply