How to define a background image for the page master in Apache FOP 2.0 - background-image

I try to setup a background image for a simple-page-master in FOP 2.0.
I tried the following code:
<fo:simple-page-master master-name="Screen169"
page-height="1080px" page-width="1920px" margin="0" background-image="Screen169.svg"
background-color="#fecc6c" background-repeat="repeat"
background-position-horizontal="center" background-position-vertical="center">
but is does not work. It does not render the background color neither the background image.
The image should fill the whole page even if the page is not completely covered with text.
What can I do ?

Background properties apply to page regions and to block-level and inline-level formatting objects, but they don't apply to page masters.
Moreover, their value is not inherited, so setting them on an element has no effect on its descendants.
Just set them on the fo:region-body and you should get the desired result.

You can not use background properties on the master, but you do not need to chop the background up, to fit your individual regions, either.
You simply need to load the background image as an external graphic inside an absolutely positioned container. Place this absolutely positioned container in what ever occupies your top left corner (region-before, region-start, region-body, ...) and it will render beneath everything that follows after it.
E.g. I have a layout with region-before taking the the top 40mm of an A4 page, with region-body and region-after taking up the rest of my page.
Thus:
<fo:page-sequence master-reference="mya4">
<fo:static-content flow-name="region-before">
<!-- this absolutely positioned container renders
a full size background image -->
<fo:block-container width="210mm" left="0mm" top="0mm"
height="297mm" position="absolute">
<fo:block>
<fo:external-graphic
content-height="297mm"
src="/a4-bg.pdf"/>
</fo:block>
</fo:block-container>
<!-- all other content must follow after background -->
<!-- all other region-before stuff goes here-->
<fo:flow flow-name="body">
<fo:block>...</fo:block>
</fo:block>
</fo:page>
renders a4-bg.pdf as a full page background underneath all other page elements.
I use this in a production environment on FOP 2.1, but it should work for older FOP versions as well.

Related

Bootstrap modal pop up issue on Iphone

I am using iframe-resizer for cross domain application, The Iframe loads fine in desktop and andriod devices but on my Iphone, I am facing below issue:
The bootstrap modal pop ups on Iframe app is hiding and flickering behind when I scroll on page.
I tried
-webkit-overflow-scrolling: touch;
on container of Iframe but that does not work.
Any help/suggestion will be highly appreciated.
We fixed the issue by using position:absolute instead of position:fixed
Position fixed and absolute are somewhat similar in behavior. Both use x,y positioning in the view port and both are outside of the DOM document flow so other content is not affected by the placement of containers. Both require zIndex positioning to determine vertical priority in the view stack.
Position fixed keeps the element pinned at whatever position you set it to regardless of the scroll position of the browser. This makes sense in some scenarios where you actually want to scroll the entire page but leave content in place. The key to remember is to not use it when you build have your own scrollable content on the page.
It turns out in my case I don’t really need position:fixed because I manage the position and size of the container and toolbar headers and footers myself anyway. I know where everything is positioned and keep the content area effectively wedged in the middle of the statically sized elements. By way of CSS and media queries I can force the header to the top and the footer on the bottom using fixed sizes which means I can safely use position:absolute.

EvoPdf Page backgrounds and Margins

I am converting HTML pages using EvoPdf and would like to add a background image. I am generating documents and would like to add a cover page, I am doing this by prepending the HTML for the cover page then putting a page break directly after.
I am using this demo as a guide http://www.evopdf.com/demo/HTML_to_PDF/PDF_Pages_Background/Add_Elements_in_Background.aspx and have found that I need to remove the page margins for the image to cover the whole page otherwise it sits inside the margins.
If I remove the margins this means the content that flows over pages now starts directly at the top of the page and flows right to the bottom. I can fix this for left and right margins by putting this in the HTML but this does not work for top and bottom margins that flow over pages. (see the generated PDF from the above demo)
Is there a way to set the PDF page background irrespective of the page margins? I have been looking at creating multiple documents with their own configuration and merging the PDF's but I really want to avoid this.
You can set up a header and footer with the heights you wanted for the top and bottom margins, and then choose to not display them on the first page. This should give you the effect you're looking for.
You can find more information about how to do this here: http://www.evopdf.com/demo/HTML_to_PDF/Headers_and_Footers/HTML_in_Header_Footer.aspx

CodeMirror: auto-resize horizontally, without scrollbar

I need a CodeMirror editor which starts with a certain width and then grows automatically to the right to match the maximum line length. I.e. roughly what CodeMirror does when height is set to auto, but with width.
Here's a self-contained example. The editor grows automatically along the y-axis fine, but not along the x-axis. By tweaking the CSS, I can either have a fixed width editor with a scrollbar, or one which fills the entire width of the browser, but not one which grows as you type. I assume overflow-x is relevant, but I don't understand how it interacts with other CSS size properties set on parent elements. I also tried setting that property on CodeMirror-scroll, but it didn't help.
I believe this can be done using CSS properties alone. In fact I have this behaviour in my application already, but growing to the left, rather than the right, but I don't understand why it happens, or how to reproduce it in a small example.
This question is essentially the same, but for the vertical scrollbar.
Simply add float:left to the CodeMirror div.
<div id="here" style="float:left"></div>
This is not something CodeMirror supports. You may be able to get something working by setting .CodeMirror's width to (-webkit-)fit-content, but there will likely be corner cases where this breaks the scrollbars or cursor placement.

Making a ScrollPanel containing an AbsolutePanel occupy the full Height of its parent

I'm trying to use an AbsolutePanel inside a ScrollPanel. I'd like the ScrollPanel to occupy as much of the page height that it can to expose as much of the AbsolutePanel as possible.
I tried this. But the ScrollPanel and contents do not appear
<g:center height="100%">
<g:DecoratorPanel>
<g:ScrollPanel width='800px'>
<g:AbsolutePanel width='770px' height='1000px' ui:field='absolutePanel'/>
</g:ScrollPanel>
</g:DecoratorPanel>
</g:center>
If I put in a ScrollPanel absolute height ( height='800px'), it appears on the page, and of works - however, I'm not really sure what the height the user has on the browser, so I'd prefer not to hardcode 800px
<g:center height="100%">
<g:DecoratorPanel>
<g:ScrollPanel width='800px' height='800px'>
<g:AbsolutePanel width='770px' height='1000px' ui:field='absolutePanel'/>
</g:ScrollPanel>
</g:DecoratorPanel>
</g:center>
Is there anyway to have a 100% of parent height, ScrollPanel, with a absolute panel inside it?
So,You want to set the height(100%) of the scroll panel .
I'm not really sure what the height the user has on the browser.
The answer to the above question is
Window.getClientHeight();
Gets the height of the browser window's client area excluding the scroll bar.
The above method return an int then you can call panel.setHeight(returned+"px").
Its simply not logical. Absolute - means fixed. Why would you make absolute change its height/width. If you expect the panel size to change use FlowPanel or any other content panel.
Also if you are thinking along responsive design you should reference gwt documents for LayoutPanels to be used with RootLayoutPanel.
Read Design thoughts behind the GWT layout panels concepts which differs from earlier approach of .
Also, understand the resize concepts
Check and Observe GWT Showcase. Change browser size and the application Resizes even with grid data.
You can download the source code from GWT and extract the samples/showcase project. Note - the code is excessively complicated because of other features GWT is trying to demonstrate.

jQuery Mobile/ jqTouch Image width

I want to have a static footer image with 5 buttons for navigation in my mobile phone website. The image is here http://www.pintum.com.au/jm/footer3a.jpg. The blue icons should be the default, the yellow icon should only be visible for the hover or active state.
I want to know how can I make this image scale to the correct width on all mobile devices (landscape and portrait) and have links to other pages and make the current/active pages icon the yellow color?
What I have tried so far
I first tried to make a CSS Sprite but that go ugly (complex) quickly. Painful working with widths everywhere so the image scales correctly as I had no way of knowing the height in pixels since the width is dynamic. I could use JS to find the width and calculate height on the fly. But this sounds like overkill.
Next I tried to have a single image with a width of 100% then place div overlays on top of the image. But with this solution I could not figure out how to navigate pages using JavaScript click event, or figure out how I would be able to change the image icon on the selected page http://jsbin.com/uraya5/3/ . And detrmining the correct height for the div
Last I tried to make each button a seperate image. These seems like the easist soultion. But jQuery Mobile adds a bunch of extra styles to the button I do not know how to remove. See http://jsbin.com/uraya5/4
So whats the best/easiest way to do this?
How can I remove the style around
links?
Or can I use a single image CSS sliding door method? To reduce HTTP request.
Ok I figured it out
See soultion here http://jsbin.com/uraya5/10/
I had to:
Set width to 19% of each button for
some reason there is spacing between
each button so 20% does not work.
Set ui-bar-a background to black so
it hides the spaces between my
images
Use this JS code to navigate pages $.mobile.changePage($("#about"),
"flip", true, true);
I would still like to use a single image instead of having 5 different images to reduce http calls. So if anyone finds a eligant soultion for this please let me know.