![]() NewPDF.outlineRoot!.insertChild(newTOCEntry, at: pageNum-1)ĭirectoryURLStr = (getFileURL(streamId: streamId)?. NewTOCEntry.label = "\(streamId) page \(pageNum)" Let newDest = PDFDestination(page: pdfPage, at:topLeft) Let destination = PDFDestination(page: pdfPage, at: topLeft) Let topLeft = NSMakePoint(pdfPageRect.minX, pdfPageRect.height 20) Let pdfPageRect = pdfPage.bounds(for: diaBox) pdfoutline reads input file given as first argument, adds outlines from text file given as second argument. ADD A LITTLE CODE TO MAKE THE NSPoint IN THE DESTINATION MORE SOUND pdfoutline input.pdf outlines.txt output.pdf. Let pdfPage = newPDF.page(at: pageNum-1)! ![]() NewPDF.outlineRoot = PDFOutline() // CREATE PDF OUTLINE ROOT NODE! And of course the double loop can now be removed, but for clarity's sake I left it in: static func mergePagesIntoSinglePDF(streamId: String, numPages: Int) I also added a little to make the NSPoint a little smarter, since you can't really assume in PDF that the "1,1 " hack is a valid coordinate (generally is. The main problem was that I needed to create a root node for the PDFOutline. Let fileURL = URL(string: directoryURLStr)Īppears that I was much closer than I thought. NewPDF.outlineRoot?.insertChild(newTOCEntry, at: pageNum-1)ĭirectoryURLStr = (getFileURL(streamId: streamId)?.absoluteString)! NewTOCEntry.label = "This is page: \(pageNum)" Let newTOCEntry:PDFOutline = PDFOutline.init() Let newDest:PDFDestination = PDFDestination.init(page: newPDF.page(at: pageNum-1)!, at:NSPoint(x:1,y:1)) Download Yacine Tv App Apps APK latest version 1.6 for PC devices. The app is developed by One Kerato and its user rating is 4.6 out of 5. It is a perfect match for Office in the Productivity category. NewPDF.insert(pdfPage, at: newPDF.pageCount) The latest version of PDFOutliner is 1.7 on Mac Informer. If let pdfDocument = PDFDocument(url: directoryUrl!), Let directoryUrl = getFileURL(streamId: streamId, recNum: pageNum)ĭirectoryURLStr = directoryUrl!.absoluteString static func mergePagesIntoSinglePDF(streamId: String, numPages: Int) Ultimately will just have one loop if possible. any leads would be greatly appreciated.īTW, the reason it's in two loops rather than one was because I thought maybe I needed to add all pages first - but trying that didn't make a difference. It might be as simple as a missing assignment or something. The PDF comes out fine but there is never an outline/TOC in it. Using best guess on the documentation I came up with the following which I've been twiddling w/a bit but no luck at all. ![]() I'm working in Swift4/MacOS/Cocoa and can not for the life of me find any kind of example in Swift for creating an outline / only traversing an existing one (which I'm well familiar with). I'm working on a small routine that takes a number of single page PDFs and merges them together into one multi-page PDF.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |