I am using reportlab to create a pdf with some portait and some landscape pages. The pdf looks great on screen, but when printing it the default print settings are to shrink the pages, rather than rotate them. At first I though that this was just something to do with the settings, but a few other people have commented on it, using a variety of pdf readers and printers. After a bit of investigating it seems that this is something to do with an option set inside the pdf itself, recommending those print settings. Does anyone know of a way to change this when the pdf is generated?
Related
I'm working on some analysis, and I'm printing things to the console in order to analyze them.
This scrolls on for anywhere from 10-30 "moves". Is there any way to somehow screenshot the entire console? What I'm currently doing is splitting it into 5+ screenshots, then stacking them all vertically in a word document. I know I could write something to essentially turn it all into HTML, but that isn't what I'm looking for. Just hoping to be able to screenshot the entire console window. (I use PyCharm for development, although I'm not sure if there is a IDE specific solution, or just an overall one)
I would just copy-paste it, but I'm using color-codes ANSI sequences for the coloring, and its not wanting to paste properly.
Not sure how effective it will for you. But
Picpack
a third part software works fine for me:-
And there a few other options too which you can try... Because In you're case such Application will be a lot of helpful.
Other software which You can use for this part:-
Apowersoft Screen Capture Pro
Blockquote
Snagit
I have a standalone plot which generates an .html file. The file itself is two plots below a title, using the code below, using this suggestion, where p and q are horizontal bar charts:
P = row(p,q)
div = Div(text=overallTitle)
save(column(div,P))
The result is this:
My aim is to centre align the text, so it is above the middle of the two charts, as well as change the font and size of the text. This answer suggests it can be done like this:
div.css_classes = ["my-custom"]
However, now it seems the CSS class "my-custom" needs to be created. This answer suggests (I think) that adding "a Div element with the style sheet" is the way to achieve that.
I have no experience with CSS at all, do I need to create a .css file that is stored in the same directory as the Python script which defines the function that creates the .html file? It may also be worth mentioning that I'd like to keep the .html file output format, I do make use of the interactive features that it provides, e.g. tooltips.
Any help much appreciated.
I am trying to create a file using python-pptx on a flask server. All of this is working and even the download is working by the problem comes when I try to use text_frame.auto_size in my code. LibreOffice Impress displays the text perfectly but MS Powerpoint does not display the text properly.
Here are the images explaining the issue -
LibreOffice -
Powerpoint -
Also, here is the code that I am using -
text_box = slide.shapes.add_textbox(left, top, width, height)
text_frame = text_box.text_frame
text_frame.word_wrap = True
text_frame.auto_size = MSO_AUTO_SIZE.TEXT_TO_FIT_SHAPE
Any idea what I am doing wrong here?
This is unfortunately a limitation of PowerPoint and an unusual (in my experience) place where LibreOffice actually does better.
You'll notice that if you click in the PowerPoint text, insert a space and then delete it, that the text will automatically autofit. This may not fix the problem, but it points to the cause.
In the XML behind the slide, the current "auto-fitted" font size of the textbox is cached. LibreOffice automatically recalculates this cached figure when the presentation opens; PowerPoint does not.
Calculating the "auto-fitted" font size is the job of the rendering engine, which has access to font sizes, line/word breaks, etc. python-pptx does not include a rendering engine nor does it have access to one (none exists for Python as far as I know). So the best it can do is estimate it and it prefers not to do that, since that's getting into rendering.
However, there is an experimental feature in the form of the .fit_text() method that may get you most of the way there. Basically, that capability was so wanted that someone was willing to sponsor a "best-efforts" solution, which is what that method represents. The documentation at that link explains how to use it and its limitations.
Note that that method is experimental, meaning it won't be considered a bug if it doesn't work the way you need it to. You're free to elaborate it if you can do better.
I am working on an app using wxPython and it kind of needs to print the info shown to the user. On click of the print button, The data shown in the current panel has to be formatted a bit and then be sent to the printer queue.
Google searches give me ways to print text documents. How do I go about with this?
wxPython provides a couple of printing options. You can check out the full printing framework it provides here:
http://wxpython.org/Phoenix/docs/html/printing_framework_overview.html
http://wxpython.org/Phoenix/docs/html/Printout.html
It's fairly complex, but it is also the most flexible way to print using wxPython. They do have another option though that's called HtmlEasyPrinting:
http://wxpython.org/Phoenix/docs/html/html.HtmlEasyPrinting.html
You might want to take a look at that if you're new to wxPython. Of course, you could also use the reportlab package to generate a nicely formatted PDF of your text and then send that to the printer or just open it in the user's default PDF viewer so they can print it.
I am writing an editor which has lot of parameters that could be easily interacted with through text. I find it inconvenient to implement a separate text-editor or lots of UI code for every little parameter. Usual buttons, boxes and gadgets would be burdensome and clumsy. I'd much rather let user interact with those parameters through vim.
The preferable way for me would be to get editor open vim with my text buffer. Then, when one would save the text buffer in vim, my editor would get notified from that and update it's view.
Write your intermediate results (what you want the user to edit) to a temp file. Then use the $EDITOR environment variable in a system call to make the user edit the temp file, and read the results when the process finishes.
This lets users configure which editor they want to use in a pseudo-standard fashion.
Check out It's All Text!. It's a Firefox add-in that does something similar for textareas on web pages, except the editor in question is configurable.
You can also think about integrating VIM in to your app. Pida does this