Edit my signature in PDF file in my iPad application - iphone

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.

Related

Swift saves bmp as “Flip row order”

I'm using Swift in iOS and used the code based on this SO post to save a UIImage as a bmp
Convert UIImage to NSData and convert back to UIImage in Swift?
The data I create and save is recognized as a bmp in Photoshop and Preview but can’t be read by the Adafruit PyPortal. The only diff I can find is that when I resave the bmp in Photoshop as a bmp again, it shows as “Flip row order” selected in the BMP options screen that appears right after the main save screen.
If I uncheck this option and save the file, the PyPortal can then read this resaved file. This post above was great for getting the UIImage into .bmp format, but I need to get this additional file change done programmatically on iOS, so opening in a third-party product, or working with shell commands won't work as a solution. I’ve not been able to find anything in Apple’s docs that looks like it corresponds to Flip row order and there isn’t much online about this option within Photoshop so it’s unclear even what this does.
For the curious I have samples of the bmp my app creates as well as options resaved or run through an online converter (both these options work on PyPortal).
https://drive.google.com/drive/folders/1DQYes-cJXKm3ue8Z9cACDLEN5bxnnkJc
Any suggestions are appreciated. Thx!
The “Flip row order” option tells the bmp reader software to read the first row of pixels first and the last row of pixels last. This is not the “normal” way most bmp reader interpret a bmp format image. Most implementations read from the last row first and then work its way up to the first row of pixels.
Your options are either, rewrite the bitmap creating software so that it matches the abilities of the bmp reader software or change the bmp reader software so it can read the bmp file.
I’m fully aware this doesn’t solve the issue but can help understanding what it going wrong and guide you in the right direction.

AlamofireImage: Is it possible to get the raw data from an NSimageview in Swift?

I am using an imagewell to accept jpg images being pasted or dragged into my OSX app. The problme is that I am struggling to get the original jpg images as OSX seems to requires me to get the Tiff version of the NSImage if I want to uplod via Alamo Fire.
Does AlamoFireImage have a fancy way of getting the original url / original raw data without converting to Tiff first?
Actually, with an NSImageWell, you don't have much possibilities regarding the dropped image. It's a convenient class for showing dropped images but as soon as you need to do more, it's not up to the task.
I suggest you use an NSImageView instead, and add drag and drop capabilities to it like in my example here: https://stackoverflow.com/a/29233824/2227743
This way you can easily get the dropped image's URL (and filename), and the image data itself of course.

Gridview for XML with Pictures in iOS

I am building an iPhone app that I would like to be able to have a gallery of images that is loaded from an XML file. The xml simply has the name of the image, and the link for each image as the exact URL where the image is loaded. I have looked at a few different examples like, https://github.com/AlanQuatermain/AQGridView but have a lot of problems customizing it for my use. The link I gave seems way too in depth for the simple thing I want of parsing an XML (which my code does) and to create a 'thumnbail' for each article, filling in that thumbnail with the image provided in the 'link' category of the XML. Could someone help me out a little bit? I am using ASIHTTPREQUEST and GDATAXML libraries to parse my XML as shown in Ray Wenderlich's tutorial on parsing.
EDIT: Looking over stuff, I guess I can create a Custom Cell and only have a UIImageView in the custom cell, but how would I write up the code so I can have about 4 columns of pictures across the cell, and have it load a different picture with each?
If you want a simple solution check out https://github.com/kirbyt/KTPhotoBrowser
It works by using a datasource which you define. these can be images or just URLS. it then goes and fetches the URL and displays the image. It also makes it easier to select a single image compared to your way of using a simple UITableView.
Have a look at the samples included it should fit your purpose.

How to use the Photoshop PSD design file in your xCode?

I'm going to creat an iOS app from UI design to implementation, I want to make my app looks better, so i googled a lot and find people saying to create a PSD file with your app views first, so here comes to my question:
1) If i had that PSD file, how do i use it in my app?
2) Is there a general way to use that PSD file for all the elements I created?
Thank you very much.
The PSD File contains your photoshop readable source material and cannot be used in your iOS application. You have to export / save your PDF files save a PNG or jpeg to use it.
You can export the PSD elements to XCode using a photoshop script. this is easy and simple. All you need to do is follow the steps and it will import the files to your .storyboard file.
PSD to Xcode Script by TampestVision
You will need to do some slicing, i.e. divide the interface described in the PSD into smaller PNG images.
You will probably need
The designer who made the PSD.
Adobe Photoshop.
These are the broad steps that you need to take.
The designer needs to tell you what each element of his design is supposed to do.
As a developer you will need to decide how each element is going into your app (Button, Label, image, table)
Pick out the components you need for each element (outline, fill, shadow, etc)
Choose the corresponding layers,in the PSD, to those components.
save those layers for web(Choose PNG-24, keep transparency)

how to get the image position from pdf file in objective c?

I am doing something like extracting the pdf text in a string format so as to annotate the text and in the same process i need to find the image positions covered in the same pdf file so as to maintain its position. Now the problem is that i am not getting the exact positions of the images in the same pdf file. Is it possible to use some thing like OCR,if yes,how to use that?
Can anybody help me in finding the exact position of the image in the pdf file? I need to implement some pdf reader kind of application for ipad,that's just for the knowledge.
Thank you.
Isn't OCR a little bit heavy weight for iphone?
Take look on tools like pdftotext from Xpdf. It is much simpler to read data, as to render and recognize it back again.