Raphael arrow heads not shown up in pdf - raphael

I am creating a chart using raphael.js. In my chart there are rectangles which are connected using arrows. I am exporting this svg using Raphael Export and then converting this svg string to pdf using batik. But in the pdf i am not getting the arrowheads at the connectors connecting the various rectangles in the pdf. I am using raphael graffle for creating connection between rectangles.
I really need those arrows in the pdf. Please let me know what could be the issue.
Also adding defs tag statically and replacing the arrow-head attribute with marker-end-url by manipulating the svg string doesn't looks like a good solution.Is there any other way of doing it.?

I think i have found the issue.
It seems like the issue is with the defs tag(that contains the marker ids) of raphael are not included in exported svg and also marker-end-url attribute is not present in the path elements because of which arrow-heads are not showing.
In path elements of rapahel, while export, instead of marker id another attribute is added which is "arrow-end": "classic-midium-midium". So when i added the defs tag of raphael into my generated svg and replace the arrow-end attribute with the marker-end-url attribute by giving the required value the arrow heads appeared.
But now the issue is with the positioning of arrow heads. In the exported svg the x and y coordinates of horizontal and vertical arrowheads is slightly more which leads to intersection of arrows with the object(rectangles in my case) which doesn't look good. But yes for now i am going with it.I have modify raphael.export.js. So for any one who looking for solution have to add following 2 lines of code in raphael.export.js
1.In R.fn.toSVG function add following after initialization of svg variable at line number 217
You have to append defs tag of raphael to svg variable here. Not able to post here.
2.In the serializer variable where the tag for path is creatd add following line at line number 199
initial['marker-end'] = "url(#raphael-marker-endclassic33)";
Thanks

Related

Edit SVG color in draw.io

I'm following this guide on editing imported svg's in draw.io but with no luck. I am not getting the style options after inserting the editableCssRules=.*; code on the svg itself.
Has anyone else experienced this? I have the latest version installed and have restarted my machine.
I'm expecting to see additional Fill options as the guide suggests.
If possible, please attach SVG image and add the whole SVG code (Ctrl+e) with inserted editableCssRules=.*; so I can see all the details.
Thanks,
Same problem here.
Here is the whole SVG code as requested :
editableCssRules=.*;aspect=fixed;html=1;points=[];align=center;image;fontSize=12;image=img/lib/azure2/general/File.svg;imageBackground=default;sketch=0;
The option editableCssRules just does what it says: it makes the specified CSS classes editables; in your case by using editableCssRules=.*; you are using a Regex expression to make all CSS classes in the SVG editable.
You are not seeing any options appear after modifying the style because with all probability the SVG you are using does not contain any CSS classes.
You will need to edit your SVG file and add the CSS classes that you need and refer to them in the paths, like so:
<style type="text/css">
.st0{fill:#000000;}
</style>
<path class="st0" d="YOUR_PATH_HERE"/>
Now, in draw.io import the SVG again and after adding the editableCssRules=.*; option to the style you should be able to edit its color, like so:

papaja: Changing font sizes and faces for code listings and R output

Based on the answer to this question, I was able to get 2-column papaja with listings wrapping (rather than overflowing column width). But the listings package turns off various features that help code listings and R output stand out relative to the main text.
A simple solution would be if I could globally change the font faces and/or sizes selectively for code and R output. Is there a way to do that in papaja? I haven't been able to figure this out from papaja or Rmarkdown documentation. Thank you!
When you use the listings package in a papaja (or bookdown) document, what is technically happening is that all code is wrapped into an lstlisting LaTeX environment that comes with its own capabilities of customizing code appearance. Hence, you don't see the syntax highlighting that you would otherwise see if you would not use the listings package. The documentation of the listings package with instructions how to style your code can be found here.
To make use of this, you can extend the YAML header of your papaja document like this:
documentclass : "apa6"
classoption : "jou"
output :
papaja::apa6_pdf:
pandoc_args: --listings
header-includes:
- \lstset{breaklines=true,language=R,basicstyle=\tiny\ttfamily,frame=trB,commentstyle=\color{darkgray}\textit}
Here, I first specify the code's language, and use a tiny monospace font. With frame, I add a frame around the code block, and with commentstyle I set comments in italic and gray.

Can't get the same CRS for different layers in QGIS

I have just begun to fiddle around with QGIS. Now, I have a .shp file containing a map of Sweden. I want to add a vector point to that map by adding a new point layer through the Delimited Text File plugin. The CSV file that I'm importing contains the following data:
id,lat,long
1,62.30000,14.10000
The dot appears on the screen but very far away from the country map. I assumed that was because the layers were set to different CRS, but after right-clicking each layer and changing the CRS to WGS 84, nothing changes. What am I doing wrong here?
EDIT: Just go it to work by deleting the point layer, changing the coordinates in the CSV file to SWEREF99 TM, and importing the layer anew with the same plugin. But I'm still wondering if it's not possible to change the CRS after importing?
You can always change a layer's CRS by overriding the setting in layer properties - General tab. Note that the features are not reprojected when you change this setting. You are just telling QGIS to interpret the coordinates differently.

How to get paper.print() to work?

I have been trying to get the following Raphael code to just write something on the screen with no luck!
paper.print(30, 15, "TEXT", paper.getFont("Arial"), 20).attr({fill: "black"});
Is there anything else you need to do to get the text in the paper?!?!!?
You need to cufonize a font, being sure to indicate that the cufonized font should register itself with Raphael, and include the resulting .js file before you can use getFont to retrieve it (there are no fonts available by default). If you check, I'm reasonably sure you'll find that paper.getFont("Arial") is returning undefined.
Cufon essentially converts every glyph in a provided font into its vector equivalent -- Raphael simply transforms and sequences those paths to produce output.

xsl:fo - Add "z-index" to a text on top of an image

I have a problem.
I need to set some kind of z-index, like you can use on the web in HTML/CSS.
Because I have a text on an image, and therefore I want to be sure that it looks good when printing.
Is there some "z-index" code I can use on theese fo:block elements?
Thanks!
/Daniel
XSL-FO defines z-index property:
http://www.w3.org/TR/2001/REC-xsl-20011015/slice7.html#z-index
You have to check your formatting agent whether does support this property.