MigraDoc PDFSharp Add Page Borders - pdfsharp

How do I add Borders to every page of PDF Doc (variable page numbers) using MigraDoc?

Drawing a simple rectangle around the whole page should work using e.g. a TextFrame that is added to the page header. TextFrame can have an absolute position, can have any size, and can have a border (width and color can be set).
You can mix MigraDoc and PDFsharp and use PDFsharp functions to draw the borders.
See also:
http://www.pdfsharp.net/wiki/MixMigraDocAndPdfSharp-sample.ashx
Here's a sample that calls RenderPage to draw each page:
http://forum.pdfsharp.net/viewtopic.php?p=1735#p1735
You can use the gfx object to draw the borders (before or after RenderPage).
You can also draw a predefined PDF page using the XImage class before calling RenderPage. This allows you to prepare sophisticated borders using e.g. InDesign and mix that with your MigraDoc document.
That's overkill if you simply want a black frame, but it's very simple if the corporate design is already available as a PDF file.

Related

xamarin.forms ImageSource.FromFile slow

I am using a relative layout inside ContentPage.
within the relative layout it i create childern such as labels, button, and image from from file (using the ImageSource.FromFile method), where the image is all over the screen (like backgroundImage)
what i see when presenting the page,is a black screen with all the labels and button and after one second the image appears.
I can't use BackgroundImage property because the file is created dynamically at runtime...
What is the solution for presenting the image at the same time as the labels / buttons ?
You may try using FFImageLoading. This library can be used with Xamarin.Forms and faster than
https://github.com/luberda-molinet/FFImageLoading

Scale pygal svg graphs in web page with susy

I am trying to place two svg files side by side in a web page. This I have done using susy to create the spans, first one is 2 columns wide, the second 10 columns. I place a narrow bar graph in the first span, and a wide line graph in the second span.
The problem I am having is scaling the graphs. they look like this:
But I want them to look more like this:
They are svg files generated with pygal and I achieved the second image by forcing a size in pygal, but it's not elegant and fails wehn the screen size changes.
How can I make the svg bar chart scale the height without scaling the width and do it dynamically in a web browser instead of manually changing the size in pygal? I also cant manually edit the svg files as they are generated via another system and update frequently.
Your graphs should load in two different divs, so that you can set a different width style for each, depending on a view-based css class (like col based classes in Twitter Bootstrap). If you load dynamic svg's (without any explicit_size setting in Pygal) you should be able to handle different window sizes.

r googleVis: How to control html tooltips (positioning, border and background)

I have figured out how to create custom html tooltips by using roles via googleVis. I can easily modify the content using html but I cannot understand how I can control the tooltip box itself.
My problem was generated because some of the custom tooltips I created are falling outside my chart area and I tried (unsuccessfully) to find a way to control the tooltip position. Idealy I would like to make them behave in the exact same way default tooltips behave in googleVis (always stay withinin the chart area).
When I later implemented the same concept into a line chart I found that I have another problem as well. The tooltip is falling on the line so I cannot see what is the exact point that refers to the tooltip.
Would it be possible for example to keep the callout style of default googleVis tooltip and change the content with HTML?
Additionally, do you know if there is any way to control more tooltip properties like border and background color?
i was also looking for the same
1) when laying out your data, make sure it has columns alternating between, say, data and tooltips, data and tooltips,... that way it is possible to customize tooltips for multiple columns (it does not work if you just append - à la cbind - a set of tooltips columns to your data frame).
Additionally try this http://rcharts.io/viewer/?6644957#.VHcpEkvrdbg

Dojo GFX widgets displaying float-like behaviour instead of correct positioning

I'm using Dojo GFX to do some simple drawing, but having a problem with IE 7/8 (switching browsers is not an option).
If I create a div, set up a surface and draw some rects, they draw correctly relative to the div, so far so good.
However, what I want to do is create a widget, something with an embedded 'surface' that draws based on some widget-specific data. As such, I have a widget that contains a div, and I draw into this div. When I do that, the rects I create behave as if they are responding to a float:right, appearing in order they are created and ignoring the 'x' parameter.
I assume that this behaviour is something to do with CSS, but I haven't got to the bottom of it yet. Any ideas or solutions gratefully appreciated!
Updates:
I've disabled all stylesheets and I am not using style attributes. No difference to the behaviour.
I've inspected the markup that gets generated using IE8 dev tools. Apart from the different location of the containing div, the only difference I can see is that the v:roundrect elements have no child elements when created against the widget div, but they do have empty elements like stroke when created against the div referenced by ID.
Reading back through the docs, a difference I can see that might be responsible is that the postCreate method where I am doing my drawing is manipulating a div that has not been added to the dom yet, whereas drawing on a hardcoded div is done when it does exist. Maybe the difference in rendering is something to do with this? Is there a specific lifecycle function which is appropriate to draw in for widgets?
It seems that if you are going to use Dojo GFX and draw on DOM elements that are created as part of a widget in IE7/8, you must actually do the drawing in an override of the startup() method.
Drawing in the postCreate() method causes incorrect rendering resembling a float: left.

How do I set the line height of a FormattedText

I am building a text-to-image generator that takes a text, a font, a max width and some other parameters and generates an image from this. It will be used as a custom server control in a web site to generate headlines.
I allready have a component like this which uses GDI+. The problem with this is that GDI+ is incapable of setting line height which means I have to render the text first and then copy the resulting rows into a new Bitmap using the line height I want.
I am now looking at using WPF components instead and have managed to create text images using FormattedText. The problem is that I still cannot set line height. Is there a way to do this? If I could set letter spacing as well, that would be even better.
You should just be able to set the LineHeight property, is that not working?

Resources