0

This is how I create PDFDocument:

let document = PDFDocument()

for image in images {
    let page = PDFPage(image: image.scaledWithMaxWidthOrHeightValue(value: 425)!)!
    document.insert(page, at: document.pageCount)
}

And here is an extension for UIImage:

extension UIImage {

    func scaledWithMaxWidthOrHeightValue(value: CGFloat) -> UIImage? {
        
        let width = self.size.width
        let height = self.size.height
        
        if width <= value && height <= value {
            return self
        }
        
        let ratio = width/height
        
        var newWidth = value
        var newHeight = value
        
        if ratio > 1 {
            newWidth = min(width, value)
            newHeight = height * (newWidth/width)
        } else {
            newHeight = min(height, value)
            newWidth = width * (newHeight/height)
        }
        let renderer = UIGraphicsImageRenderer(size: CGSize(width: newWidth, height: newHeight))
        let image = renderer.image { _ in
            draw(in: CGRect(x: 0, y: 0, width: newWidth, height: newHeight))
        }
        return image
    }
}

and the result look like this (this is screenshot made by one of the users, iPadOS 16.6):

enter image description here

but definitely should be like (the same feature on my own device, also 16.6):

enter image description here

I have no idea what cause that. On my devices it doesn't exist. As user said it also happens on his iPhone 12 Pro Max with latest iOS 16.6. It is not related to system (I think) and device. So what setting in the system might be related to that issue? I have tried some Accessibility Settings to reproduce the issue, but without success. Any other ideas?

Clarification edit

This question is about to where to search the issue to reproduce the problem. So it is obvious there is no code to reproduce the issue because me (the one who asked the question) is not able to reproduce the issue.

halfer
  • 19,824
  • 17
  • 99
  • 186
Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358
  • I've removed the commentary about voting - it doesn't belong in the question. But any clarifications are welcome. The question of whether (more) code is needed is whether readers here could replicate the issue with the information that has already been provided. (The close dialogue indicates that one person has already voted to close as needing a [mcve] - so if you can provide more information to keep them happy, that may be worthwhile, even if you don't personally agree). – halfer Aug 07 '23 at 14:43
  • What is the source of the images being added to the PDF? Also note that the font on the customer's images is quite different that from your device. Maybe that gives you a clue. – HangarRash Aug 10 '23 at 16:36
  • @HangarRash source of the images? They are created in the app. If you share one single image as an image (not via pages in pdf) then it looks ok. About the font... if you mean fe "Tarjeta del mapa del Territorio" it is an image not a text itself. And other labels like `g` and `y` on my own example are placed as a labels indeed... and font is set in code. So it should not be the case... – Bartłomiej Semańczyk Aug 10 '23 at 20:53
  • for me it looks like the image is not faded by itself but gets an overlay in form of a white layer with some transparency. – David Aug 17 '23 at 15:59
  • 1
    @David No, definitely not;) Look at the title...;) Do you really think I wouldnt recognize cover layer?;) – Bartłomiej Semańczyk Aug 18 '23 at 05:34
  • ok, good luck finding the real issue! – David Aug 18 '23 at 14:47

0 Answers0