This question already has answers here:
Insert a PDF file into Core Data?
(2 answers)
Closed 9 years ago.
I am currently building an iOS app that will be manipulating PDF documents. You will be able to type in information about yourself and the app will populate certain text fields on a document with the correct information and create a PDF that you will be able to save, share, etc.
I'm rather new to iOS programming. What are some things I should know?
Can I use Core Data with PDF's?
Can I populate a stock PDF with the info or do I have to use some other format and create a PDF from the final product.
You could use Core Data to store your information, but that would be separate to any PDF consideration that your app had. It may be best for your app to store the information and provide a view which shows the PDF layout, but not actually as PDF, and then allow the view to be exported as a PDF.
This answer shows how to save the view as a PDF.
Related
This question already has answers here:
File Upload in Elm
(4 answers)
Closed 6 years ago.
I am trying to make a form in elm that would be able to upload a picture and some accompanying data.
Right now all my fields are updating my model via the onInput function, and I when I press the submit button I send my data as JSON via the Http.post function. If I understand well this is the idiomatic way of doing forms in elm.
Is there a way to add file uploading capabilities to this kind of form? If possible I would like to keep control in the elm app without resorting to the standard html elements to do submitting.
Here you are. Some of my notes:
http://simonh1000.github.io/2016/12/elm-s3-uploads/
https://github.com/simonh1000/file-reader
https://github.com/danyx23/elm-dropzone
https://developer.mozilla.org/en-US/docs/Web/API/HTML_Drag_and_Drop_API/File_drag_and_drop
File Upload in Elm
elm: read file content
https://www.paramander.com/blog/using-ports-to-deal-with-files-in-elm-0-17
Add support for https://github.com/elm-lang/html/issues/20
https://github.com/lovasoa/elm-fileinput
https://www.reddit.com/r/elm/comments/4926am/uploading_files_through_elmhttp/
http://elm-ui.info/documentation/guides/handling-files
How to trigger click event in elm
Yes, native code is needed for two things:
to access the FileReader API; and
to 'trick' the HTTP library into allowing you to add a file to a multipart form.
This is all covered in this blog post, which accompanies the FileReader library mentioned by rofol.
Instead of native code, you can of course use ports.
In my iPhone / iPad application, I show a person's medical reports in the form of a PDF. I have saved the reports in the documents directory and am reading them from there.
I want the user to be able to add or edit comments on these PDFs, as well as be able to highlight certain sections in the PDF. After editing, the application should be able to save the PDF back into the documents directory.
Is this possible within an iOS application? If so, how? Is this a task for Core Graphics?
Editing PDF directly on iPad/iPhone is a rather big job because the standard API only supports showing it (and only a bit more.) If you want to do anything more, you need to invest a huge amount of time to implement generic pdf handling code.
There is an open-source library handling these, e.g. this one. I don't know if it fits your needs, though.
A better idea, in my opinion, is to create a native UI showing the data contained in the PDF file using the standard Cocoa-Touch UIKit and create the PDF once the user is done with it so that the user can export it back. That way, you don't have to write a complicated PDF handling code.
In any case, it's not a good idea to show generic PDF on iPhone, because the screen size is so small (iPad is a different question, especially if you expect the user to be familiar with the particular format of your pdf.). A dedicated UI would be much better.
I want to output a PDF using UIKit's PDF creation methods. I see plenty of information on the web about creating a graphic context in a PDF, but I want to create smart text tables whose cells the user can later copy and paste into other applications (Word, Excel, etc.). How do I do this?
Unfortunately, that's not trivial. I recommend you the libharu PDF library for iPhone as a good point to start from.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I have learned Apple has release CGPDF APIs in SDK 3.2 for drawing PDF context.
What I understand from these APIs is that you can draw a PDF to a data object or a PDF file. You can then export it, may be, to your sandbox's directory OR add as an attachment in the mail.
But I am not sure if we can use these APIs to read a PDF from application bundle and show it to the user page-by-page on the screen. What I want to do is open a PDF of a magazine in a magazine reader app.
I was also wondering if we can identify the links in a PDF file and open them in the app.
Let me know if have done OR doing anything like this.
Thanks
AJ
In API documentation there is a way to load a PDF (with Quartz):
CGPDFDocument is the object you need
and CGPDFDocumentCreateWithURL is probably the constructor you are looking for.
Here are some examples on how to do it:
http://developer.apple.com/mac/library/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_pdf/dq_pdf.html#//apple_ref/doc/uid/TP30001066-CH214-TPXREF109
I have spent a lot of time on this - and it seems you need to use CATiledLayers to zoom those PDFs properly!
There are some good examples on the net on how to do that...
I will put a link/solution here as soon as I have something ready!
Displaying the PDF with the Quartz APIs is pretty easy. But there's no native support for link annotations. Basically, you need to parse the "Annots" dictionary inside the pdf, and then find the correct page (which can be GoTo references, or named references, or ~10 other types; see the Adobe PDF Reference 1.7 document, the section about Actions), and the calculate the coordinates to the displayed page.
I've written a [commercial] library that includes parsing link annotations, and many more features. You may wanna check out http://pspdfkit.com
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How can I extract images from a PDF file?
I am able to extract the images from a PDF file using many Perl modules, but none of them specifies the exact positions of the images being extracted (where the image actually belongs).
Could anyone suggest to me how to extract the images along with their positions?
Thanks in advance.
An indirect solution is to use pdfimages to scan the pdf file page by page. If there is an image, at least you will know which page it is in.
For example, you can use pdfinfo to find out the number of pages there are in a given pdf file, and use pdfimages with the -f and -l options to scan a particular page.