How to get the total number of pages in RML template? - rml

There is a tag in RML, <pageNumber>, that displays the the current page number.
But how can I get the total number of pages of the generated PDF document?
I would like to add a pagination with something like "Page 1/2", "Page 2/2":
Page <pageNumber /> / <pageCount>
But the <pageCount> tag doesn't exist.

After spending a considerable amount of time, I found this:
At the end of the <story>, add:
<namedString id="lastPage"><pageNumber/></namedString>
To display pagination, use:
Page <pageNumber /> / <getName id="lastPage" default="0" />

I´ve been working in a solution for this case in OpenErp:
<document>
<template>
<pageTemplate>
<stylesheet>
...
<paraStyle name="main_footer" fontSize="7.0" leading="7" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
...
</stylesheet>
...
...
<!-- Page Footer -->
<place x="1.5cm" y="0cm" height="1cm" width="19.0cm">
<para style="main_footer">[[ o.name or '']] | Página: <pageNumber/> de </para>
</place>
<drawString x="4.9cm" y="0.74cm"><pageCount/></drawString>
...
Basically, it "draws" the <pageCount> tag at the left of my footer text. The solution from #alartur is more elegant but it does´t work in the OpenErp rmltopdf converter.
We must use Helvetica font at 7px for our footer text because is the default font used in the rmltopdf code for <pageCount>

Related

CKEditor5 setData() stripping <code> tags

When I try to run
editor.setData("<p>test comment</p><code class=\"python-code\">def withCodeBlock:<br /> print('test')</code>");
The resulting editor contains the html:
<p>test comment</p>
<p>def withCodeBlock:
<br>print('test')</p>
It strips out the <code> tags, how can I stop this?
I found my issue, my sanitizer was removing a wrapping <pre> tag around the codeblock
editor.setData("<p>test comment</p><pre><code class=\"python-code\">def withCodeBlock:<br /> print('test')</code></pre>");
works perfect

flying saucer page number + page count

I'm trying to configure a nice footer on a pdf document I'm generating using Flying Saucer.
But I'm having problems getting the page number and page count in a nice position.
Consider this bit of css:
div#page-footer {
position : running(footer);
// .. more styling .. //
}
div.page-number:before {
content: counter(page);
}
Using this bit of html will not give me a page number:
<div id="page-footer">
<div class="page-number"></div>
</div>
The only way I manage to get a page number if I move the class a level up.
<div id="page-footer" class="page-number">
</div>
But this does not allow me to add additional content in the footer or makes it really difficult to apply styling. I could add a separate footer just for the page number, but it would be quite hard to get the position just right.
Is there a way to get page number + page count in a footer that also contains other elements and styling?
Extra notes:
I simplified the footer a bit, in the original there is more in there, but even this simple example it is giving problems.
using span or div for the element does not make a difference.
You should use the id instead of the class to identify the div containing the page number.
This will work:
div#page-number:before {
content: counter(page);
}
<div id="page-footer">
<div id="page-number"></div>
</div>

Adding footer in an RML document

I have a document in which I already managed to insert a header. The body starts after the header and continues on to next pages where my header is there.
That said, I am not able to properly add a footer. From checking the RML reference there seems to be no tag I can add that will act as a footer so I have to come up with a solution. So far nothing I have tried works. Here is my template section:
<template pageSize="(595.0,842.0)" title="Test" author="geof" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="24.0" y1="-80.0" width="530" height="796"/>
<header>
<pageGraphics>
<image x="5.3cm" y="8.9cm" height="280.0">[[ get_background() ]]</image>
<image x="6.3cm" y="25.7cm" height="80.0" >[[ company.logo or removeParentNode('image') ]]</image>
<!-- <drawString x="1.0cm" y="28.1cm">[[ company.name ]]</drawString>
<drawRightString x="20cm" y="28.1cm"> Reference Guide </drawRightString>
<lines>1cm 28cm 20cm 28cm</lines> -->
<drawString x="7.0cm" y="1.1cm" height="50.0">[[ get_footer() ]]</drawString>
</pageGraphics>
</header>
</pageTemplate>
</template>
"-Go to "Settings" -Choose "Company"; select your company
You can customize the footer on the bottem field on the initial screen
-Choose the "Footer/header-text" tab
You can edit the header (and footer) text here; you can view your changes by using the preview button on the top right hand corner of this screen."
UPDATE:
----------
how to add a user defined header in a rml report in openerp?

What is the simpliest way to add a single image to a Sitefinity template?

I have a Sitefinity 7.0 installation. I've added a custom content type, which includes a field for a single, required, image.
I created a custom template for this content type. On the site you can click on examples for how to add your fields to the widget template. This is what it gives me for the 'Picture' field:
<%--The following namespace should be registered at the top of the control if it doesn't exists--%>
<%# Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Modules.Libraries.Web.UI.Images" TagPrefix="sf" %>
<%# Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Modules.Libraries.Web.UI" TagPrefix="sf" %>
<sf:ImagesView ControlDefinitionName="ImagesFrontend" runat="server" MasterViewName="ImagesFrontendThumbnailsListLightBox" Title="" UrlKeyPrefix="">
<RelatedDataDefinition RelatedFieldName="Picture" RelatedItemType="Telerik.Sitefinity.DynamicTypes.Model.GIARRecipients.GiarRecipient" RelationTypeToDisplay="Child" RelatedItemSource="DataItemContainer">
</RelatedDataDefinition>
<ControlDefinition ControlDefinitionName="ImagesFrontend" runat="server" ProviderName="OpenAccessDataProvider">
<Views>
<sf:ImagesViewMasterDefinition SortExpression="" ViewName="ImagesFrontendThumbnailsListBasic" runat="server">
</sf:ImagesViewMasterDefinition>
<sf:ImagesViewMasterDefinition SortExpression="" ViewName="ImagesFrontendThumbnailsListLightBox" runat="server">
</sf:ImagesViewMasterDefinition>
<sf:ImagesViewMasterDefinition SortExpression="" ViewName="ImagesFrontendThumbnailsListSimple" runat="server">
</sf:ImagesViewMasterDefinition>
<sf:ImagesViewMasterDefinition SortExpression="" ViewName="ImagesFrontendThumbnailsListStrip" runat="server">
</sf:ImagesViewMasterDefinition>
<sf:ImagesViewDetailDefinition ViewName="ImagesDetailView" runat="server">
</sf:ImagesViewDetailDefinition>
</Views>
</ControlDefinition >
</sf:ImagesView>
This is way too much and the markup produced uses <ul><li>, even though it's always exactly one image. Ideally, I want it as simple as <img src='<%# Eval("Picture") %>' />
What is the simpliest way to add a single image to a Sitefinity template?
For the image fields on custom content types, you can limit the number of images by clicking on the "Limitations" tab when adding the field. Select "Only 1 image can be uploaded or selected"
.
The control that gets used in the template is instead is a Sitefinity Images control:
<sf:ImageControl runat="server" Title="" UrlKeyPrefix="" ProviderName="OpenAccessDataProvider" >
<RelatedDataDefinition RelatedFieldName="OneImage" RelatedItemType="Telerik.Sitefinity.DynamicTypes.Model.Solutions.Solution" RelationTypeToDisplay="Child" RelatedItemSource="DataItemContainer">
</RelatedDataDefinition>
</sf:ImageControl>
And the markup that gets rendered is a image tag wrapped in a div:
<div class="sfimageWrp">
<img id="ctl09_ctl00_ctl00_detailContainer_ctl03_0_ctl00_0_ctl00_0_imageItem_0" title="ootb" src="/images/default-source/default-album/ootb.png?sfvrsn=0" alt="ootb">
</div>
I choose Ben's answer as correct, but an alternative I found in the mean-time may also be worth mentioning.
<img src='<%# ((Telerik.Sitefinity.Libraries.Model.Image)Eval("Picture")).Url %>' />

ModX Eform: Captcha not generating image

I am trying to get CAPTCHA working on the eForm plugin. I have added the input form field:
<label for="cfCaptcha">Captcha:<br />
<img src="[+verimageurl+]" alt="verification code"><br />
<input id="vericode" name="vericode" class="text" type="text">
and I have added
&vericode=`1`
to the eForm call.
and have added the Template Variable [+verimageurl+] to my template.
However, when I preview the form all I see in the image area is <img src="" alt="verification code">
Would anyone know what I am doing wrong?
Did you get this fixed?
Check that you ended the label code. Run it through w3c code checker too.
A few times I have left a element un-closed and it breaks the whole thing.