ABCPDF:拆分PDF文件转换为单页的PDF文件 [英] ABCPDF: Split PDF files into single page PDF files

查看:322
本文介绍了ABCPDF:拆分PDF文件转换为单页的PDF文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用ABCpdf的工具,我想(这样的效率是一个问题),为了将PDF文件的1TB成单页PDF文件。

I am using ABCpdf tool and I am trying to split 1TB of PDF files (so efficiency is a concern) into single page PDF files.

我曾尝试以下内容:

Doc theSrc = new Doc();
theSrc.Read("C://development//pdfSplitter//Bxdfbc91ca-fc05-4315-8c40-798a77431ee0xP.pdf");

for (int i = 1; i <= theSrc.PageCount; i++)
{   
    Doc singlePagePdf = new Doc();
    singlePagePdf.Rect.String = singlePagePdf.MediaBox.String = theSrc.MediaBox.String;
    singlePagePdf.AddPage();
    singlePagePdf.AddImageDoc(theSrc, i, null);
    singlePagePdf.FrameRect();
    singlePagePdf.Save("C://development//pdfSplitter//singlePDF//singlePage"+i+".pdf");
    singlePagePdf.Clear();
}
theSrc.Clear();

这一个是非常快的,但它不保持旋转的页面,他们需要的人。
我想他们手动旋转,但这很快就得到了一个有点乱,他们没有出来具体的方法,因为他们在原始文档中

This one is very fast BUT it does not keep the rotated pages and they NEED to be. I tried to rotate them manually but this very quickly got a bit messy and they did not come out the precise way as they were in the original document.

我也试过:

Doc theSrc = new Doc();
theSrc.Read("C://development//pdfSplitter//Bxdfbc91ca-fc05-4315-8c40-798a77431ee0xP.pdf");
for (int i = 1; i <= theSrc.PageCount; i++)
{  
    Doc singlePagePdf = new Doc();
    singlePagePdf.Append(theSrc);
    singlePagePdf.RemapPages(i.ToString());
    singlePagePdf.Save("C://development//pdfSplitter//singlePDF//singlePage"+i+".pdf");
    singlePagePdf.Clear();
}
theSrc.Clear();

这一个是约6倍,比第一次慢(大文件),但它保持格式旋转的网页,这是很重要的。这一个问题是,我有整个文档添加和再次删除所有不需要的页面。这对于是非常低效的文件中的所有页面完成。

This one is about 6 times slower(on large documents) than the first one BUT it keeps the formatting of the rotated pages and that is important. The problem with this one is that I have to append the whole document and remove all the unwanted pages again. This is done for all pages in the file which is very inefficient.

任何人可以帮助我在这个问题上?

Can anybody help me on this matter?

推荐答案

所以我跟支撑位于WebSuperGoo(ABCpdf的创造者),他们给了我下面的:

So I talked to the support at WebSuperGoo (The creators of ABCpdf) and they gave me the following:

Doc theSrc = new Doc();
theSrc.Read("C://development//pdfSplitter//Bxdfbc91ca-fc05-4315-8c40-798a77431ee0xP.pdf");

int srcPagesID = theSrc.GetInfoInt(theSrc.Root, "Pages");
int srcDocRot = theSrc.GetInfoInt(srcPagesID, "/Rotate");

for (int i = 1; i <= theSrc.PageCount; i++)
{   
    Doc singlePagePdf = new Doc();
    singlePagePdf.Rect.String = singlePagePdf.MediaBox.String = theSrc.MediaBox.String;
    singlePagePdf.AddPage();
    singlePagePdf.AddImageDoc(theSrc, i, null);
    singlePagePdf.FrameRect();

    int srcPageRot = theSrc.GetInfoInt(theSrc.Page, "/Rotate");
    if (srcDocRot != 0)
    {
        singlePagePdf.SetInfo(singlePagePdf.Page, "/Rotate", srcDocRot);
    }
    if (srcPageRot != 0)
    {
        singlePagePdf.SetInfo(singlePagePdf.Page, "/Rotate", srcPageRot);
    }

    singlePagePdf.Save("C://development//pdfSplitter//singlePDF//singlePage"+i+".pdf");
    singlePagePdf.Clear();
}
theSrc.Clear();

此溶液是等于我的第一个解决方案,但它包含了页面旋转和速度非常快。

This solution is equal to my first solution but it incorporates the page rotation and is very fast.

我希望这可以帮助其他人。

I hope this can help others as well.

这篇关于ABCPDF:拆分PDF文件转换为单页的PDF文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆