UIWebView can not show .docx diagram properly? - ios

I had a problem to display .docx file in UIWebView. It is not showing digram properly. It looks stretched and mixed with other text file.
I am using below code to display .docx file.
NSURL *url = [NSURL fileURLWithPath:#"File Name"];
[self.webView loadRequest:[NSURLRequest requestWithURL:url]];

Opening a web view may cause Word files to look distorted. Its similar to when certain word files look distorted when opened in Pages application.
The web view may not be able to exactly render the doc file the way it was created and you cannot do anything about it.
You may want to look at the QuickLook Framework for iOS:
https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/DocumentInteraction_TopicsForIOS/Articles/UsingtheQuickLookFramework.html
It supports the following formats:
iWork documents
Microsoft Office documents (Office ‘97 and newer)
Rich Text Format (RTF) documents
PDF files
Images
Text files whose uniform type identifier (UTI) conforms to the public.text type (see * Uniform Type Identifiers Reference)
Comma-separated value (csv) files
More specifically you may want to look at the QLPreviewController: https://developer.apple.com/library/ios/documentation/NetworkingInternet/Reference/QLPreviewController_Class/Reference/Reference.html#//apple_ref/occ/cl/QLPreviewController

Related

What is the header Content type suppose to do?

So i have this ASP.Net app and i want to allow the client to have the option to download an xlsx file, im using the HttpContext.Response to set the Content Type "application/xlsx" and the Content-Disposition sets the file name with the extension .xlsx, the download works correctly.
if I change the file name to .pdf then the file is downloaded as a pdf, when I checked the developer tool network response the Content Type was "application/xlsx" and in another test I change the name fileto .png and the file was downloaded as an image (it did not work, but it was shown as an image)
So what is the content type supposed to do, does it bring some sort of security how do i make sure that the user can only downloads the file associated to the content type?
Im using response.BinaryWrite()
A content type indicates what type of content is being transmitted over http regardless of the content name. For example as you already have tested, you can transmit a pdf file naming it as a .png file.
It is the browser or the operating system that is representing a file with the name .png as an image to you. Another software would treat a pdf file with .png name as a pdf file.
The name of the file matters after the download is complete. But the software that is handling the download (in this case a web browser) actually may need to know the original media type. And you might want to write client side codes that would need to know what type of file is being transferred from the server regardless of the file name.

Reading a hosted PDF file from a URL and converting to text in iOS using Objective-C

I am reading a PDF file stored locally (using nsbundle) and converting it to text.
But when I am trying to read the PDF from http i.e. URL scheme and give the path to my PDF to text converter it returns nil.
Any solutions would be appreciated.
My basic question is how to read a PDF file from a URL path?
on that way there are many restriction to convert PDF file to plain text.If you want to display PDF on app then use PDF Reader Core

iOS: preview excel and word files

I have an app that stores data and files in CoreData. Some files are photos, and I can display them, some are excel and word files. What is the best way to view them? Should I save em on filesystem and open with url? Does there is some controller in UIKit to display them?
Did you tried to use QLPreviewController before
Check out this url for details
QLPreviewController
It's responsible for opening PDF, .XCL, .word files.
Or for a quick viewer you can load the files in UIWebView

How to make a Photoshop (.psd) file have hyperlinks when saved as a .PDF file?

I created a template for a document i want to use, in photoshop.
I want to share this document as a PDF file.
I want some of the text i made in photoshop to work as hyperlinks and direct ppl to websites.
How do i save a photoshop file as a PDF and get hyperlinks to work in the PDF file?
I have tried using the slice tool. It works to assign a url and target.
But when saved as a PDF the links do not work.
Anyone?
I know that indesign allows for saving pdf documents in either print or web format. the latter allows for hyperlinks to be available. if photoshop does not offer this you can always add them in acrobat (not reader) and then resave the .pdf.

Streaming PDF SDK to iOS via HTTP

Are there any good SDKs available on iOS that will not only display a PDF, but will show it as it is downloading from a web source? It is perfectly fine to use a paid for library as long as it is commercial-friendly.
To clarify, the SDK must be able to show partial files as they are downloading, whether I provide the stream or otherwise. I would like to avoid CGPDFScannerRef due to how low level it is -- I have tried FastPdfKit as well but it will only show the whole PDF after it has been fully downloaded. Any ideas?
PDF is a structured format that consists of different types of data blocks such as TOC, text, fonts, colors, annotations and information about these blocks is saved at the end of the file. So this makes it impossible for CGPDFDocumentRef to open the pdf without all the data available.
However you can get around this limitation by linearizing the PDF file so that the metadata information will be put at the beginning of the file. I'm not sure but I think you can then use CGDataProviderCreateSequential in combination with CGPDFDocumentRef to parse a partially downloaded PDF file.

Resources