How can we add a paper size to printer programmatically - windows

In windows, how can a program add a custom paper size to a specific printer?
To be more specific, we want this change to be permanently visible outside that program, so that other programs can print to that paper size.
We have been able to do that by importing registry values from a file, but that requires admin access, which makes it troublesome in the company.
A solution in any language/stack will be appreciated.

With Set-PrintConfiguration only can set predefine paper, cannot add custom paper size

Related

How to change the size of small wizard image and have custom fields in inno setup

I want all my inno set up pages to look like below :
The small wizard image is accessible using WizardForm.WizardSmallBitmapImage which is of type TBitmapImage.
You can change the size and position of this control to suit your design (within the top panel). You can also hide/reposition the labels (WizardForm.PageNameLabel and WizardForm.PageDescriptiontLabel) in the same way.
As for the extra fields, see this question.

Printing Issue : Setting Paper feed

How to get the paper feed, to set it and to obtain the list of available paper feed on a printer ?
I need to specify the paper tray number from which the paper has to be printed without  putting up the print dialog box in cocoa?
Any thoughts?
Though it is an old thread. There aren't may answers about this problem on the internet.
I succeeded in making it work by setting the InputSlot key on the [printInfo printSettings] dictionary.
[[myPrintInfo printSettings] setObject:#"Tray5" forKey:#"InputSlot"]
It might or might not work for you as I don't know how printer dependent this setting is.

Calculate actual size needed for a MATLAB uicontrol

I'm trying to calculate the actual size needed for uicontrols in a GUI so the GUI can resize itself appropriately. My problem is that the Extent property of a uicontrol is only the text area, and I can't find a way to determine the size of the surrounding control (such as the down arrow in a popup or the margin of an edit control). Is there a way to get the size of the decorations on a control?
I saw this related question on MATLAB Answers, which looked like it ended with no solution as well.
Edit:
For example, I want to calculate how big this popup should be to avoid cutting off the contents:
uicontrol('style', 'popup', 'string', {'a long string'})
Extent only tells me how big "a long string" is, and I still don't know how big to make the popup. I want a way to determine how much extra space is needed on the user's display (without assuming which OS or font sizes they use).
You can use get(hObject,'extent') to find out how much space the string contained in the uicontrol takes up. You can see if this is larger than the uicontrol's position.
The uicontrol Position property gives you the height and width of the bounding rectangle for the control. This has always worked for me. Is there a control where this property does not provide enough information?
If the GUI you're building can be assembled exclusively from Java components, you can use MATLAB's Java integration to create and drive a window using Java Swing components (all from M-code). That sidesteps the problem entirely, since the Java layout managers can do UI layout properly.

Print any document with a textual identifier on it

Is there any possibility of printing any document (e.g. image, PDF, Office document, etc) with a text label at the top of page? Modifying actual files isn't an option for me. I'm wondering if there's anything like that provided in Windows printing system.
Thanks.
Some printers allow you to add a "watermark" to every page they print (but that functionality is all in the printer drivers, now in Windows itself). If that's available to you, you could probably tweak the watermark to be what you need.
Another tactic--but a challenging one!--would be to create your own printer driver that accepts the Print command from any program, just like a printer, then adds the text label you want, then forwards the print job on to a real physical printer.

How would you generate default user profile pictures?

I've been admiring StackOverflow's default quilt-like profile pictures (which I notice are also on the Fail Blog) and am curious what program both are using to generate them.
But what I really want to know is: If you were to design the system to create default profile pictures, how would you do it?
I'm looking for ideas on what algorithm you'd use, as well as things like how you would related the image to the user, be it related to their username, or some portrayal of their progress (ie the image gets more complex, or larger, as they gain reputation).
FWIW, the default pictures are generated by gravatar, which is why you'll see them on more than this site.
It's called an Identicon. On Stackoverflow it Gravatar uses your IP address to generate the image.
This is an editorial, not necessarily an answer.
Those auto-generated avatars on this site come from a service (Gravatar) that focuses exclusively on providing avatars and is therefore the core of their business. For apps that aren't specifically intended to generate and display avatars, I would just go with an empty placeholder (like Facebook). It's a neat feature, but is it worth your development time when a simple placeholder would be just as effective?
A very good source of images would be flame fractals. They are rather computationally expensive, so simply sourcing them from a project like electric sheep or having them be rendered by the user's computer should be considered to offload the work.
Who wouldn't want default profile pictures like these?
alt text http://sheepserver.net/v2d6/gen/202/124809/icon.jpg alt text http://sheepserver.net/v2d6/gen/202/124805/icon.jpg alt text http://sheepserver.net/v2d6/gen/202/125373/i77.jpg alt text http://sheepserver.net/v2d6/gen/202/125431/i116.jpg
Use a Julia set or something like that and set the initial conditions to a hash of the user's email address.
I'd use a jpeg server tool (aspjpg or similar) to manipulate the image on load so it displays their badges within their profile pic.
In fact, using any tool to dynamically generate images is pretty cool. Applying some sort of 3d or flash technology to dynamically create images using random variables for eye spacing or facial structure would be pretty wicked as well.
But ya this is a weird question. hah!
I did something similar years back, I used POV-Ray to generate little 3D scenes with torusses (torii ?) and spheres. There were lots of parameters to tweak such as the position, size and colour of each object.
POV-Ray is a scriptable 3D render engine, you can find it here.
Unfortunately my images all looked too similar to each other. I love Gravatar's identicons as uses on this site. I think the symmetry helps and the shapes are unique enough that you can identify users fairly clearly.
In ruby there have a library http://github.com/swdyh/quilt to generate it!

Resources