gpt4 book ai didi

ios - 顶部/底部、左/右边缘有白线的 PDF 渲染

转载 作者:可可西里 更新时间:2023-11-01 05:41:38 25 4
gpt4 key购买 nike

我正在使用(优秀的)vfr-reader在几个 iOS 应用程序中。它非常有用,但我在渲染某些 PDF 文件时遇到问题。

在 VFR-Reader 中,我在顶部和底部和/或左右边缘看到白线,这对于整页照片来说非常烦人。

它们出现在呈现的页面和 ThumbsViewController 中的页面缩略图中:

enter image description here Page Thumbnails with White Lines on Left and Right Edge

放大时白线变得(有点)大:

(底部边缘,虽然在白色页面背景下很难看清)

zoomed in

我可以通过修改来改变它们的颜色

CGContextSetRGBFillColor(context, 1.0f, 1.0f, 1.0f, 1.0f); // White

在 ReaderContentPage.m/drawLayer 中。

我天真地尝试将 RGBFillColor 设置为黑色,但随后 PDF 中的所有文本页面(通常在白色背景上)也会显示为全黑。

我假设问题出在某些宽高比/PDF 页面尺寸上,由于某种原因,它没有完全填满绘图区域,因此白色背景颜色“渗出”。

PDF 本身看起来不错,它们在 Safari 和 GoodReader 中呈现完美(没有白线)。

如果有任何提示可以解决这个问题,或者我应该调查的总体方向,我将不胜感激。

最佳答案

VFR的作者通过邮件回复了我:

"I suspect that it is caused by the PDF page size not exactly matching the size of the CATiledLayer-backed UView that shows the page. When the PDF page is rendered by iOS, it does an aspect fit, thus leaving white borders. In ReaderContentPage.m, in the -drawLayer:inContext: method, try changing true to false in this function call: CGPDFPageGetDrawingTransform(_PDFPageRef, kCGPDFCropBox, self.bounds, 0, true)"

这确实解决了问题!

(为了修复缩略图,我修改了 ReaderThumbRender.m 中的同一行)

关于ios - 顶部/底部、左/右边缘有白线的 PDF 渲染,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15752303/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com