PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Faster merges
https://forum.pdfsharp.net/viewtopic.php?f=2&t=3606
Page 1 of 1

Author:  osaiz [ Tue Jun 20, 2017 1:03 pm ]
Post subject:  Faster merges

Hello.

I'm merging different PDF files. I'm doing it following the examples:
1.- creating a new document (newdoc)
2.- opening each doc to be merged in import mode.
3.- for each page of each document opened in 2, newdoc.AddPage(page)
4.- save the newdoc newdoc.Close()

It works perfectly but it is quite slow.
Is there any faster way of doing this? I wonder for instance a way of merging N files not going page by page...

Thanks a lot

Oskar

Author:  Thomas Hoevel [ Wed Jun 21, 2017 8:11 am ]
Post subject:  Re: Faster merges

Hi!
osaiz wrote:
It works perfectly but it is quite slow.
How slow is "quite slow"?

osaiz wrote:
Is there any faster way of doing this? I wonder for instance a way of merging N files not going page by page...
There must be a loop over all pages somewhere. A method "AddPages" might allow some optimizations.

Make sure you use a Release build of PDFsharp when testing speed or checking file size.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/