How to implement a PdfPageEventHelper that rotates some pages, but not others - itext

My app generates a PDF report which sometimes contains tables that have been rotated (actually the tables are transposed, and the text is rotated). For pages that contain these tables, I want the page to be rotated to landscape so the user doesn't have to rotate it in their browser or cock their head sideways. It seems the best way to do this would be to follow the example that is shown here: iText - Rotate page content while creating PDF
However, in order to do this, I would need to check whether or not the current page contains a table that has been rotated. How can I do this? Is it possible to do this in the 2.x version as well?

Related

How to Display Two Scrolling TextViews At Once

I'd like to display two windows on screen with scrolling text in them e.g. top window will have one bible translation while the bottom view would have another.
Ideally, I'd like them to stay in sync so they're both showing the same point in their respective translations (i.e. switch to John Ch1 in top view, bottom view follows and does same). But for now I'm just curious how to get these into two seperate viewable windows.
Any ideas?
In all honesty, I dont think you have the screen space to do this for the iPhone in such a way that is visually comfortable for the user.
That aside, the best method would depend on how the rest of your app is built. You can create a view that contains two UITextViews in it, each taking up roughly half the screen. You should be able to scroll one as a response to the other scrolling, though I haven't done this, so I cannot tell you how to do it exactly.
Another option that you have is to use a main UITextView, and then a second UIModalView that is overlaid above it. It all depends on the app structure.
Just to note, unless you have specific markers for points of translation, it would be very hard to have them sync up in that way. You could try to match line numbers, or something like that, but due to languages being so different, one might take 3 lines, and a translation might take 4 to say the same thing.
This is a fairly basic question, so you should perhaps revisit the iOS Application Programming Guide, but in a nutshell, you'd have two UITextView elements inside a view in your application, and you can synchronize between them using the built in setter method
- (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated
You have two needs here:
(1) You need to create a data model that can hold the translations and link each chapter and verse in each translation to the chapter and verse in all the other translations. For that, I would suggest learning Core Data. Be prepared to spend some time learning it.
(2) You need to display the translations. For this I would suggest you use two UITextViews in the same containing view. However, as Karoly S noted, there really isn't room on an iphone screen for two text views. I would recommend using two views connect by a flip transition which will allow you to have one translation on a full screen and then flip over to the other translation. The user could flip rapidly back and forth to compare.

What is an appropriate PDF page size (dpi) for iPad?

In case of drawing PDF with Quartz and supporting enlarging it (using tilted layer),
What is an appropriate PDF page size (dpi) for iPad?
Currently, I'm drawing 3 viewes (previous, current, next) on a scrollview for a PDF file.
When the scrollview is scrolled and the current page is changed, the old previous or next view is removed and a new or previous view is created and added.
7,8,9 - (go to the next page) -> 8,9,10
In the above situation, 100dpi PDF is ok. But PDFs over 150dpi encounter crash (memory problem).
In case of 150dpi, first 3 pages (previous, current, next) are successfully created and drawn but the app encounters crash after turning over pages three or four times.
Please let me know the size (dpi) if you made iPad apps viewing PDFs.
As you've probably found out, it depends on the content. After some trial and error, I settled on around 100dpi. That was for some quite visual content - mainly text content with some imagery could probably go a lot higher.
If you're having memory issues at 150dpi and 100 works fine, I'd stick at 100.

Best way to display web content on my iPhone app (if possible without using UIWebView)

I want to build an iPhone app that should , among other things, display the some content of a website's detail pages. This content includes a)a title b) an image c) a text passage (with multiple paragraphs.
I have done a brief research and found out that the easiest way to do this is by using uiwebview. The problem is that in that scenario I would have to be constantly in touch with the person responsible for the website in order to create a modified html/css version for the iPhone client.
As a result I was wondering if there is a feasible alternative. I can get the data I want in json format with HTML Requests. Maybe if I used a UIScrollView that contains a UILabel for the title, a UIImage for the image and another UILabel for the text passage? But the problem is how to set the UIscrollview content size since it dependent on the size of the text passage?
I am a iPhone dev noob and I am possibly missing something obvious here so I would be very greatful if someone could point me in the right direction.
Sounds like you are building an app ontop of somebody elses content. Provided this is legal, this other site should have a published api where you can start to write your app. Get the json or xml, then populate them in a UIViewController using a UIImageView to display the image, UITextView for the text. The UITextView already has a built in scroller so you dont need a UIScrollView

How to show a PDF page by page using horizontal swipe in iphone?

I want to create a page by page PDF reader.
I know how UIWebView can be used to show the PDF but It will load the entire PDF and want to show one page at a time.
The PDF is stored locally.
Next and previous PDF Pages should be loaded depending on the horizontal swipe.
How to show a single page along with horizontal Swipe and Zooming functionalities ?
What is the best approach for such problem?
Is there any tutorial for this?
EDIT :
I have used CGPDF APIs to show the PDF page by page.
I am using the PDF page as image.
But zooming is not working properly as UIPageControl is also used.
How to zoom these images along with page control ?
You can use Leaves View, you can find tutorial from
https://github.com/brow/leaves
second option is FastPDFKit, you can get it from
http://mobfarm.eu/
According to me leaves is more preferable because memory management is good and it is more user friendly.
EDIT:
You can consider two more options which provide some good features for PDF.
Reader on Github
PSPDFKit
Note: PSPDFKit is not free.
EDIT:
Since iOS 5, you can add an effect of swiping the page like iBooks. To do it that way you can use UIPageViewController. To get some basic idea, just create an app with page-based application from your Xcode template or you can refer to this link.
you add as a subLayer the tiledLayer that draws the PDF page (CGContextDrawPDFPage) to a UIView and then you add that as a subview to a UIScrolView. That way you have a PDF page that you can zoom by pinching it and you can scroll.
Lets say you create a class PDFViewController:
[myContentView.layer addSublayer:tiledLayer];
...
[scrollView addSubview:myContentView];
...
[self.view addSubview:scrollView];
and then you should create MagazineViewController class where you have a large horizontal UIScrollView where you create the views from the PDFViewController that contain the pages, That way you have a view that you can swipe horizontally and see the pages of a magazine or a book.

Better way to have a photo slider/thumbnails on iPhone?

I have a probaly large list of images and want something like the photo app but with custom toolbar.
I wonder how do this. I see the sample of Apple http://developer.apple.com/iphone/library/samplecode/Scrolling/index.html but that not will work for a large set of images.
I have a product list and some of my customer need download as much as 12,000 products in the device (I have a solution for the PocketPC I'm porting to iPhone).
In this thread How make a view of thumbnails in landscape mode? somebody suggest is possible use a TableView, but then I'm not sure... mainly how hide the section caption then could be...
UPDATED correct the link
The "Scrolling" demo won't work as-is for a large image set, but some minor adjustments can easily fix that. The trick is to use UIScrollView delegate methods to load images on demand and then unload them after they disappear. For decent performance you'd want the central image and one or two on either side to be loaded-- meaning that you can extend that design to support as many images as you like but still never have more than 3-5 in memory at a time.
The Stackoverflow link you post doesn't actually mention table views, so I'm not sure what approach you have in mind there. If by "section caption" you're referring to section header and/or footer text, then just don't provide any. Table views don't have a default for this, so if you don't give one to a table view then it won't show one.