Editing a PDF with MuPDF - mupdf

I am using mupdf to render PDFs in my c++ application but I also need to edit PDFs (inserting a picture for example) but I cannot for the life of my figure out how - it's not documented very well. Ghostscript says that there is an API in mupdf to modify PDFs here http://www.ghostscript.com/MuPDF.html.
Ultimately I am hoping to be able to edit PDFs using MuPDF rather than using another library.
Any help would be appreciated, thanks!

The modification API in MuPDF is for editing the structure of a PDF (such as reordering pages, adding or removing annotations, etc) at a fairly low level. The graphics in PDF are based on a "content stream" object containing the commands for drawing a page using a subset of PostScript. There are no functions for editing these graphics content streams in MuPDF.
However, if all you want to do is add an image on top of the page, you can do so by creating an annotation object for the page. You'll need to create the PDF dictionary objects for the annotation, an image object, an appearance stream to draw the image object, and hook them up to the page. You'll need a good understanding of the PDF format to do this though.
You'll want to use the latest git checkout of MuPDF since we've recently (post 1.0 release) added some convenient functions for editing objects and updating streams with new content.

Related

Office-js API to use to change page size, Margin and Orientation

We develop Office.js addins for Word. In this process we have a need to be able to manipulate the following properties of my Word online document programmatically(which i can change through UI now)
Margins
Orientation (portrait)
Custom Page size
How can i find the APIs needed to achieve this?
These parts of the COM object model haven't (yet) been implemented in the Office JS APIs.
It would be possible to change these aspects of the Page Layout on the closed file, leveraging the Word Open XML file format. (These properties can't be changed by manipulating the opened files XML.)

How to Get/Set Fast Web View in PDF file using iTextSharp with C#

Here I am using iTextSharp to open PDF document and changing some properties such as page layout as guidance from this link How to set initial view properties?
Problem:
Input PDF Fast Web View : True but out put PDF Fast Web View : False, but I want Fast Web View must True when input PDF Fast Web View is True.
So
I want to Get/read exist Fast Web View value
In I want to Set/Update new(my) Fast Web View value
In PDF document.
Input PDF Properties:
output PDF Properties:
What you are looking for is linearization. See this post directly from iText which basically says iText has no native support for this and they currently don't have any future plans for it. From that page:
Linearization doesn't make any sense for dynamically created files or for files that need to be served to a mobile device. It would be "Slow Web View".
...
Up until now, we've had several users asking for linearized PDFs, but
once they fully understood that linearization would slow down the
download process rather than make it faster, they decided against it.
That's why we never put Linearization on our roadmap. Of course: if
somebody wants to sponsor the development: you're always welcome to do
so.

How can I edit PDF files in an iOS application?

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.

How can I output tables to a PDF file with the iPhone SDK?

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.

Is it possible to write or change EXIF data of images saved to iPhone photo library

I would like to add some custom data to an image the user generates in my app, no more than 1kb tops. I could probably hide the data in the image, but I want to do this in a way that will resist resizing but not deliberate deletion of EXIF tags (say, for privacy reasons).
Is this possible using the current public SDK 3.0?
this might be helpful, though i've never used it before - iphone-exif
This could be very useful: PhotoshopFramework is one powerful library to manipulate images on Objective-C. This was developed to bring the same functionalities that Adobe Photoshop users are familiar. Examples: Set colors using RGB 0-255, apply blend filers, transformations...
Is open source, here is the project link: https://sourceforge.net/projects/photoshopframew/