FPDF Print Orientation - fpdf

I will create an PDF envelope/label file (size 220 x 110 mm) with FPDF.
I know how to orientate from portrait to landscape.
$pdf = new FPDF('L','mm',array(110,220));
$pdf->AddPage('L');
On my screen I will see an envelope in landscape, but when I print the PDF it is supposed to print it in portrait because the envelopes are fed in portrait.
Can anyone tell me how to do that?
It is also ok if I can orient the fonts only. So that the screen shows portrait. I know it is not a beautiful solution but if it works then it is ok.

If you want to print in horizontal, add the line
$pdf=new FPDF();
$pdf->AddPage('O');
If you want to print in vertical, add the line
$pdf=new FPDF();
$pdf->AddPage();

Related

Ghostscript is not printing according the page orientaion

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.

the same image is sometimes rotated 180 degrees sometimes

I am using filepicker.io to upload an image from iOS device to Filepicker.
In my code, I am using image tag ">. When I view the image:
1) on a desktop browser (Chrome) it's upside down (rotated 180 degrees)
2) I view the same HTML page from my mobile device (iOS) and it's the right way up.
3) If I just view the filepicker.io link (I not via imag tag) in a browser it's the right way up.
Any ideas?
Indeed some browsers ignore the EXIF orientation info. This mostly affects IOS devices. I've worked around this by transforming images right after they are uploaded:
filepicker.convert(InkBlob,
{width: 800, format: 'jpg', quality: 85, rotate: "exif"}...
OK, it's the "orientation" and I guess some browsers seem to auto-apply/fix this. The short of it is, I need to find out what the orientation is and then apply/rotate the image accordingly.
I have managed to do this manually with JavaScript loadImage.
I am trying to work out how to do it dynamically in this thread Can't get EXIF info using loadImage.parseMetaData I have an idea of what to do, it's just not working... but I'll leave that to be sorted out in that thread.

How to make pdf to fit to screen size in vfr reader

i am using this vfr reader to show pdf pages.i need to make the pdf page to fit to the entire screen. how can i do this. I tried everything but couldn’t get it. Can someone please lead me to in right direction.
Thanks in advance.
I found a way: Set the statusbar to hidden in viewWillAppear of ReaderViewController, then set READER_SHOW_SHADOWS to FALSE and CONTENT_INSET to 0 in ReaderContentView. Also, make sure your PDF's aspect ratio is 4:3.
In initWithURL:page:password method of ReaderContentPage.m, you need to set viewRect.size to full screen size.

How can I change the position of an object through the ccp function in cocos2d?

I am new to the cocos2d framework, so I took the sample application from this location and tried to modify it. By using the line
target.position = ccp(winSize.width , (target.contentSize.width/2)+actualY);
the object is shown in landscape. When the app runs it will show me the output in landscape mode, and the targets are shown from the starting the landscape mode of one side to another side. I want to show it from the the end of the landscape mode to the start. How can I do this?
Also, I want to show in portrait mode. How can I do this as well?
ok use ccp function. the body will be like this. ccp(x, y)
OK, cpp function means the same as CGPointMake(x,y) - only creates a point for position of target.
winSize.width - will be xcoordinate of target, and
(target.contentSize.width/2)+actualY - ycoordinate
What version of cocos2d u using? You can change orientation of app in the app delegate.. From landscape to portrait..
ok I solve that problem, I simply change the position of x and y through ccp function

UIWebView With PDF

I'm displaying a PDF file using UIWebView, and I want to do 2 things:
I want to make the page fit the phone screen without the user has to double tap to do that
I want to remove the margin with gray shadow around the displayed PDF
Thanks for helping
I don't think this will help much, but I think your best option is to render the PDF to an image (of decent DPI) and show the image instead. I do this for an app, but we do that server side using ImageMagick - don't know how you might do that in obj-c. Also note that a mostly-text PDF will be much larger (filesize) when rasterized.
However, you might also try to embed the PDF in HTML page and load that HTML in the WebView - that may at least avoid the gray border/artboard.
webView.transform = CGAffineTransformScale( webView.transform, 1.25, 1.25 );
2 - Checking the Scale Pages to Fit box in IB sorted this for me
I would also like to know the answer to 1.
I guess you want to know how to display the PDF in the same way as when opening as attachment in mail, where the navigation bar only appears on a tap and the status bar also disappears?
You can also use Quartz to do it, as explained here : http://developer.apple.com/iphone/library/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_pdf/dq_pdf.html
Where has CGAFFineTransformScale been all my life?
Seriously, that is a big help. However, it worked better applying it to webView.scrollView.
Finally, is there a similar command to change the offset of the content as well as the scale?