Reportlab change font size in drawString - pdf-generation

I tried to do everything, but I really can't get a way, how to change font size in drawString element. See the example below please
<illustration width="20" height="20">
<image file="checkbox.png" x="10" y="20" width="7" preserveAspectRatio="true" />
<drawString x="20" y="20">YES</drawString>
<image file="checkbox.png" x="10" y="10" width="7" preserveAspectRatio="true" />
<drawString x="20" y="10">NO</drawString>
</illustration>
This is my code, however I have really no idea where the font-size comes from. And I am unable to find how to change font size for words "YES" and "NO". Can anybody help? Thank you a lot

The problem can be resolved by using
<setFont name="fnt1" size="11"/>
before element.

Related

I'm trying to reference an image (in a svg code) that is in the same folder that my svg is, but I tried several ways that didn't work

I have this file named loadingReviewButtonSpinner.gif, and this file is saved on my computer in the folder where I have my project images (assets/images), but I'm trying to reference to this file in my SVG, and it isn't working.
<svg
<image
width="70" height="70"
transform="translate(30.1 -7.5)"
href="loadingReviewButtonSpinner.gif"
/>
</svg>
I have also uploaded this same image (loadingReviewButtonSpinner.gif) to a server online, and when I do the reference to the online image, it working 100%
<svg
<image
width="70" height="70"
transform="translate(30.1 -7.5)"
href="https://tinypic.host/images/2022/05/18/animation_500_l1ki69jf.gif"
/>
</svg>
But I really need it to work for me referring to the folder where my project is.
And I already tried so many options, but none of them is working...
For example, I tried:
href="file://loadingReviewButtonSpinner.gif" (and the variations with the path)
href="//..//..loadingReviewButtonSpinner.gif"
href="file:///loadingReviewButtonSpinner.gif"
I did what was said in the comment and it worked.

Attribute {StaticResource resourcename} value is out of range

I have a button in a page defined as:
<Button Content="{StaticResource resourcename}" HorizontalAlignment="Left" VerticalAlignment="Top" Width="32" Height="32" >
and the resource "resourcename" is defined in the app as follow:
<Grid x:Key="resourcename">
<Path Fill="Black" Stretch="Fill" Data="M7.99799,14.26781 .....
</Grid>
</Application.Resources>
When the application starts the following exception is raised:
Attribute {StaticResource resourcename} value is out of range.
I can't understand why, and BTW into the designer I can see the path correctly displayed. What I'm missing ?
I have seen people trying to and complaining about Content being set from a UIElement stored in a resources collection. I would refrain from that approach - one problem being - a UIElement might only be a child of a single UIElement. A better approach might be to store a DataTemplate in resources and set that DataTemplate as a button's ContentTemplate.

Alt for images in JasperReports

While putting an image element in PDF report, how can we give the alt description or similar kind of description for that image? The idea is to read the description when some screen reader is used to read the PDF. Currently, the reader (JAWS) says just 'graphic' when encountering an image in the PDF.
Thanks!
Found out at last.
In case anyone is having similar query;
You could use the hyperlinkTooltipExpressionto set the alternate text. Something like this;
<image isLazy="true">
<reportElement positionType="Float" x="0" y="0" width="100" height="100"/>
<imageExpression class="java.lang.String"><![CDATA[$P{imageToBeShown}]]></imageExpression>
<hyperlinkTooltipExpression><![CDATA["Description goes here"]]></hyperlinkTooltipExpression>
</image>

WIX equivalent of a C# textbox?

I'm staring at this page wondering which control is a textbox.
Seems like it should be obvious, but I don't see it.
http://wix.sourceforge.net/manual-wix2/wix_xsd_control.htm
Also, is there a built-in "Browse" button to select a file from disk?
Or do you have to code all that yourself?
Thanks,
Neal
I finally found the textbox (second one below). It was a matter of setting the Type="Edit".
When I was looking at the web page mentioned, I was first looking only at "children" thinking that I would see a textbox there.
<Control Id="Description2" Type="Text" X="135" Y="140" Width="220" Height="20" Transparent="yes"
NoPrefix="yes" Text="Full path to settingsFile:" />
<Control Id="UserSettingsFileName" Type="Edit"
X="140" Y="150" Width="160" Height="80" Property="SettingsFilename"
Text="C:\Path\SettingsFileGenerator.xml">
The initial value of the edit/box was not set to the text I specified. Any ideas on that? Do I have to set the property value outside of the control?
But if there is an reasonably easy-to-use "browse"/file-picker, I'd like to know about that too.
The wix sources contain a BrowseDlg.wxs file. This file defines the dialog which is used in WixUI_InstallDir to allow the user to enter or browse for the install path, which is exactly the type of functionality you need.
It looks like you just have to use the Type "PathEdit". You also have to give the property where you want the result to be stored, in this case _BrowseProperty:
<Control Id="PathEdit" Type="PathEdit"
X="25"
Y="202"
Width="320"
Height="18"
Property="_BrowseProperty"
Indirect="yes" />

Include SVG file in SVG

I've got a linearGradient in the defs section of my SVG file, and reference it with fill="url(#myGradientName)". That works great so far.
I think I should be able to put my whole defs section in its own SVG file, and then just reference that from all my SVG images. That is, something like:
styles.svg:
<svg xmlns=...>
<defs>
<linearGradient id="myGradient" ...>
</linearGradient>
</defs>
</svg>
image.svg:
<svg xmlns=...>
<rect width="100" height="100" fill="styles.svg#myGradient"/>
</svg>
But I can't seem to get the style to apply. Do I have the wrong syntax for IDs external to this file (styles.svg#myGradient)? Do I need to explicitly include the file first somehow?
I've been pouring over the SVG spec and it looks like this should be possible, but none of the examples actually show it being done.
Edit: The FOP FAQ suggests that the correct syntax is fill="url(grad.svg#PurpleToWhite)", but that doesn't work in Gecko or Webkit. Is that correct and nobody supports it, or am I doing something else wrong?
It looks like this is only supported under Firefox 3.1.
You do need to say fill="url(styles.svg#myGradient)". That works in Firefox 4 beta 6 and I imagine it worked in Firefox 3.5. But Chrome (7.0.517.41 beta) and the IE9 beta (9.0.7930.16406) still do not support this. It looks like they both look for #myGradient in the current document instead of actually going to the specified URL. Gross.
Here are the complete files I used to test this:
styles.svg
<svg xmlns="http://www.w3.org/2000/svg">
<defs>
<linearGradient id="myGradient">
<stop offset="0" stop-color="red" />
<stop offset="1" stop-color="black" />
</linearGradient>
</defs>
</svg>
image.svg
<svg xmlns="http://www.w3.org/2000/svg">
<rect width="100" height="100" fill="url(styles.svg#myGradient)"/>
</svg>
Actually, the FOP FAQ is right, the correct syntax is embracing the URI with url(...). Just checked with my Firefox, and it handles fills only with surrounding url(). It would be a bug in Safari or Opera, if the'd handle it differently.
I coincidentally filed a similar question, but with similarly little success.
Cheers,

Resources