Create copyright page

locke955
Posts: 3
Joined: Wed Nov 08, 2017 7:58 pm

Create copyright page

Post by locke955 » Wed Nov 08, 2017 8:05 pm

Hi!

I am using a custom CSS with Chemistry to generate PDF documents, with pretty good results. The one thing that I cannot figure out is how to create a copyright page after the cover page and before the TOC page. I have tried defining a blank page, a copyright page, and several other solutions in my CSS file, but cannot discern how to generate a blank page with copyright information in the footer.

Does anyone have a solution for solving this problem with CSS?

Cheers,

Adam

cud
Posts: 38
Joined: Fri Oct 06, 2017 5:22 pm

Re: Create copyright page

Post by cud » Mon Sep 03, 2018 3:37 pm

I would like to bump this issue. I'm using the new template-based transform to PDF. But I still have the same issue... I need a blank page after the title that includes copyright and a link to our EULA. Is there an obvious way to do this?

Or do I have to hack it as a separate topic in the book?

Dan
Posts: 428
Joined: Mon Feb 03, 2003 10:56 am

Re: Create copyright page

Post by Dan » Tue Sep 04, 2018 12:52 pm

Regular DITA maps do not have the concept of a copyright notice. This is available only in the DITA bookmap structure.
If you are constrained to using a regular map and you need to add a copyright page between the front cover and the TOC, use the following technique:
In your customization CSS, declare a new page layout:

Code: Select all

@page copyright-notice-page {
@top-left {
content:none; /* Clear the headers for the copyright page */
}
@top-right {
content:none;
}
}
The oxy:front-page element contains the title of the publication and generates the cover page. A synthetic :after element is created that follows this element and it is placed on a different page.

Code: Select all


front-page:after{
display:block;

page: copyright-notice-page; /* Moves the synthetic element on a new page. */

margin-top:90%; /* use margins to position the text in the page */
margin-left: 5em;
margin-right: 5em;

content: "Copyright 2018-2019 MyCorp Inc. \A All rights reserved";

text-align:center; /* More styling */
color:blue;
}
If you need to add more content as blocks, use the :after(2), :after(3) pseudo elements:

Code: Select all

front-page:after(2){
display:block;
page: copyright-notice-page; /* Continue on the same page as the first ':after'. */
content: "Some more styled text";
color:red;
}
If you want to extract information from the document, use the oxy_xpath() function. For example, if the copyright info is stored in the map like this:

Code: Select all

 <map ...>
<topicmeta>
<copyright>
<copyryear year="2018"/>
<copyrholder>MyCorp Inc.</copyrholder>
</copyright>
</topicmeta>
...
Use:

Code: Select all

front-page:after(3){
display:block;
page: copyright-notice-page;
content: "Year: " oxy_xpath('//*:front-page/topicmeta/copyright/copyryear/@year')
"\A Holder: " oxy_xpath('//*:front-page/topicmeta/copyright/copyrholder/text()') ;
color:green;
}
Let me know if it worked for you,
Many regards,
Dan

cud
Posts: 38
Joined: Fri Oct 06, 2017 5:22 pm

Re: Create copyright page

Post by cud » Tue Dec 18, 2018 12:38 pm

I hate to be one of those lame people who can't make anything work, but... I've been spending a few hours trying to get a copyright page. I believe I copied your instructions exactly, but I get no change... No copyright page. I also tried using a bookmap, and using the instructions in the online help for Tom Sawyer (https://www.oxygenxml.com/doc/versions/ ... =copyright) -- still nothing.

I'm starting to worry that my CSS might have something embedded in it that keeps this from working? Is there something obvious I should look for that would keep this from working?

cud
Posts: 38
Joined: Fri Oct 06, 2017 5:22 pm

Re: Create copyright page

Post by cud » Fri Jan 04, 2019 1:37 am

I could really use help, because I do need a copyright page. We don't use bookmaps. I can verify that the following does not work. This is the entire custom css I have for print. So am I missing something important?

[Codebox=]
@page front-page {
}

@page copyright-notice-page {
}

front-page:after{
display:block;
page: copyright-notice-page;
content: "xxxxxxxxxxxxxxxxxxxxsxxxxxxxxxxxxxxxxx";
text-align:center;
color:black;
}
[/Codebox]

Costin
Posts: 620
Joined: Mon Dec 05, 2011 6:04 pm

Re: Create copyright page

Post by Costin » Mon Jan 07, 2019 4:37 pm

Hello,

Please make sure:
- you use the latest version and build of oXygen XML 20.1 available from our website
- you edit the "DITA Map PDF - based on DITA & CSS (WYSIWYG)" transformation scenario
- in the "Parameters" tab, you set the path to your customization CSS as value for the "args.css" parameter.
- your customization CSS strictly contains all of the rules from Dan's reply above and specifically those ones, as they are. More exactly, your customization CSS content should be:

Code: Select all

@page copyright-notice-page {
@top-left {
content:none; /* Clear the headers for the copyright page */
}
@top-right {
content:none;
}
}

front-page:after{
display:block;

page: copyright-notice-page; /* Moves the synthetic element on a new page. */

margin-top:90%; /* use margins to position the text in the page */
margin-left: 5em;
margin-right: 5em;

content: "Copyright 2018-2019 MyCorp Inc. \A All rights reserved";

text-align:center; /* More styling */
color:blue;
}


front-page:after(2){
display:block;
page: copyright-notice-page; /* Continue on the same page as the first ':after'. */
content: "Some more styled text";
color:red;
}


front-page:after(3){
display:block;
page: copyright-notice-page;
content: "Year: " oxy_xpath('//*:front-page/topicmeta/copyright/copyryear/@year')
"\A Holder: " oxy_xpath('//*:front-page/topicmeta/copyright/copyrholder/text()') ;
color:green;
}
I managed to obtain the synthetic Copyright page in the PDF output, using oXygen XML Editor v20.1 with a custom scenario based on the DITA Map PDF - based on DITA & CSS (WYSIWYG) predefined one, with the only change that I used a customization CSS with the above content and published the "flowers.ditamap" DITA Map from the oXygen sample project.

Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support

cud
Posts: 38
Joined: Fri Oct 06, 2017 5:22 pm

Re: Create copyright page

Post by cud » Tue Jan 08, 2019 1:22 am

Thanks Costin...

I was using the DITA Map PDF - Based on HTML5 & CSS as my base scenario. Are you saying that I can't use a template-based scenario to get a copyright page?

Is there a way to use the following xslt extension in the DITA Map PDF - based on DITA & CSS (WYSIWYG) scenario? I rely on that entry point to handle xrefs in a specific way.

Thanks cud

Costin
Posts: 620
Joined: Mon Dec 05, 2011 6:04 pm

Re: Create copyright page

Post by Costin » Mon Jan 14, 2019 4:47 pm

Hi cud,

Sorry for the late reply.
I was using the DITA Map PDF - Based on HTML5 & CSS as my base scenario. Are you saying that I can't use a template-based scenario to get a copyright page?

Is there a way to use the following xslt extension in the DITA Map PDF - based on DITA & CSS (WYSIWYG) scenario? I rely on that entry point to handle xrefs in a specific way.
No, I just mentioned that you could simply use the "args.css" parameter directly in the transformation scenario, not that you can not use templates at all.

We need to see specifically what extension you are talking about, so we would need you to send us the publishing template that you are trying to use on our support email address and we could take a look at it, see if we can help you further with it.

Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support

Costin
Posts: 620
Joined: Mon Dec 05, 2011 6:04 pm

Re: Create copyright page

Post by Costin » Mon Jan 14, 2019 5:33 pm

Regarding the "DITA Map PDF - Based on HTML5 & CSS", if you strictly need to use this scenario, you should make sure that you use the correct selectors, as they need to be more specific than the ones used for the other scenario, without HTML5.
More exactly, you should avoid matching elements, because the XML documents become <div/> elements in the intermediary resulted HTML document, so the selectors would no longer match the right elements. You should rewrite your selectors to match classes instead.
This also applies for the Xpath in the oxy_xpath function.

In your specific case, you the CSS you should've developed for the HTML5 & CSS scenario should've looked like:

Code: Select all

@page copyright-notice-page {
@top-left {
content:none; /* Clear the headers for the copyright page */
}
@top-right {
content:none;
}
}

*[class ~= "front-page"]:after{
display:block;

page: copyright-notice-page; /* Moves the synthetic element on a new page. */

margin-top:90%; /* use margins to position the text in the page */
margin-left: 5em;
margin-right: 5em;

content: "Copyright 2018-2019 MyCorp Inc. \A All rights reserved";

text-align:center; /* More styling */
color:blue;
}


*[class ~= "front-page"]:after(2){
display:block;
page: copyright-notice-page; /* Continue on the same page as the first ':after'. */
content: "Some more styled text";
color:red;
}


*[class ~= "front-page"]:after(3){
display:block;
page: copyright-notice-page;
content: "Year: " oxy_xpath('//*[contains(@class, " front-page/front-page ")]/*[contains(@class, " map/topicmeta ")]/*[contains(@class, " topic/copyright ")]/*[contains(@class, " topic/copyryear ")]/@year')
"\A Holder: " oxy_xpath('//*[contains(@class, " front-page/front-page ")]/*[contains(@class, " map/topicmeta ")]/*[contains(@class, " topic/copyright ")]/*[contains(@class, " topic/copyrholder ")]/text()') ;
color:green;
}
As a general rule, whenever you develop a CSS to fine-tune the PDF output, you could better observe which selectors you should use by publishing the DITA Map to PDF using the CSS-based scenario of your choice once, then using the CSS debugging technique described in THIS section from the User-Guide to analyze the intermediary HTML document.

Costin
Costin Sandoi
oXygen XML Editor and Author Support

Post Reply