Merging PDF Files in Cocoa
来源:互联网 发布:录屏软件哪款好 编辑:程序博客网 时间:2024/05/22 09:05
问题:http://stackoverflow.com/questions/5610521/merging-pdf-files-in-cocoa
I would like to concatenate several PDF files to form one single PDF. Now I've come so far that I know, PDFKit is the proper way to go (I guess). But I am not sure, how to accomplish the merging. Should I have one PDFDocument
and several PDFPage
and then call insertPage
on the PDFDocument
? Or is there a much simpler way? I dont want to alter the PDFs contetwise, I just want to merge them. Thanks a lot!
答案:
As you indicated, you need one output PDFDocument
object which will contain all pages of all input PDF files. To do so, you'll need to loop through all input files, create PDFDocument
objects for each one and iterate over all pages to add them using insertPage
to the output PDFDocument
object.
Assuming that inputDocuments
is an NSArray
of one ore more PDFDocument
objects, you can use this snippet:
PDFDocument *outputDocument = [[PDFDocument alloc] init];NSUInteger pageIndex = 0;for (PDFDocument *inputDocument in inputDocuments) { for (PDFPage *page in inputDocument) { [outputDocument insertPage:page atIndex:pageIndex++]; }}
- Merging PDF Files in Cocoa
- Crawling PDF files in MOSS Search
- How to open PDF files in sharepoint
- Merge several pdf files together in Latex!!!
- Merge/Split PDF files in Linux
- SOX Conversions, Raw Files, Splitting And Merging Channels
- Merging columns in GridView/DataGrid header
- Csharp:user WebControl Read Adobe PDF Files In Your Web Browser
- Csharp:user WebControl Read Adobe PDF Files In Your Web Browser
- Multithreading in Cocoa
- Multithreading in Cocoa
- Multithreading in Cocoa
- Cocoa in the Shell
- [Cocoa]_[Plug-in]
- Howto Convert PDF files to HTML files
- Concatenate pdf files with pyPdf
- Programmatic Code Coverage Data Merging in Visual Studio 2010
- MP3 files in Wallop
- hdu 确定比赛名次(拓扑排序)
- C#常见错误及解决方案
- Eclipse配置SVN
- Oracle Form 如何制作手电筒查询
- Android 4.0 Launcher2源码分析——主布局文件
- Merging PDF Files in Cocoa
- Windows Shell编程-第三章.操作文件
- Scrum两天培训小结
- 权限问题。。。。
- DMZ
- Windows Shell编程-第四章.文件的本质
- Ubuntu init启动流程分析
- Windows Shell编程-第五章.浏览文件夹
- poj2240 Arbitrage