Ghostscript is not printing according the page orientaion - command-line

I am using the ghostscript command to print a pdf file to a printer.
If the pdf has some pages landscape and some portrait - it prints them all in portrait.
When I take the same pdf and do print from the Adobe reader - it prints correctly.
I tried this thread:
Ghostscript doesn't keep landscape page orientation
but got the same result..
The command is:
gswin64c.exe -dPrinted -dBATCH -dNOPAUSE -dNOSAFER -q -dNumCopies=1 -sDEVICE=mswinpr2 -sOutputFile="%printer%HP Officejet 4500 G510g-m" "myFile.pdf"
and I tried the next options as well
-sPAPERSIZE=a4 -sPAPERSIZE=legal
-dORIENT1=false
-dAutoRotatePages=/None

So you are using the mswinpr2 device. While useful, the device has some limitations, and I think you have (possibly) come across one of them.
The device works by having Ghostscript render the input to a bitmap, which it then blits into a device context derived from the printer device. The context is then told to print itself.
The problem is that Ghostscript's rendering is driven by the initial device setup, because Ghostscript is not in charge of the printer device. Basically Ghostscript can't change the device setup so it has to alter the way the input is rendered to match the initial configuration.
I would have expected that Ghostscript would scale and potentially rotate the content so that it fits on the media available in the printer's default configuration.
You still haven't been totally clear about the problem; does your printer have both portrait and landscape media installed ? Are you expecting that portrait pages are printed on portrait media and landscape pages on landscape media ? Or is there some other problem ?
I can definitively say that Ghostscript's mswinpr2 device will not select different media, it will only use the default media.
[much later edit]
I don't know if its the same problem (or the same poster), but this might be relevant.

Related

Custom screen resolution for Android on Raspberry Pi 3

I am using a 7" TFT LCD Display (1024x600) with the Raspberry Pi 3 and I can not make it work with that screen resolution. It looks like it is zoomed in.
I know that there are a bunch of topics about this issue in and out stackoverflow, and I have tried to edit the config.txt as much as I could, never getting different results. (BTW: I got it working with Raspian really easily editing the config.txt, but it does not work for android for some reason).
I used this Android image, and this is how my config.txt looks like:
hdmi_force_hotplug=1
hdmi_drive=2
hdmi_group=2
hdmi_mode=87
hdmi_cvt 1024 600 60
Framebuffer_width=1024
Framebuffer_height=600
disable_overscan=1
config_hdmi_boost=5
kernel=zImage
device_tree=bcm2710-rpi-3-b.dtb
dtparam=audio=on
dtparam=i2c1=on
dtparam=i2c_arm=on
dtoverlay=vc4-kms-v3d,cma-256
initramfs ramdisk.img 0x01f00000
mask_gpu_interrupt0=0x400
avoid_warnings=2
gpu_mem=256
enable_uart=1
I would really appreciate some insight on this.
PS: I tried different resolutions with the hdmi_group and hdmi_mode, according to this RPi article, but the image remains the same.
So I finally got it working by trial and error, and I posted the answer in the RaspberryPi Stackexchange site as suggested. Case closed for now.
I had the same 'zoomed in' effect using Android Studio (React-Native) with an 800*480 HDMI screen (Waveshare 5-inch). When I used Dimensions, within the app, to get the screen size, it returned approx 530 * 300, which had the additional effect of changing the bucket size for images being copied over from the assets folder. My solution, found after some considerable time, was from Dokter_Bibber at this link. It did not give me precisely the same display as my 800*480 Android-Studio-emulator that I was using to develop my page, but pleasingly close.
Quoting from the link:
Start Console window and type :
adb shell wm size 800x480
---AND (186.59 ppi calculated here : https://www.sven.de/dpi/ 4)
adb shell wm density 187
THEN (reboot the device)
adb reboot

Loading pictures in Chrome

On some occassion, Google Chrome download a line (of maybe 20px) at a time and display it right away. So the picture is rendered from top to bottom. Using html tag results in this.
On other occasion, Google Chrome displays a picture from facebook photos in an interleaving way, first a bit grainy, and then it becomes clearer as more data has been downloaded.
This way the picture is displayed wholly at first with low resolution and the resolution is getting higher as if it's being streamed.
Is there a special tag to do this "streaming" ?
The correct word is "interlace" - when you save the image in some web formats (.jpeg for example), you often have the option to save it interlaced - I know this option exists in Photoshop's "Save for Web".
So it's not an html tag - it's the way the image is encoded. And then the browser has to be capable of "streaming" interlaced images (most modern ones are).
Hope this helps

Images showing in simulator but not on the iPhone device

So when I run the application from the device the pictures show up and everything works great. However, when I move to the device I run in about 10 out of 38 pictures that don't show up. I am pulling the names for the images from an sqlite database and I already checked and the names are correct, case and everything. I checked the bundle and the images are correctly in there.
Does memory play into effect in this? I am not really sure what else could cause this to happen??
Thanks!
Solution:
The files somehow were not saved properly and were unable to be opened by say photoshop or paint even. So with the files not being able to be open they weren't showing up... Thanks for the help everyone!
First thing to check is the case of the strings you're using to refer to the resources. The iPhone is case sensitive, but the simulator is not.
Oops, just seen that you checked the case. Better log all your UIImage creation calls then!
The simulator accepts a wider range of image formats. Sometimes you had a specific file type that the device cannot display. Double check the 10 files looking for some difference from the others ones.
Yes, memory absolutely plays into this. Check your UIImage creation calls and make sure they dont return empty. Also, check to see if youre getting memory warnings in the console window.
Generally, if in-memory size was the culprit, your application would crash with a low memory error on the device. However, it seems like the images just don't display.
One other thing that can be going wrong is the size of the images. UIViews on the iPhone can only have dimensions smaller than the maximum texture size supported by the GPU. Apple states that this is 1024 x 1024, but I've found it to be more like 2048 x 2048 on even the original model iPhone. You may be creating a view for some of these images that exceeds this size in one dimension, but your Mac has a larger maximum texture size on its GPU and so it displays fine in the Simulator.
Apparently the iPhone caches the launch screens. So in my case, I had to reboot my iPhone before being able to see the image.

Capture specific-sized images with an Ubuntu command-line program

I am currently working on a project and would like to know if you heard of any command-line tools that lets your webcam take specific-sized images? I found some but none of them works.
In my case, I'd need to capture 1600x1200 pictures.
I was able to use uvccapture -m -x640 -y480 -oimage.jpg.
If your webcam supports 1600x1200, then this method might work. When I try anything more than 640x480, uvccapture prints:
format asked unavailable get width 640 height 480

Create a PDF for iPhone, how to?

I'm trying to write a eBook, for the iPhone, using PDF format.
The problem is, I can't create a PDF with 5 cm x 5 cm (example).
I've tried Adobe Acrobat Pro 9. Didn't work, since it is not possible to custom the paper size.
I've tried Pages 08, but it's also not possible (it's possible to set the custom size, but it doesn't work, might be a bug).
I've tried Microsoft Word. The generated PDF is a mess... Doesn't work right.
So.. I can't create a PDF, with a custom paper size. This is nuts... There must be a tool or something that works right.
Anyone knows any tool that works well?
Thanks
On the Mac (since the underlying drawing system Quartz is based on the same ancestor as PDF), you can always generate PDFs by doing Print->Save as PDF...
This generally gives good results.
I have only a suggestion, but maybe open office?
Given that the iPhone resolution is 320 x 360px with a resolution of 163ppi we need to optimise print settings before exporting our document to PDF. I’m tipping most people will view their document with the iphone orientated in landscape mode so we’ll base our document width on 360px.
So here’s the settings you need to use when exporting or printing your document to PDF:
Width: 125mm x 225mm.
That’s it. Now just print your document to PDF using a PDF printer driver like doPDF and email the document to your iPhone.
Have a look at latex. You can typeset the document to any size that you want. http://www.latex-project.org/