Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/multithreading/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 将两个b5大小的pdf合并到一个法律页面_C# - Fatal编程技术网

C# 将两个b5大小的pdf合并到一个法律页面

C# 将两个b5大小的pdf合并到一个法律页面,c#,C#,有没有办法将两个b5大小的pdf合并成一个合法大小的pdf。谷歌搜索之后,我没有找到任何解决办法。如何处理这个问题。我能用什么来做这件事。我正在开发c桌面应用程序,它将两个b5大小的pdf合并到一个法律页面。一个是左边的,另一个是右边的 e、 g.投入 1. b5first.pdf 1234 2. b5second 567 输出应该是 3. legal.pdf 1234 567 您可以从第二个pdf中获取文本,然后将其放在

有没有办法将两个b5大小的pdf合并成一个合法大小的pdf。谷歌搜索之后,我没有找到任何解决办法。如何处理这个问题。我能用什么来做这件事。我正在开发c桌面应用程序,它将两个b5大小的pdf合并到一个法律页面。一个是左边的,另一个是右边的

e、 g.投入

1. b5first.pdf  

   1234              

2. b5second 

   567     
输出应该是

3. legal.pdf

   1234 567

您可以从第二个pdf中获取文本,然后将其放在第一个位置,即您想要放的位置。 如果您正在使用iTextsharp,您可以执行以下操作

String text += PdfTextExtractor.GetTextFromPage(reader, pageno ,new LocationTextExtractionStrategy());

然后可以将字符串放在任何您想要的地方。

如果您正在寻找开源解决方案,请选中此项以将图元文件转换为EPS,然后使用包含在LyX或类似工具中的epstopdf将EPS转换为PDF。

是否有帮助?您好,先生,我不想添加新页面,但我希望将PDF都转换为单个PDF页面,即左侧和右侧的页面另一个是对的side@navnit这些答案有帮助吗?
    public static void somefunction(string oldFile,string oldFile1,string pathout)
    {
        // open the reader
        PdfReader reader = new PdfReader(oldFile);
        PdfReader reader1 = new PdfReader(oldFile1);
        Document document = new Document(PageSize.LEGAL.Rotate());

        // open the writer
        FileStream fs = new FileStream(pathout, FileMode.Create, FileAccess.Write);
        PdfWriter writer = PdfWriter.GetInstance(document, fs);
        document.Open();

        // the pdf content
        PdfContentByte cb = writer.DirectContent;

        // create the new page and add it to the pdf
        PdfImportedPage page = writer.GetImportedPage(reader, 1);
        PdfImportedPage page1 = writer.GetImportedPage(reader1, 1);

        cb.AddTemplate(page, 0, 0);
        cb.AddTemplate(page1, 500, 0);
        // close the streams and voilá the file should be changed :)
        document.Close();
        fs.Close();
        writer.Close();
        reader.Close();
        reader1.Close();
    }