add page headers to roxygen2 docs - roxygen2

I'm using roxygen2 to document the objects in my R package, as described in the book R packages. I want to insert some text at the top (and bottom) of the doc page for every object, saying for example, "Confidential - Do Not Release". For the HTML doc pages I could do that with a CSS content property, or by inserting some HTML of course.
So how can I modify the page headings of the doc pages rendered from roxygen2? For now I'm only interested in the HTML doc pages, not PDF, so it might be enough to insert some arbitrary CSS or HTML into every doc page with roxygen2, or Rd. Is that possible?
Ideally I'd like to find an option that I can set once globally for the whole package, since if I have to add it separately to each object's documentation, I may miss some. But if I have to add it to each object, I can live with it.

Related

Template-based PDF renderer for flutter web

I am writing a Flutter web application that needs to have a customizable template for printing reports: inside the template there will be some placeholders that must be replaced with data at the moment of printing. The "printing" itself will be done by having the user download and open a PDF file, then print it through the browser, the OS or anything else, but that's beyond the scope, at the moment.
The default template would be something like this, where <BUYER_DATA> and <TRANSACTION_DATA> will be replaced with the data of the transaction the user is printing, along with some other "technical" tags (i.e., the page number and the pages count):
Header with site name
727 Chester Rd New Trafford, Stretford
Manchester
<BUYER_DATA>
01-12-2022 14:40
<TRANSACTION_DATA>
AppName - TM 2022
Page <PAGE_NO> of <PAGES_COUNT>
The user is allowed to edit this template in any aspect (boldness, size, colors, etc), provided that the tags related to the data are not removed from it.
So, to achieve this, I added a WYSIWYG html editor inside a page in order to save the template as an HTML-formatted string. And this works fine: only then I realized that the well-known flutter printing library doesn't support conversion from HTML directly to PDF on web, and all my plans began to crumble.
I then tried to discover if there's some other way to achieve the same by replacing the HTML template with something else, like markdown, but it seems that there's nothing that could help me.
The question is: anybody knows of a package capable of converting from HTML, markdown or such, directly into PDF?
I just need to know so I can stop googling around and decide to write my own parser for the HTML and convert it into a series of Widgets of the before-mentioned printing package.

How to combine authorable css files in css.txt in aem

We have an existing AEM application where there are 100s of pages. On most of the pages, different css files are getting loaded via a separate network call. We need to optimize this. What I am thinking is if we can:
1. Author the list of css files on the page as a page property.
2. In our code, this page property is read and all the css files mentioned as a property value get combined and rendered on the page. Similar to what is done in css.txt file or embed property.
Please suggest.
Their are few ways to reduce the network calls for css files in AEM
1) Add the css files at the template level so that all the css files are loaded once.
2) Instead of adding the category of the clientlibs use the embed property of the clientlibs. AEM will combine all the clientlibs provided in the embed property into a single clientlib and their will be only network call. But the size of the css file may increase after combining and it will effect the page load time for the first time.
But if your requirement is to author the css files then I will suggest you have a dropdown kind of property in your dialog where all your css files are displayed and the author can select the css according to the need. Once selected then you can apply those css to the html by reading through sightly.
So, it seems you don't want to or cannot use the clientlib functioanlity which is an ootb AEM feature.
No matter what solution you choose - maybe a frontend JavaScript snippet that can decide which CSS files would be needed, or some logic that builds CSS includes at render time based on the components used in the page, or something completely different - I would strongly suggest not to put the CSS files to be used in the editor's responsibility.
If they need some additional styles to be set, use the Adobe Style System. But do not abuse page properties for CSS file configurations.
I mean "hundreds of pages" sounds like a rather small site, but it might still increase your maintenance efforts a lot, when the first people start to complain about wrong colors or font sizes...

Docx4j - Copy all the contents of a page into another document in place of a Place Holder

Is it possible to copy all the contents (elements) of a page into another document in place of a Place Holder.
I am using Text Place Holders in template, and i am able to add images, text, paragraphs, tables, on those place holders. I have a requirement, where i have to copy all the pages of a word document (different document) and paste those pages in place of a place holder in template.
I am using Docx4j for this..
I had a similar requirement. I used the code in the blog post.
http://www.docx4java.org/forums/docx-java-f6/html-altchunk-t933.html
hope this helps you.

how do I add bookmark into a pdfpcell

I am doing a report which contains more 1000 records by using pdfptable of itext. it is not easy to seek a particular record, so i am wondering if there is any way to add bookmark in a pdfpcell.
To add bookmarks into a pdf using iTextSharp, you have to use the Chapter and/or Section objects. While technically, you can make this work, the Chapter and Section objects have some limitations and some pretty large overhead, especially for 1000's of items. Also, I have never been able to stop the chapter and section numbers from being displayed in my document, which is probably an issue for you if your content is in pdfpcells.
This link provides a good introduction to adding Bookmarks to a pdf. Scroll down to almost the end of the article for the Bookmark section.
Also in this article, is information about setting LocalDestinations in a pdf. These don't show up as Bookmarks, and they require both a 'Goto' link and a 'Destination'. So, if you were willing or able to create an index page in your pdf, this might be a better solution. Your index page would contain all of the 'Goto' links, and the content in your pdfpcells would be the LocalDestinations.

Word document in HTML page does not display toolbars

I have a requirement to display dynamically generated word document on the server in an html page
I tried using the OBJECT tag and the document was indeed displayed correct. But the toolbars like print, file etc are missing.
Note: secondary requirement is to enable the user to print the contents of the word document displayed, so the print toolbar is essential for this.
I'm not sure that this is actually possible. When you use the <object> tag, Word is being invoked to render the document, but you don't actually have a full-fledged instance of Word running in the browser. I doubt that there's any way to get Word to display its UI inside the <object> area.
You may have to write some javascript to invoke the browser's print capabilities.