Questions on iTextsharp - itext

How do I use iTextsharp library to modify objects in the PDF object stream.
Specifically, I wish to make use of the PDF manipulation features to insert/modify some form of watermark into the object stream that is not visible as displayed content.

Related

Create pdf in proper format

I want to create PDF with proper format like proper text and image would be on proper format like normal PDF file.
I know how to create PDF with image and text but I don't know how to format it & I also know that PDF can be converted from HTML by displaying it's content on webview and capturing its screen in image and converting it into PDF.
But is there any another way or any tag available like HTML.
Or is there any third party tool available for this issue.
You can create a PDF drawing contect with CGPDFContextCreate and then draw with standard Cord Graphics 2D functions as you would draw on the screen. See also this question: iOS SDK - Programmatically generate a PDF file

How would I convert a PNG Image into a byte array?

Using GWT I would like to read a PNG image and have the data accessible to me as a decoded byte array.
On the client side I get the image using an ImageBundle, I then instantiate an Image and call setUrl.
At this point, how do I get the image byte array from the image?
You can't. Javascript (and hence GWT) do not have access to images' data when images are presented as html images (i.e. as <img> tag or css background image).
What you could do is load image data via RPC, process it, Base64 encode it and then create image via embedded url: "data:image/png;base64,..yourBase64Datahere.."
If you are trying to do some visual manipulation you should consider:
Manipulating image on the server.
Using html canvas or svg.

Store images in a plist

I obtain seven thumbnail images from my one PDF melodramatically, and these seven images are stored in one array as objects. Now i want to show the images in the array in a UIWebView, but it is not possible because the web view needs a path to a resource or a plist path. So I want to store these images in a plist; how can I do this?
In my array, only the image objects are available, not the names, and all seven images are not static images.
I am new in iPhone programming, so please tell me how I can do this?
Your question does not make much sense to me (melodramatically?). Contrary to what you believe, UIWebView cannot deal with a property list. What would it be supposed to do with it? A web view can display data from a URL request, a string of HTML or a bunch of data in a specified format.
In your case, the latter would apply: convert one of your images into an NSData object (with UIImagePNGRepresentation()) and pass it to the web view with -loadData:MIMEType:textEncodingName:baseURL:.
If you want to display all images at once, you would have to save the images to disk and generate appropriate HTML code.

how to watermark a rendered PDF (on context) without repeating the image

I'm rendering a PDF file on my iPad using a graphics PDF context. The PDFs vary in size but may be up to 90 pages. I need a background image on each page but if I simply draw it the PDF file size will be way larger. Is there a way to kinda only add it once and 'share' it somehow across pages?
Thanks
The PDF format specification enables you to re-use objects "by reference". You can re-use any object multiple times that is defined only once. Usually that happens with fonts, logos, background images, watermarks, ICC profiles, ....
I did a test where I repeated a background image behind each PDF page. Surprisingly, the file size increased by a single and constant amount, regardless of the number of pages with repeated backgrounds.
The verdict: The drawing to PDF context libraries are smarter than you might think.

Edit my signature in PDF file in my iPad application

In my iPad application I want to add signature in my pdf file.
I already do perform following steps:
Open pdf in UIView (zooming is not implemented yet).
Add one transparent subview (UIImageView) and draw signature on that.
Save all screen using UIGraphicsGetImageFromCurrentImageContext() as a image.
Convert and save the image as a pdf.
This is works fine but pdf quality is very poor.
But now I want to add a signature/image as a pdf metadata. Same as a markup and commenting features of PDF.
Is there any help or sample code is available for the same?
It should be possible to improve the quality of the output by skipping the image/pdf conversion, but afaik there's no lib that will help you editing the metadata of a pdf on the iPad (at least, none that's freely available).
Depending on what exactly you want to do, you may have to write a parser from scratch to know what exactly you have to append to your document to see the wanted effect:
It is very easy to append data to a pdf, but it has to be "registered" in the right locations so that a reader can use this information.