How to get the font of runs - python-docx

I am using python-docx to parse the file, but getting the font of the runs is None.
I can get the font of the whole paragraph, but how can I get the font of the runs part?

Related

Faster background image on PDF generation with wkhtmltopdf

I'm trying to generate a 5-page PDF based on my HTML file with wkhtmltopdf and it is working well. I'm having a problem, however, regarding the time spent for this task, especifically when using a background image for each page.
When I use a bg_image, wkhtmltopdf uses about ~1.7s to generate, but without it (--nobackground option) only ~0.5s are spent. I've tried to convert my bg_image from .jpg to .png to try to make it faster, but it didn't work.
Is there any workaround onto it? Maybe a parameter change or a css change? (Right now my html file contains a declaration for a bg_image on each page, and a global declararion at the start setting its size and "no_repeat" option).
Thanks a lot for your attention!
I don't know about internals of wkhtmltopdf, how they handle a background. If they need some measureable time, i would expect, that they decode and encode the image data of the background image.
You could also use pdftk utility to apply a prepared pdf-background file to all pages of a pdf, which should be fast:
pdftk in.pdf background back.pdf output out.pdf
https://linux.die.net/man/1/pdftk

Sublime & Highlight: pasting as RTF fontsize issue

I downloaded a package named SublimeHighlight for the Sublime text editor. It serves as my solution to paste syntax highlighted code into Evernote. I have both Evernote and Sublime using the Menlo mono-spaced font. I select text in Sublime, right click and choose "copy as RTF". Pasting into Evernote retains the syntax coloring and indentation. So far so good.
In Evernote I have my default font size set to 14. No matter what my font size is set to in Sublime, when I paste into Evernote the font size is 12. I found this page via google which shed a bit of light on the situation: pygments, used by SublimeHighlight, has a default font size of 12 (do a 'find' on the page for 'fontsize' and you'll see it). The problem is I don't know python (what pygments and SublimeHighlight are written in) and have no idea how to change the font size of pasted-in text from Sublime to Evernote.
All I'm looking for is to past syntax highlighted code from Sublime into Evernote at the correct font size.
EDIT:
I just downloaded Atom and a package for it called Copy as RTF. It works flawless. I really wanted to stay within the Sublime ecosystem, but Atom just works. Plus, Copy as RTF for Atom has more recent updates than SublimeHightlight for Sublime. Whatever works, right?
May be you can try to use UltraEdit, which can help you copy your code as RTF or HTML and paste them into Evernote.
and then
More details can be found here
Or you can try Notepad++ and use the NppExport plugin.
and change the font size you want in Words or Outlook
Check here for more detail
Hope it helps.

Transforming Wysiwig HTML to PDF output

Using "wkhtmltopdf" as a PDF generator, and CKeditor as a Wysiwig editor, the font-size looks different between what I see in my browser, and what is shown in the PDF.
I tried many things: changing the font-size to cm/px/pt, changing the font-size percentage on the body ... but I can't find a way to have the same look in my HTML editor and in my PDF.
Is there some kind of link between PDF font-size and html one's ? Is the output in a PDF smaller than the one in a browser ?
Does someone already managed to obtain the same look in a WebBrowser than in a PDF using those kind of PDF generation tool ?
I found a satisfying solution.
I tried to import font using #font-face, but this doesn't work for me, because multiple #font-face for each "style" (italic, bold, bold+italic) was not recognized by wkhtmltopdf.
I had to use a "free" font ("DejaVu Sans" in my case) that was available on my Windows system and on the Linux Server and is directly available by the system when it generates the PDF.
Those two fonts now renders similarly between my Wisywig and the PDF generated. I also had to use a lot of CSS rules to make it clean, removing PNG images ... but that's another story.

html restrictions in ics file

I'm developing a function (C#, ASP.NET 4) which creates and downloads a .ics file.
I'm trying to figure out what restrictions there are on the html within the X-ALT-DESC property. For example, if I send this:
X-ALT-DESC;FMTTYPE=text/html:<html><body><ul><li style="font-weight:bold">#1</li><li>#2</li></ul><table border=1><tr><td>table test</td></tr></table><span style="font-weight:bold">Site Visit Agenda</span><br/><span>8:00 AM</span><br/><span>Check in with management<br/>Facility Inspection<br/>Training and Meeting Setup</span></tr></table></body><html>
When I open the downloaded file, it opens in Outlook 2010, so that seems o.k. While the list stuff renders as I'd expect, the table border doesn't show, nor do either of the font-weight settings get rendered. (On the plus side, the html tags aren't rendered as text, it just doesn't format the alt desc like you'd see in a browser with the same HTML).
Of course, we're trying to figure out what HTML we can and cannot use to format the information we want to show up in the alt description.
Searching around, I can't find anything which talks about what's allowed and what isn't.
Thanks to anyone who has a pointer.

AS3 Loading Fonts from External SWF - Some work, some do not

I have saved a dozen Fonts into separate swf files (embedded in the library of their respective .fla files). I am loading up to four of them and whilst most of them work, the script silently fails for Arial and Times New Roman. These fonts have been embedded and compiled the same as the others, and when I trace the available fonts I get an object saying that the required font has been loaded ([Object { fontName="Arial", fontStyle="regular", fontType="embedded"}]), however the text is not being rendered. If I change which font to use then the text is rendered using the correct font and performs as expected. It is only with these two fonts that I have a problem with.
Is there a common problem with embedding these two fonts or is it possible I have changed a setting somewhere?
The problem was being caused by me using these fonts in the fla file, the Arial as text on a play/replay button, and Times New Roman as preloader text ('loaded xx%').
My application refused to re-register the fonts as they were already embedded / in use.
My solution?
I 'broke apart' the text on the buttons and made them into a symbol, then removed the preloader text (client didn't want text anyway, just a spinner) and lo and behold my application applies the required fonts. It would have been nice if there was a trace or exception thrown or SOMETHING to let me know that these fonts had already been pre-registered. Oh well. Live and learn.