Initial Ubuntu guest screen resolution on VMWare - windows-7

Windows 7 (host) with VMWare Workstation 11.
Kubuntu 15.04 as Guest.
Problem:
After system startup, in example, on login screen - screen size/resolution is 800x600. Ba, even earlier - during startup when console is active. Making window fullscreen isn't helping, as console output limits itself to small window in the middle.
Setting VMWare window into fullscreen helps a little - screen gets bigger (size of host 1920x1080) - guest Kubuntu applications windows are taking whole screen area. But, for example, desktop wallpaper acts still as if 800x600 was in effect. And inside System settings -> display Virtual screen stays at 800x600, nevertheless Resolution list is long. Unfortunately - 1920x1080 isn't there.
This what xrandr shows:
Screen 0: minimum 1 x 1, current 1920 x 1080, maximum 8192 x 8192
Virtual1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 0mm x 0mm
1920x1080 60.0*+
2560x1600 60.0
1920x1440 60.0
1856x1392 60.0
1792x1344 60.0
1920x1200 59.9
1600x1200 60.0
1680x1050 60.0
1400x1050 60.0
1280x1024 60.0
1440x900 59.9
1280x960 60.0
1360x768 60.0
1280x800 59.8
1152x864 75.0
1280x768 59.9
1024x768 60.0
800x600 60.3
640x480 59.9
From this it seems that proper resolution is set properly.
Now, some magic. I logout from Kubuntu. Login screen is already taking whole 1920x1080 screen area. Settings -> Display shows Virtual screen as 1920x1080, xrandr shows the same set of resolutions.
VMWare Tools were installed - at least to the point that I have bidirectional access to shared folders.
What to do to have proper screen resolution right from the beginning? Yea, I know that I can freeze whole session and resume it whenever I need it.

My configuration is host : windows 7 and vmware guest : ubuntu 14.04.
For long time I've seen if I update the vmplayer or some software in vmplayer that screws my display and then in full screen it can no longer capture host display.So today I just followed the instruction provided in this link and fixed it without installing any additional software.I hope it helps other.
At first run :
$ xrandr -q
tanay#ubuntu:~$ xrandr -q Screen 0: minimum 1 x 1, current 1904 x 1070, maximum 8192 x 8192 Virtual1 connected primary 1904x1070+0+0 (normal left inverted right x axis y axis) 0mm x 0mm 800x600
60.0 + 60.3 2560x1600 60.0 1920x1440 60.0 1856x1392 60.0 1792x1344 60.0 1920x1200 59.9 1600x1200 60.0 1680x1050 60.0 1400x1050 60.0 1280x1024 60.0 1440x900 59.9 1280x960 60.0 1360x768 60.0 1280x800 59.8 1152x864 75.0 1280x768 59.9 1024x768 60.0 640x480 59.9 1904x1070_75.00 74.9* Virtual2 disconnected (normal left inverted right x axis y axis) Virtual3 disconnected (normal left inverted right x axis y axis) Virtual4 disconnected (normal left inverted right x axis y axis) Virtual5 disconnected (normal left inverted right x axis y axis) Virtual6 disconnected (normal left inverted right x axis y axis) Virtual7 disconnected (normal left inverted right x axis y axis) Virtual8 disconnected (normal left inverted right x axis y axis)
Then you can see which output is connected,here Virtual1 is connected.
Then guess a good resolution for your screen.For me I guessed following configuration.
Eg:cvt <horizontal length> <vertical length> <refresh rate>
$ cvt 1900 1070 75
The output is
# 1904x1070 74.87 Hz (CVT) hsync: 83.85 kHz; pclk: 216.00 MHz Modeline "1904x1070_75.00" 216.00 1904 2040 2240 2576 1070 1073 1083 1120
-hsync +vsync
Then you need to copy the text after "Modelline" and paste that in following command after "newmode" like the example below
$ xrandr --newmode "1904x1070_75.00" 216.00 1904 2040 2240 2576 1070 1073 1083 1120 -hsync +vsync
Then take the screen resolution details from the quote and use it in next command.For me the command is
$ xrandr --addmode Virtual1 1904x1070_75.00
The next command to set it in ubuntu for me is
$ xrandr --output Virtual1 --mode 1904x1070_75.00
If the last command doesn't work for you,you can go back to ubuntu display gui setting and can chose the display you have added just now.For me the option was 1904 x 1070 (16:9)
However if you are fine with this experiment and have found the desired screen resolution and to make that permanent,write the all the last 3 commands starting from xrandr --newmode command in your .xprofile file using following command and then save,exit and restart your ubuntu vm and you will get your desired resolution permanently.
$ gedit ~/.xprofile

Here is what worked for me-
$ xrandr
out-put-
Screen 0: minimum 8 x 8, current 1024 x 768, maximum 32767 x 32767
DP1 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
VGA1 connected primary 1024x768+0+0 (normal left inverted right x axis y axis) 477mm x 268mm
1024x768 75.08*+ 60.00
800x600 60.32 56.25
848x480 60.00
640x480 59.94
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
1920x1080_60.00 (0x113) 173.000MHz -HSync +VSync
h: width 1920 start 2048 end 2248 total 2576 skew 0 clock 67.16KHz
v: height 1080 start 1083 end 1088 total 1120 clock 59.96Hz
Note:- found the connected on, for my case VGA1 connected primary
1024x768+0+0 all others are not connected.
$ cvt 1920 1080
$ sudo xrandr --newmode "1920x1080_60.00" 173.00 1920 2048 2248 2576 1080 1083 1088 1120 -hsync +vsync
Note:- based on connection we have to use on as-
4. sudo xrandr --addmode VGA1 "1920x1080_60.00"
It worked for me, as suggested here, another source presented here.

Related

GhostScript: Bug under High Sierra setting PDF Metadata?

Can anyone confirm the following behaviour on MacOS 10.13 High Sierra with GhostScript? I don't get the problem when using 10.12 Sierra.
When I create PDFs in GhostScript, it always leaves the Title, Author and other metadata blank.
I know that you can set the metadata with PDFmarks within the PostScript file itself (or a secondary merged PS file that just contains PDFmarks), but that requires manually setting the field for each file.
Currently, my PDFs fail PDF-X validation until I manually add the metadata.
My PostScript does contain DSC comments, and the GS documentation implies that this should be picked up, as ParseDSCCommentsForDocInfo is true by default.
/usr/local/bin/gs \
-dPDFX \
-dNOPAUSE \
-dBATCH \
-sDEVICE=pdfwrite \
-sOutputFile="$filename" \
-dProcessColorModel=/DeviceCMYK \
-dCompatibilityLevel=1.4 \
"$f" \
/Library/PostScript/PDFX_def.ps
The source of the PostScript does not seem to be a factor: Adobe apps like InDesign, MacOS's cgpdftops, all behave similarly.
Here's a simple test PS file. Distiller takes the comments and uses them for DocInfo; GhostScript doesn't on MacOS 10.13.
%!PS-Adobe-3.0
%%Title: (MyTitle.file)
%%Creator: (MyApp: cgpdftops CUPS filter)
%%CreationDate: (Saturday, February 03 2018 10:19:01 GMT)
%%For: (User Me)
%%BoundingBox: 36 36 576 756
%%Pages: 1
%%LanguageLevel: 2
%%EndComments
%%BeginSetup
% this is where fonts would be embedded
%%EndSetup
%%Page: (1) 1
%%BeginPageSetup
% this is where page-specific features would be specified
%%EndPageSetup
% Draw a black box around the page
0 setgray
1 setlinewidth
36 36 540 720 rectstroke
% Draw a two inch blue circle in the middle of the page
0 0 1 setrgbcolor
306 396 144 0 360 arc closepath fill
% Draw two half inch yellow circles for eyes
1 1 0 setrgbcolor
252 432 36 0 360 arc closepath fill
360 432 36 0 360 arc closepath fill
% Draw the smile
1 setlinecap
18 setlinewidth
306 396 99 200 340 arc stroke
% Print it!
showpage
%%EOF
As of MacOS Mojave 10.14.3 and GhostScript version 9.26, this now fixed. I can only presume it was a bug in GhostScript or MacOS.

Mac Software to create different versions of an image

I'm looking for a software for mac that I can from one picture generate several versions with predefined sizes:
max with 300px
max width 600px
max width 1200px
Do you know a sw that can do this ?
Thanks
I think you can use OSX's built-in sips.
Start with a 2048x1536 image, copy it and resize copy to 300px wide
cp input.png 300.png
sips --resampleWidth 300 300.png # ==> 300x225 image
copy and resize the copy to 600ox
cp input.png 600.png
sips --resampleWidth 600 600.png # ==> 600x450 image
copy and resize to 1200px
cp input.png 1200.png
sips --resampleWidth 1200 1200.png # ==> 1200x900 image

want eps file and text into single compound path using ghostscript

what I want is to add eps file into temporary ps file which has text written, then I convert my ps file to eps file using ghostscript, but when I see my eps file in AI outline mode, I see extra square around my eps file which is size box, which should not be there, It should be part of single compound box
Ghostscript version is 9.05 and before I include eps into ps I need to resize it. So resized eps file shows page border into outline mode. Which is actually not there, but when it goes to machine it will cut out that path which should not be case.
Alright, I think I have some understanding of what you're doing and where the trouble may be creeping in. As I commented, you're running the file through ghostscript multiple times. Each time it has to interpret the postscript code and construct an internal display-list representation and then recreate appropriate postscript code on the output end. So it's the clone of a clone of a clone problem. Any little hiccup can cause cascade failures.
So, enough of being preachy. The alternative is to manipulate the eps file as text.
So, if we want the image to be scaled to fill a 500x500 square, we will be guided by the number in the BoundingBox comment. I'll quote this silly file from the linked question as an example:
%!PS-Adobe-2.0 EPSF-2.0
%%BoundingBox: 72 700 127 708 %<-- modify this
%%HiResBoundingBox: 72.000000 700.000000 127.000000 707.500000 %<-- delete this
%%EndComments
% EPSF created by ps2eps 1.68
%%BeginProlog
save
countdictstack
mark
newpath
/showpage {} def
/setpagedevice {pop} def
%%EndProlog
%%Page 1 1 %<-- insert translate and scale after this line
/Times-Roman findfont
11 scalefont setfont
72 700 moveto
(This is a test)show
%%Trailer
cleartomark
countdictstack
exch sub { end } repeat
restore
%%EOF
So, the BoundingBox was %%BoundingBox: 72 700 127 708 and it needs to be 0 0 500 500 or rather (to preserve the aspect ratio) 0 0 x 500 or 0 0 500 y where x or y (whichever it happens to be) is < 500. The existing size is 127-72 x 708 - 700 = 55 x 8. So our scaling factor is 500/55. But we also want to translate the lower-left corner to the origin, and its simplest to do that first, so the scaling doesn't affect the interpretation of the numbers.
So, to take 72 700 127 708 to 0 0 500 y, first we add -72 -700 translate to the file, and modify the bounding box to 0 0 55 8, and delete that silly HiRes line: we don't really need it.
Then, we add 500 55 div dup scale (let the interpreter do the math, hee hee). So the maximum x will now be 500, but, oh, what to put for the y? A quick calculation yields 72!
So, this awk program will modify an eps file to be 500 points wide, with y scaled appropriately.
/%%BoundingBox: ([^ ]*) ([^ ]*) ([^ ]*) ([^ ]*)/{x=$2;y=$3;w=$4-x;h=$5-y;print $1,0,0,500,(500/w)*h}
!/%%BoundingBox:/&&!/%%HiRes/{print}
/%%Page /{print -x,-y,"translate"; print 500,w,"div dup scale"}
Usage:
$ awk -f epsscale.awk etest.eps

Print a postscript document with CUPS and a thermal printer

I installed an epson TM-T20 in Ubuntu 12.04, using the official driver. This is a thermal printer, I'm using 80mm paper.
My problem: When I print an image (using a postscript document) it waste a lot of paper because the image uses around 5cm and the printer before the image sends out 25cm of white paper.
I use the following command to send the document to the printer:
lpr -P tm-t20 -o document.ps
The printer prints the image (a 200x200 image), but first sends out a lot of non printed paper.
The printer wasn't recognized by CUPS (using the web interface at localhost:631). Then I installed it using the following procedure:
sudo lpadmin -p tm-t20 -E -v serial:/dev/ttyUSB0 -P /usr/share/ppd/epson-tm-t20-rastertotmt.ppd
Then the printer appeared in the CUPS web interface and I configured it (baud rate, bit parity, etc).
The printer works ok when I send some text.
Here is part of the printer ppd:
*DefaultPageRegion:RP80x297
*PageRegion RP80x297/Roll Paper 80 x 297 mm: "<</PageSize[204 841.8]/ ImagingBBox null>>setpagedevice"
*PageRegion RP58x297/Roll Paper 58 x 297 mm: "<</PageSize[141.7 841.8]/ ImagingBBox null>>setpagedevice"
*CloseUI: *PageRegion
*DefaultImageableArea: RP80x297
*ImageableArea RP80x297/Roll Paper 80 x 297 mm: "0 0 204 841.8"
*ImageableArea RP58x297/Roll Paper 58 x 297 mm: "0 0 141.7 841.8"
*DefaultPaperDimension: RP80x297
*PaperDimension RP80x297/Roll Paper 80 x 297 mm: "204 841.8"
*PaperDimension RP58x297/Roll Paper 58 x 297 mm: "141.7 841.8"
I suppose that this waste of paper is because the 297mm of long that appears in the ppd file. Then I tried adding another configuration of 100mm instead of 297mm, but the problem persists.
I also tryied adding the tag %%DocumentMedia to the ps file, but the same problem:
%!PS-Adobe-3.0
%%Creator: GIMP PostScript file plugin V 1.17 by Peter Kirchgessner
%%Title: yay.ps
%%CreationDate: Thu Sep 13 13:44:26 2012
%%DocumentData: Clean7Bit
%%LanguageLevel: 2
%%Pages: 1
%%BoundingBox: 14 14 215 215
%%
%%EndComments
%%DocumentMedia: Plain 72 72 0 white Plain
%%BeginProlog
% Use own dictionary to avoid conflicts
10 dict begin
%%EndProlog
%%Page: 1 1
% Translate for offset
14.173228346456694 14.173228346456694 translate
% Translate to begin of first scanline
0 199.99999999999997 translate
199.99999999999997 -199.99999999999997 scale
% Image geometry
200 200 8
% Transformation matrix
[ 200 0 0 200 0 0 ]
% Strings to hold RGB-samples per scanline
/rstr 200 string def
/gstr 200 string def
/bstr 200 string def
{currentfile /ASCII85Decode filter /RunLengthDecode filter rstr readstring pop}
{currentfile /ASCII85Decode filter /RunLengthDecode filter gstr readstring pop}
{currentfile /ASCII85Decode filter /RunLengthDecode filter bstr readstring pop}
true 3
%%BeginData: 14759 ASCII Bytes
Any idea?
Finally after a lot of pain. I discover that the problem was the serial to USB cable (in order to connect the serial printer to an USB port). I tried with two different serial to USB cables, but the problem persists and finally I conclude that The printer works erratically if is not connect to a "real" serial port. I tested the printer under identical conditions in a PC with a serial port and it works perfect, just installing the driver provided by epson and giving chmod 777 to /dev/ttyS0. At the job list sometimes I see the error: "/usr/lib/cups/filter/pstopdf failed". But the printer prints ok, like no error occurred.
I have to chmod 777 /dev/ttyUSB0 in order to get the printer working (Even if a run the commands with sudo).
I'm getting acceptable results (text is not at the center) with the option media=B8
lp -d tm-t20 -o media=B8 document.ps
I also tried with
lp -d tm-t20 -o media=Custom.80x90mm document.ps
But the printer doesn't print and the job appears as completed at the cups web interface.
If I try with
lp -d tm-t20 -o media=Custom.200x190 document.ps
The printer prints (not correctly centered, I guess that I need to try with different values until I get the desired result). The paper dimensions in dots are in this site: http://paulbourke.net/dataformats/postscript/
The printer isn't cutting the paper, I dont know how to give that option (print and cut the paper).
The options accepted by the printer are:
lpoptions -p tm-t20 -l
PageSize/Media Size: *RP80x297 RP58x297 Custom.WIDTHxHEIGHT
Resolution/Resolution: *203x203dpi
TmtSpeed/Printing Speed: *Auto 1 2 3 4
TmtPaperReduction/Paper Reduction: Off Top *Bottom Both
TmtPaperSource/Paper Source: *DocFeedCut DocFeedNoCut DocNoFeedCut DocNoFeedNoCut PageFeedCut PageFeedNoCut PageNoFeedCut
TmtBuzzerControl/Buzzer: *Off Before After
TmtSoundPattern/Sound Pattern: *A B C D E
TmtBuzzerRepeat/Buzzer Repeat: *1 2 3 5
TmtDrawer1/Cash Drawer #1: *Off Before After
How to make the printer print and cut the paper? I need to do it from the console, to use it from a custom C++ program. If you have any other experience with this kinds of printers under Linux, please give me some advice. My goal is to use the printer from a C++ program, I didn't find a fast way to do it (sending directly ESC/POS commands to the printer, there isn't official documentation to do it under Linux), so I'm working with CUPS from the console.
Paper CUT SOLVED:
lp -d tm-t20 -o media=Custom.200x258 -o source=DocFeedCut document.ps
I don't know why it works, because as is shown in the options DocFeedCut is the default option.
Now I just will try to center correctly the text.

Resizing an Xvfb display

Simple Question: Is there a way to resize a Xvfb display?
I tried with RandR but it seems that the RandR extension is not supported by Xvfb. Are there other ways to resize the screen?
Thanks for your help!
You can use the server-args command line argument to specify a custom resolution for the virtual frame buffer being created, but this does not change the resolution of an existing virtual frame buffer:
xvfb-run --server-args="-screen 0, 1024x768x24" ...
Most distributions now ship a version of Xvfb with randr support.
The code was committed in late 2015 vfb: add randr support (v2).
To resize you will first need to define a new mode (you can use tools like gtf to get the modeline definition values), add it to the virtual output, and then you can switch to it.
ie for 1280x1024:
xrandr --newmode "1280x1024" 109.00 1280 1368 1496 1712 1024 1027 1034 1063 -hsync +vsync
xrandr --addmode screen 1280x1024
xrandr -s 1280x1024

Resources