You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I did found a way to perform "select all" on the cropView, but it's working only with images from the library or ones that taken from the camera, but not from image that created from PDF for example.
From some reason, when I'm running this on an image that created from PDF file, it's returns a very small size, I could say it looks like the thumbnail that you can see in the UIDocumentPickerViewController, but when I'm setting the image as the image of the imageView I can see it all over the screen and very sharp, it doesn't looks like the imageView resized it or something.
So in the bottom line - I wanted to ask if there is some built-in way in the library to perform "select all" or if you have any better idea that will work also with PDF converted to image it will be great.
BTW, the code that I'm using to convert the PDF to UIImage is:
func drawPDFfrom(url: URL) -> UIImage? {
guard let document = CGPDFDocument(url as CFURL) else { return nil }
guard let page = document.page(at: 1) else { return nil }
let pageRect = page.getBoxRect(.mediaBox)
let renderer = UIGraphicsImageRenderer(size: pageRect.size)
let img = renderer.image { ctx in
UIColor.white.set()
ctx.fill(pageRect)
ctx.cgContext.translateBy(x: 0.0, y: pageRect.size.height)
ctx.cgContext.scaleBy(x: 1.0, y: -1.0)
ctx.cgContext.drawPDFPage(page)
}
return img
}
Thanks,
Ido.
The text was updated successfully, but these errors were encountered:
Looks like all of the images that created from PDF files are 3 times smaller than the cropView, so all I had to do is to multiply the points of the cropView's corners by 3.
I solved this with this code:
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
guard var corners = self.cropView.cornerLocations else { return }
for i in 0 ..< corners.count {
corners[i].x *= 3
corners[i].y *= 3
}
self.cropView.setCorners(newCorners: corners)
}
Yet, it still was nice to have some built-in function for "Select All", sure many of users would like to select all of the screen when they are taking documents from the documents library (e.g. as PDF).
Hi,
I did found a way to perform "select all" on the
cropView
, but it's working only with images from the library or ones that taken from the camera, but not from image that created from PDF for example.This is my solution:
From some reason, when I'm running this on an image that created from PDF file, it's returns a very small size, I could say it looks like the thumbnail that you can see in the
UIDocumentPickerViewController
, but when I'm setting the image as the image of theimageView
I can see it all over the screen and very sharp, it doesn't looks like theimageView
resized it or something.So in the bottom line - I wanted to ask if there is some built-in way in the library to perform "select all" or if you have any better idea that will work also with PDF converted to image it will be great.
BTW, the code that I'm using to convert the PDF to UIImage is:
Thanks,
Ido.
The text was updated successfully, but these errors were encountered: