When added a PDFAnnotation to a pdf file which already have type stamp annotation type annotation showing in PDFKit but in QLPreviewController not coming
PDFKit
RSS for tagDisplay and manipulate PDF documents in your applications using PDFKit.
Posts under PDFKit tag
64 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
My app uses PDFKit, but I don't know how to solve this bug at all. Under the same IOS system and device model, some users' devices may experience crashes, while our own devices are functioning normally.
The following is the stack information for crashing:
0 libsystem_platform.dylib__os_unfair_lock_recursive_abort + 36
1 libsystem_platform.dylib__os_unfair_lock_lock_slow + 308
2 CoreGraphics_CGPDFPageCopyRootTaggedNode + 56
3 PDFKit-[PDFPageViewAccessibility accessibilityElements] + 76
4 UIAccessibility-[NSObject(AXPrivCategory) _accessibilityElements] + 56
5 UIAccessibility-[NSObjectAccessibility accessibilityElementCount] + 68
6 UIAccessibility-[NSObject(AXPrivCategory) _accessibilityHasOrderedChildren] + 44
7 UIAccessibility-[NSObject(AXPrivCategory) _accessibilityFrameForSorting] + 216
8 UIAccessibility-[NSObject _accessibilityCompareGeometry:] + 116
9 UIAccessibility-[NSObject(AXPrivCategory) accessibilityCompareGeometry:] + 52
10 CoreFoundation___CFSimpleMergeSort + 100
11 CoreFoundation___CFSimpleMergeSort + 248
12 CoreFoundation_CFSortIndexes + 260
13 CoreFoundation-[NSArray sortedArrayFromRange:options:usingComparator:] + 732
14 CoreFoundation-[NSMutableArray sortedArrayFromRange:options:usingComparator:] + 60
15 CoreFoundation-[NSArray sortedArrayUsingSelector:] + 168
16 UIAccessibility___57-[NSObject(AXPrivCategory) _accessibilityFindDescendant:]_block_invoke + 268
17 UIAccessibility___96-[NSObject(AXPrivCategory) _accessibilityEnumerateAXDescendants:passingTest:byYieldingElements:]_block_invoke + 140
18 UIAccessibility-[NSObject _accessibilityEnumerateAXDescendants:passingTest:byYieldingElements:] + 244
19 UIAccessibility-[NSObject _accessibilityFindFirstAXDescendantPassingTest:byYieldingElements:] + 272
20 UIAccessibility-[NSObject(AXPrivCategory) _accessibilityFindDescendant:] + 100
21 UIAccessibility__axuiElementForNotificationData + 276
22 UIAccessibility__massageAssociatedElementBeforePost + 36
23 UIAccessibility__UIAXBroadcastMainThread + 292
24 libdispatch.dylib__dispatch_call_block_and_release + 32
25 libdispatch.dylib__dispatch_client_callout + 20
26 libdispatch.dylib__dispatch_main_queue_drain + 980
27 libdispatch.dylib__dispatch_main_queue_callback_4CF + 44
28 CoreFoundation___CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
29 CoreFoundation___CFRunLoopRun + 1996
30 CoreFoundation_CFRunLoopRunSpecific + 572
31 GraphicsServices_GSEventRunModal + 164
32 UIKitCore-[UIApplication _run] + 816
33 UIKitCore_UIApplicationMain + 340
34 SwiftUIclosure #1 (Swift.UnsafeMutablePointer<Swift.UnsafeMutablePointer<Swift.Int8>?>) -> Swift.Never in SwiftUI.(KitRendererCommon in _ACC2C5639A7D76F611E170E831FCA491)(Swift.AnyObject.Type) -> Swift.Never + 168
35 SwiftUI SwiftUI.runApp(A) -> Swift.Never + 100
36 SwiftUI static (extension in SwiftUI):SwiftUI.App.main() -> () + 180
I am using PDFPageOverlayViewProvider from pdfkit. I would like to detect changes in the overlaid view and refresh PDFPageOverlayViewProvider. Currently, it does not refresh even when the overlaid view changes. Is there a way to refresh it?
In XCode15, if you specify mediaBox for PDFDisplayBox, the page will be shrunk to fit the specified range.
However, in XCode16, the page is cropped to fit the specified range, as when cropBox is specified for PDFDisplayBox.
I think it's a bug because the setBounds documentation hasn't been updated, but has anyone had the same problem?
Please let me know if there are any workarounds.
I'm building a MacOS app which reads a lot of PDFs in the background. Some of these PDF's have an embedded font which is not installed on the system. In such cases the app shows a popup asking whether to Download or Skip the font. This seems to be a PDFKit behavior because I see the same behavior when I open the file in Preview (see screenshot)
This behavior is disruptive to the user experience and I'd like to be able to disable font downloads. However I don't see any option in the PDFKit API to do so. Any ideas?
I have a SwiftUI View containing a PDFView from PDFKit (via NSViewRepresentable). When setting a new PDFDocument the view flashes briefly with the background color before displaying the new document.
Curiously the flashing is vastly reduced (but not eliminated) by calling layoutDocumentView() which should already be called from setDocument according to its documentation.
struct SheetView: NSViewRepresentable {
var pdf: PDFDocument?
func makeNSView(context: Context) -> PDFView {
let pdfView = PDFView()
pdfView.displaysPageBreaks = false
pdfView.displayMode = .singlePage
pdfView.pageShadowsEnabled = false
pdfView.autoScales = true
return pdfView
}
func updateNSView(_ pdfView: PDFView, context: Context) {
if pdf != pdfView.document {
pdfView.document = pdf
pdfView.layoutDocumentView() // reduces flashing but does not eliminate it
}
}
}
Hi, I'm working with UIDocument to store a PDF file. This is code I use for saving a file.
document.close(completionHandler: { (success) in
if success {
document.save(to: url,
for: .forOverwriting,
completionHandler: { (success) in
if success {
print("Saved file successfully")
}
})
}
})
This code works well with a small file size. But if it's a large file like 100MB, it takes around 2-5 minutes to save the file. Is there a way to save file with the changes only? Or create an auto save function triggered whenever the user edit the file?
I need to apply security measures to a PDF. My goal is to prevent it from being leaked, and even if it is leaked, I want to ensure that the PDF cannot be viewed. Is it possible to use pdfkit and apply DRM to achieve this?⬤
PDFKit PDFPage.characterBounds(at: Int) is returning incorrect coordinates with iOS 18 beta 4 and later / Xcode 16 beta 4.
It worked fine in iOS 17 and earlier (after showing the same issue during the early iOS 17 beta cycle)
It breaks critical functionality that my app relies on.
I have filed feedback (FB14843671).
So far no changes in the latest betas. iOS release date is approaching fast!
Anybody having the same issue? Any workaround available?
Dear all,
I have an app in which I'm trying to create a pdf from the data stored. Everything is working fine except the fact that the text is not following the page margins, going out of the page of being truncated without being written on the line below.
Has anybody experienced the same in the past?
Please assist, I'm getting out of my mind with this in the last two days...
Here the code of the function which is creating the PDF.
let pdfMetaData = [
kCGPDFContextCreator: "Your App Name",
kCGPDFContextAuthor: "Your Name",
kCGPDFContextTitle: "Allenamento"
]
let pageWidth = 8.5 * 72.0 // Standard letter size in points (8.5 x 11 inches)
let pageHeight = 11 * 72.0
let pageSize = CGRect(x: 0, y: 0, width: pageWidth, height: pageHeight)
let margin: CGFloat = 20.0
let pdfData = NSMutableData()
guard let consumer = CGDataConsumer(data: pdfData as CFMutableData) else {
print("Errore nella creazione del consumer")
return
}
var mediaBox = pageSize
guard let pdfContext = CGContext(consumer: consumer, mediaBox: &mediaBox, pdfMetaData as CFDictionary) else {
print("Errore nella creazione del contesto PDF")
return
}
pdfContext.beginPDFPage(nil)
// Parte superiore della pagina
...
// Disegno del rettangolo "MATERIALE DA ALLENAMENTO"
...
// Disegno del rettangolo "ESERCITAZIONI ALLENAMENTO"
let exercisesRect = CGRect(x: margin, y: cellYPosition - 45, width: pageWidth - 2 * margin, height: 25)
pdfContext.setFillColor(NSColor.lightGray.cgColor)
pdfContext.fill(exercisesRect)
pdfContext.setStrokeColor(NSColor.black.cgColor)
pdfContext.stroke(exercisesRect)
let exercisesText = "ESERCITAZIONI ALLENAMENTO"
let exercisesAttributedString = NSAttributedString(string: exercisesText, attributes: boldAttributes)
let exercisesTextPosition = CGPoint(x: exercisesRect.midX - exercisesAttributedString.size().width / 2, y: exercisesRect.midY - 5)
drawText(attributedString: exercisesAttributedString, position: exercisesTextPosition, context: pdfContext)
// Iniziamo a disegnare le informazioni degli esercizi
let sortedExercises = training.trainingExercises.sorted { $0.order < $1.order }
var currentY = exercisesRect.minY - 30
for trainingExercise in sortedExercises {
// Gestione del wrap text e posizionamento su più pagine
let remainingHeight = currentY - margin
if remainingHeight < 100 {
pdfContext.endPDFPage()
pdfContext.beginPDFPage(nil)
currentY = pageHeight - margin
}
// Disegna la durata
let durationText = "\(trainingExercise.duration) min"
let durationAttributedString = NSAttributedString(string: durationText, attributes: boldAttributes)
drawText(attributedString: durationAttributedString, position: CGPoint(x: margin, y: currentY), context: pdfContext)
currentY -= 20
// Disegna la descrizione con wrap text
let descriptionText = trainingExercise.exercise.exerciseDescription
let descriptionAttributedString = NSAttributedString(string: descriptionText, attributes: regularAttributes)
let maxTextWidth = pageWidth - 2 * margin
let descriptionBoundingBox = descriptionAttributedString.boundingRect(with: CGSize(width: maxTextWidth, height: .greatestFiniteMagnitude), options: [.usesLineFragmentOrigin, .usesFontLeading])
if currentY - descriptionBoundingBox.height < margin {
pdfContext.endPDFPage()
pdfContext.beginPDFPage(nil)
currentY = pageHeight - margin
}
// Disegno della descrizione con supporto per il wrap text
let descriptionFramesetter = CTFramesetterCreateWithAttributedString(descriptionAttributedString)
let descriptionPath = CGPath(rect: CGRect(x: margin, y: currentY - descriptionBoundingBox.height, width: maxTextWidth, height: descriptionBoundingBox.height), transform: nil)
let descriptionFrame = CTFramesetterCreateFrame(descriptionFramesetter, CFRangeMake(0, 0), descriptionPath, nil)
CTFrameDraw(descriptionFrame, pdfContext)
currentY -= descriptionBoundingBox.height + 10
// Disegna l'immagine sotto la descrizione
if let imagePath = trainingExercise.exercise.imagePath, let image = NSImage(contentsOfFile: imagePath) {
let imageCG = image.cgImage(forProposedRect: nil, context: nil, hints: nil)
let imageAspect = CGFloat(imageCG!.width) / CGFloat(imageCG!.height)
let targetWidth = min(maxTextWidth, CGFloat(400))
let targetHeight = targetWidth / imageAspect
if currentY - targetHeight < margin {
pdfContext.endPDFPage()
pdfContext.beginPDFPage(nil)
currentY = pageHeight - margin
}
let imageTargetRect = CGRect(x: margin, y: currentY - targetHeight, width: targetWidth, height: targetHeight)
pdfContext.draw(imageCG!, in: imageTargetRect)
currentY -= targetHeight + 10
}
// Disegna una linea sottile come separatore
pdfContext.setStrokeColor(NSColor.lightGray.cgColor)
pdfContext.setLineWidth(1.0)
let lineYPosition = currentY - 5
pdfContext.move(to: CGPoint(x: margin, y: lineYPosition))
pdfContext.addLine(to: CGPoint(x: pageWidth - margin, y: lineYPosition))
pdfContext.strokePath()
currentY -= 20 // Spazio tra esercizi
}
pdfContext.endPDFPage()
pdfContext.closePDF()
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd"
let fileName = "Allenamento_\(dateFormatter.string(from: training.date)).pdf"
if let documentsURL = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first {
let fileURL = documentsURL.appendingPathComponent(fileName)
do {
...
}
} catch {
print("Errore durante il salvataggio del PDF: \(error)")
}
}
}
private func drawText(attributedString: NSAttributedString, position: CGPoint, context: CGContext) {
let line = CTLineCreateWithAttributedString(attributedString)
context.textPosition = position
CTLineDraw(line, context)
}
I’m using PDFPageOverlayViewProvider with pdfview. I want to control the visibility of the overlay view using a button. However, the view updates only when it disappears and reappears. I would like the changes to be reflected immediately. How can I achieve this?
struct PDFKitView: View {
let bookId: UUID
let bookTitle: String
@State private var currentPage = "1"
@State private var isSideTab = false
@State private var selectedNote: [SelectedNote] = []
var body: some View {
let pdfDocument = openPDF(at: bookId.uuidString)
ZStack(alignment: .trailing) {
HStack(spacing: 0) {
PDFKitRepresentableView(
bookId: bookId,
selectedNote: $selectedNote,
currentPage: $currentPage,
pdfDocument: pdfDocument
)
if isSideTab {
SideView()
.transition(.move(edge: .trailing))
.zIndex(1)
.frame(maxWidth: 260)
}
}
.padding(.top, 73)
}
.onAppear {
getAllNote(bookId: bookId)
}
.customNavigationBar(back: true) {
Text("\(currentPage)/\(pdfDocument.pageCount)")
.pretendard(.CaptionRegular)
.foregroundStyle(Color.Text.primary)
} TrailingView: {
Button(action: {
withAnimation {
isSideTab.toggle()
}
}) {
Image(systemName: SFSymbol.squareStack3dDownForwardFill.icon)
.sfPro(.IconMedium)
.foregroundStyle(Color.Text.primary)
}
}
}
@ViewBuilder
func SideView() -> some View {
VStack(spacing: 16) {
HStack(spacing: 4) {
Image(systemName: SFSymbol.squareStack3dDownForwardFill.icon)
.sfPro(.IconSmall)
.foregroundStyle(Color.Text.primary)
Text(Literals.sideTabTitle)
.pretendard(.P2Bold)
.foregroundStyle(Color.Text.primary)
Spacer()
}
.padding(16)
.background {
Color.Background.white
}
ScrollView {
ForEach($selectedNote, id: \.noteId) { note in
NoteCellView(note: note)
}
}
.background {
Color.Fill.white
}
}
.background {
Color.Background.blueGray
}
}
@ViewBuilder
func NoteCellView(note: Binding<SelectedNote>) -> some View {
HStack(alignment: .top, spacing: 16) {
Image(.writingNote)
.resizable()
.scaledToFit()
.frame(width: 42, height: 60)
VStack(alignment: .leading, spacing: 8) {
Text(note.wrappedValue.noteId == bookId.uuidString ? "345" : "123")
.foregroundStyle(Color.Text.secondary)
.padding(.horizontal, 8)
.background {
Rectangle()
.strokeBorder(Color.Layout.secondary)
}
Text(bookTitle)
.lineLimit(2)
Toggle("", isOn: note.selected)
.labelsHidden()
.tint(Color.Fill.activePrimary)
}
}
.padding(EdgeInsets(top: 20, leading: 16, bottom: 16, trailing: 16))
}
}
struct PDFKitRepresentableView: UIViewRepresentable {
let bookId: UUID
@Binding var selectedNote: [SelectedNote]
@Binding var currentPage: String
let pdfDocument: PDFDocument
let pdfView = PDFView()
let toolPicker = PKToolPicker()
func makeUIView(context: Context) -> PDFView {
pdfView.displayMode = .singlePageContinuous
pdfView.usePageViewController(false)
pdfView.displayDirection = .vertical
pdfView.pageOverlayViewProvider = context.coordinator
pdfView.autoScales = true
pdfDocument.delegate = context.coordinator
pdfView.document = pdfDocument
return pdfView
}
func updateUIView(_ uiView: PDFView, context: Context) {
if
let localNote = selectedNote.first(where: {$0.noteId == bookId.uuidString}),
!localNote.selected
{
toolPicker.setVisible(false, forFirstResponder: uiView)
} else {
toolPicker.setVisible(true, forFirstResponder: uiView)
}
uiView.becomeFirstResponder()
}
func makeCoordinator() -> CanvasProvider {
return CanvasProvider(parent: self)
}
}
final class CanvasProvider: NSObject, PDFPageOverlayViewProvider, PDFDocumentDelegate {
var localNotes = [PDFPage: PKCanvasView]()
var passNotes = [PDFPage: Image]()
let parent: PDFKitRepresentableView
init(parent: PDFKitRepresentableView) {
self.parent = parent
super.init()
getDrawingDatas(
bookId: parent.bookId.uuidString,
selectedNote: parent.selectedNote,
document: parent.pdfDocument
)
}
func pdfView(_ view: PDFView, overlayViewFor page: PDFPage) -> UIView? {
var coverView: PKCanvasView? = PKCanvasView()
if
let view = localNotes[page],
parent.selectedNote.first(where: { $0.noteId == parent.bookId.uuidString })?.selected ?? false
{
view.backgroundColor = .clear
view.isOpaque = true
view.drawingPolicy = .anyInput
view.delegate = self
parent.toolPicker.addObserver(view)
coverView = view
(page as? CanvasPDFPage)?.canvasView = view
} else {
coverView = nil
}
for subView in view.documentView?.subviews ?? [] {
if subView.theClassName == "PDFPageView" {
subView.isUserInteractionEnabled = true
}
}
return coverView
}
func pdfView(_ pdfView: PDFView, willDisplayOverlayView overlayView: UIView, for page: PDFPage) { }
func pdfView(_ pdfView: PDFView, willEndDisplayingOverlayView overlayView: UIView, for page: PDFPage) { }
}
Hi
We're using CGPDFDocument to retrieve the PDF document and draw it in the UIView using CGContext.DrawPDFPage. While doing this operation, I was able to get an NSMallocException with a specific document.
I was able to get this exception only on real devices; emulators are working fine. The device used is the iPad (5th generation), which has iOS 16.7.8.
Steps to replicate:
Open the application at the link (we have attached the sample with PDF file with the issue in the link) https://www.dropbox.com/scl/fi/mosvcnqc0nvxwdjf8k0m5/SimplePDFVieweriOS.zip?rlkey=0ntj75yjg71kjwtwwe06uax5v&st=mmv08e2f&dl=0
Navigate through the pages using the next button.
After the page navigation to page 7, and the application will throw an NSMallocException with the reason: Failed to grow buffer
Platform: Xamarin.iOS
Development tool: Visual Studio 2022
Stack trace for the issue:
Native stack trace:
0 CoreFoundation 0x00000001b32e9418 55B9BA28-4C5C-3FE7-9C47-4983337D6E83 + 37912
1 libobjc.A.dylib 0x00000001ac63dc28 objc_exception_throw + 56
2 CoreFoundation 0x00000001b347c5c8 55B9BA28-4C5C-3FE7-9C47-4983337D6E83 + 1689032
3 CoreFoundation 0x00000001b3474504 55B9BA28-4C5C-3FE7-9C47-4983337D6E83 + 1656068
4 CoreFoundation 0x00000001b3363160 __CFSafelyReallocate + 68
5 CoreFoundation 0x00000001b33aae9c 55B9BA28-4C5C-3FE7-9C47-4983337D6E83 + 831132
6 CoreFoundation 0x00000001b335af2c CFDataSetLength + 152
7 CoreGraphics 0x00000001b4ca71a4 CGDataProviderCopyData + 240
8 ImageIO 0x00000001b7fafd38 7E9A543E-EE3C-34B7-9EFE-D5F6357F2FA3 + 32056
9 ImageIO 0x00000001b7fb1124 7E9A543E-EE3C-34B7-9EFE-D5F6357F2FA3 + 37156
10 ImageIO 0x00000001b7ff7124 7E9A543E-EE3C-34B7-9EFE-D5F6357F2FA3 + 323876
11 ImageIO 0x00000001b7fb0fe0 CGImageSourceCreateWithDataProvider + 176
12 CoreGraphics 0x00000001b4d7ac0c EDFE1CE3-C3C4-30A2-AC92-099D20347781 + 1018892
13 CoreGraphics 0x00000001b4d7a9a0 CGPDFImageCreateImage + 208
14 CoreGraphics 0x00000001b4decbc8 EDFE1CE3-C3C4-30A2-AC92-099D20347781 + 1485768
15 CoreGraphics 0x00000001b4d26e34 EDFE1CE3-C3C4-30A2-AC92-099D20347781 + 675380
16 CoreGraphics 0x00000001b4d2f7c4 EDFE1CE3-C3C4-30A2-AC92-099D20347781 + 710596
17 CoreGraphics 0x00000001b4ce16dc CGPDFScannerScan + 436
18 CoreGraphics 0x00000001b5073198 CGPDFDrawingContextDraw + 112
19 CoreGraphics 0x00000001b4d271b0 EDFE1CE3-C3C4-30A2-AC92-099D20347781 + 676272
20 CoreGraphics 0x00000001b4d2f7c4 EDFE1CE3-C3C4-30A2-AC92-099D20347781 + 710596
21 CoreGraphics 0x00000001b4ce16dc CGPDFScannerScan + 436
22 CoreGraphics 0x00000001b4d3f68c CGContextDrawPDFPageWithDrawingCallbacks + 2680
23 CoreGraphics 0x00000001b4cdb04c CGContextDrawPDFPage + 32
24 SimplePDFViewer 0x0000000100f0cb90 SimplePDFViewer + 1969040
25 SimplePDFViewer 0x0000000100eeb3c0 SimplePDFViewer + 1831872
26 SimplePDFViewer 0x0000000100d35b14 SimplePDFViewer + 39700
27 SimplePDFViewer 0x0000000100e8eb80 SimplePDFViewer + 1452928
28 SimplePDFViewer 0x0000000100f483f4 mono_pmip + 25092
29 SimplePDFViewer 0x0000000100fd8b90 mono_pmip + 616864
30 SimplePDFViewer 0x0000000100fdc014 mono_pmip + 630308
31 SimplePDFViewer 0x0000000100d32450 SimplePDFViewer + 25680
32 SimplePDFViewer 0x0000000100d32328 SimplePDFViewer + 25384
33 UIKitCore 0x00000001b5412150 27A9C298-B702-3C39-8C06-07196E4CD16B + 1667408
34 QuartzCore 0x00000001b47990e8 9E40B2EB-260C-3AF1-AE45-A1A551A8C1B9 + 119016
35 QuartzCore 0x00000001b480adb8 9E40B2EB-260C-3AF1-AE45-A1A551A8C1B9 + 585144
36 QuartzCore 0x00000001b47987a8 9E40B2EB-260C-3AF1-AE45-A1A551A8C1B9 + 116648
37 QuartzCore 0x00000001b4798034 9E40B2EB-260C-3AF1-AE45-A1A551A8C1B9 + 114740
38 QuartzCore 0x00000001b47a89f0 9E40B2EB-260C-3AF1-AE45-A1A551A8C1B9 + 182768
39 QuartzCore 0x00000001b47d5dc0 9E40B2EB-260C-3AF1-AE45-A1A551A8C1B9 + 368064
40 QuartzCore 0x00000001b47c0dc8 9E40B2EB-260C-3AF1-AE45-A1A551A8C1B9 + 282056
41 CoreFoundation 0x00000001b33698e8 55B9BA28-4C5C-3FE7-9C47-4983337D6E83 + 563432
42 CoreFoundation 0x00000001b32f951c 55B9BA28-4C5C-3FE7-9C47-4983337D6E83 + 103708
43 CoreFoundation 0x00000001b3355214 55B9BA28-4C5C-3FE7-9C47-4983337D6E83 + 479764
44 CoreFoundation 0x00000001b3359d20 CFRunLoopRunSpecific + 584
45 GraphicsServices 0x00000001eab69998 GSEventRunModal + 160
46 UIKitCore 0x00000001b55ec448 27A9C298-B702-3C39-8C06-07196E4CD16B + 3609672
47 UIKitCore 0x00000001b55ec0c0 UIApplicationMain + 312
48 SimplePDFViewer 0x000000010106b350 xamarin_UIApplicationMain + 60
49 SimplePDFViewer 0x0000000100f0de18 SimplePDFViewer + 1973784
50 SimplePDFViewer 0x0000000100eecd4c SimplePDFViewer + 1838412
51 SimplePDFViewer 0x0000000100eece70 SimplePDFViewer + 1838704
52 SimplePDFViewer 0x0000000100d33ad0 SimplePDFViewer + 31440
53 SimplePDFViewer 0x0000000100e8eb80 SimplePDFViewer + 1452928
54 SimplePDFViewer 0x0000000100f483f4 mono_pmip + 25092
55 SimplePDFViewer 0x0000000100fd8b90 mono_pmip + 616864
56 SimplePDFViewer 0x0000000100fddbdc mono_pmip + 637420
57 SimplePDFViewer 0x0000000100f2d5ec SimplePDFViewer + 2102764
58 SimplePDFViewer 0x00000001010802dc xamarin_log + 22464
59 SimplePDFViewer 0x0000000100d334bc SimplePDFViewer + 29884
60 dyld 0x00000001d0b04344 8A4B89B7-D348-375B-97B1-FC8A84E3E5CE + 82756
Kindly let us know if you need any further details regarding this issue.
hi
when I try to open any large pdf
it loads but zoom in zoomout
not working… same happening in iPadOS 18 beta also
It's the same as the title, and when I checked the log, there were hundreds to thousands of lines with the following content.
The larger the page index of the Pdf from which you select letters, the more logs will be recorded.
.notdef: no mapping.
.notdef: no mapping.
.notdef: no mapping.
.notdef: no mapping.
.notdef: no mapping.
.notdef: no mapping.
.
.
.
can't create CMap Adobe-KR1-UCS2'. can't create CMap Adobe-KR1-UCS2'.
can't create CMap Adobe-KR1-UCS2'. can't create CMap Adobe-KR1-UCS2'.
can't create CMap Adobe-KR1-UCS2'. can't create CMap Adobe-Identity-UCS2'.
can't create CMap Adobe-KR1-UCS2'. can't create CMap Adobe-KR1-UCS2'.
can't create CMap Adobe-Identity-UCS2'. can't create CMap Adobe-Identity-UCS2'.
can't create CMap `Adobe-Identity-UCS2'.
I don't know why this is happening. Is there a solution?
Hi - I am using PDFKit to create annotations (drawings), comments, and filling out forms of PDF Templates that are digitally signed. The signature permissions allow for form filling and annotations.
How can I save the document incrementally or by appending the changes to the end of a PDF so that it doesn't invalidate the signature and its hash.
I didn't see any flag options for this in the PDF write (toFile/URL) or dataRepresentation functions, but it seems noting has been added or changed since iOS 11.0.
Is there a flag to allow this with PDFDocumentWriteOption or is there another method I should be using?
Thank you.
How do I correctly show a PDF document?
iPad and Xcode 15.4
Within my GameViewController, I have:
func presentScene(_ theScene: SKScene) {
theScene.scaleMode = .resizeFill
if let skView = self.view as? SKView {
skView.ignoresSiblingOrder = true
skView.showsFPS = true
skView.showsNodeCount = true
#if os(iOS)
let theTransition = SKTransition.doorway(withDuration: 2.0)
skView.presentScene(theScene, transition: theTransition)
#elseif os(tvOS)
skView.presentScene(theScene)
#endif
}
} // presentScene
I believe presentScene(theScene) goes to the sceneDidLoad() func of theScene which adds various SKSpriteNodes to the scene via a call to addChild(theNode).
So far so good ...
Until I have a SKScene wherein I wish to display a PDF.
I use this snippet to display this PDF with this call within the SKScene's sceneDisLoad():
displayPDF("ABOUT_OLD_WEST_LOCOMOTIVE")
func displayPDF(_ itsName:String) {
let pdfView = PDFView()
guard let path = Bundle.main.path(forResource: itsName, ofType: "pdf")
else { return }
print("path")
guard let pdfDocument = PDFDocument(url: URL(fileURLWithPath: path))
else { return }
print("pdfDocument")
pdfView.displayMode = .singlePageContinuous
pdfView.autoScales = true
pdfView.displayDirection = .vertical
pdfView.document = pdfDocument
} // displayPDF
The 2 print statements show, yet the SKScene does not display the PDF via pdfView.document = pdfDocument?
Anyone have a clue what errors I have committed?
Appreciate it.
Does anybody knows how to implement draw on pdf function for iOS?
Approach is the same as Files app. Telegram and Whatsapp using the same technique.
Hey there, I have a slight problem which is also known on the web, but I couldn't find any answers...
My iOS App is working with documents like pdf and images. It is made to handle invoices and upload them to an external service. The app's job is to compress those pdfs and images. Sadly the PDFKit's PDFDocument increases its size just after importing it with pdfDocument = PDFDocument(url: url) and later exporting it to an pdf file again with data = pdf.dataRepresentation() without ever modifying it.
It increases by server KB after each export. Do you have any alternatives to the renderer dataRepresentation() or a general PDFKit alternative
Thanks
The problem is that when I read out the text in a PDF with page.string or page.attributedString, the context of the lines is lost. Instead of
TermA....23,45
TermB....2,13
in an index document
TermA
TermB
23,45
2,13
is issued. The context of the lines (and the sequence of the letters) is lost. Is there a way to read the text from a PDF line by line?
Does anyone know why the following call fails?
CGPDFOperatorTableSetCallback(operatorTable, "ID", &callback);
The PDF specification seems to indicate that ID is an operator?
BTW what is the proper topic/subtopic for questions about Quartz? Wasn't sure what topic on the new forums to post this under.