I am working on a small image comparison script and I am using Cairosvg to transform my source data(svg) into png. However this gets rendered wierd, like spaces between objects get removed. Does anybody have an idea why?
original:
https://prnt.sc/70Gw5shayPtT
rendered
https://prnt.sc/Dqk_nIiCHplQ
Edit: it also moves Objects to different Locations inside the canvas
Reference Image
This is a snapshot for reference, here and I want to resize the default size of the PDF that I have marked with a rectangle box. I can do it manually with any media editor but I want to do it with Python or with command-line with the help of the editor like Inkscape.
I love using jupyter notebooks to document topics for my physics course, so I am having my students use CoCalc and either Markdown or Jupyter notebook to write their lab reports. I have a problem.
In a jupyter notebook, the Markdown way to insert an image is ![Two slit](twoSlit1.png), for example. However you can not control the size, location and wrapping. Stack Exchange helpfully has many suggestions [here] to control the size 1.
However, when I try to convert it to pdf, the images get lost if they are inserted using HTML. For example
![Two slit](twoSlit1.png)
converted with jupyter nbconvert Example.ipynb --to html works fine, but with no control over image size of placement. I can then print this to pdf, but it does not have a good "document" look. But
<img align="right" src="twoSlit1.png" width="200" />
converted with jupyter nbconvert Example.ipynb --to pdf gives a pdf rendering, but the images are missing. I tried many different HTML image codings, but none work with nbconvert --to pdf
The CoCalc File -> Download as PDF via LaTex (.pdf)... does note render the images either.
I get similar results on CoCalc if I create a Markdown document and use pandoc Example1.md -o Example1.pdf to create a pdf file.
BTW, both render the equations perfectly.
I also get the same results on my Mac running jupyter locally (Anaconda distribution, python 3.7)
I got prompt answers William Stein and Harald Schilly at CoCalc when I posted a support request. Here is my answer.
The issue is that the Markdown (and probably the jupyter notebook Markdown cells) Preview pane is rendered in the frontend, not using pandoc in the backend, so when I used pandoc from the terminal I got a different result.
I could get HTML that looks reasonable by putting a HTML <style> tag at the beginning of the Markdown document and putting CSS code in the <style> tag. Then I put my image in an HTML <div> that used the CSS to set its size, float it right, add a caption, etc. I also reduced the size of the header fonts, set the font-family to serif, etc in the CSS file. Then the Preview looked OK, but there were still problems when I printed the Preview and saved it as pdf. So:
Just use Markdown and use HTML for just a few things: a) A <div class="center"> to center the title, author, ... b) <blockquote> to style the abstract. c) A <div class=figure width="280px"> to insert floating figures.
Create a file style.css and run pandoc from the commandline using
pandoc Example.md -s --css="style.css" --mathjax -o Example.html
Open Example.html in CoCalc and use the print icon in the rendered pane and save the pdf file.
I am satisfied. The students can get decent reports without the extra labor of working with LaTeX and with a minimum of HTML. I give them the CSS file.
After following these instructions I ended up with a working script that generates a pdf as I desire. Unfortunately, the text is only visible upon clicking the filled fields! (this only happens when using adobe reader, not when viewing the page through web browsers)
Seeing as users of the module aren't experiencing this issue I'm fairly certain it has something to do with the example script.
If I reassign the black text color in the generated pdf the text shows up as I want. So I'm assuming the issue has something to do with the textColor of the filled fields.
Any ideas how to solve this? (Can I assign field text color through pdfrw as a workaround?)
I am using Ipython Notebook and I would like to save the notebook as pdf. When a notebook contains html figures in markdown mode I cannot export them
In example:
<img src='http://draftingmanuals.tpub.com/14262/img/14262_140_2.jpg'>
represents the following:
However, when I download the notebook as PDF via LaTeX (pdf) the result is without the figure:
Is this a bug or can I avoid this somehow?
This is not really a bug, but a known limitation. Actually there are two issues in your example:
the raw html <img> tag gets stripped when the markdown cells are converted by pandoc to latex (see pandoc docu).
you link to a remote image, which is (currently) not downloaded prior to the conversion.
Thus, it is a bit tricky to get what you desire. The first issue may be overcome by means of a custom filter and custom template. For the second, you may need a custom preprocessor.
Alternatively, you could use python with urllib (e.g. Downloading a picture via urllib and python) and matplotlib to display this image. Such embedded images are converted fine.