PDF merge

This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-Tools SDK of Library DLL functions(only) - Please use the PDF-XChange Drivers API SDK Forum for assistance with all PDF Print Driver related topics or PDF-XChange Viewer SDK if appropriate.

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

Post Reply
isaware
User
Posts: 39
Joined: Fri Sep 25, 2009 6:21 pm

PDF merge

Post by isaware »

Hi,

We are merging existing PDF files.
Some files take one minute to merge - outcome is 30MB PDF.
Some other files take 3-5 minutes to merge - outcome 12-15MB PDF.

Do you know why the tool is merging slow for some PDFs?
User avatar
John - Tracker Supp
Site Admin
Posts: 5219
Joined: Tue Jun 29, 2004 10:34 am
Location: United Kingdom
Contact:

Re: PDF merge

Post by John - Tracker Supp »

There are many factors that could affect this - not least of all the file content, type and what size the files are to begin with and if you are attempting to optimize during merging...

We would need samples to pass an informed opinion.
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com
isaware
User
Posts: 39
Joined: Fri Sep 25, 2009 6:21 pm

Re: PDF merge

Post by isaware »

Can you send me a sample code that merges 250 PDFs in one folder?
User avatar
John - Tracker Supp
Site Admin
Posts: 5219
Joined: Tue Jun 29, 2004 10:34 am
Location: United Kingdom
Contact:

Re: PDF merge

Post by John - Tracker Supp »

Hi,

are you using our end user application or Developer SDK ?
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com
isaware
User
Posts: 39
Joined: Fri Sep 25, 2009 6:21 pm

Re: PDF merge

Post by isaware »

We are using the SDK.
User avatar
John - Tracker Supp
Site Admin
Posts: 5219
Joined: Tue Jun 29, 2004 10:34 am
Location: United Kingdom
Contact:

Re: PDF merge

Post by John - Tracker Supp »

Please post in the correct forum - so the correct product specailist can reply and we avoid delays in responding to you request, I will move this post on your behalf..

Also - with respect - we do not provide a 'turn key' solution and developers are expected to read the documentation, see the examples and if you are still having issues - we are happy to look at your code and try and help ...
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com
isaware
User
Posts: 39
Joined: Fri Sep 25, 2009 6:21 pm

Re: PDF merge

Post by isaware »

Read first file with following code -

iRes = XCPro40_Defs.PXCp_Init(m_iPDF, XCPro40_Defs.g_RegKey, XCPro40_Defs.g_DevCode)
iRes = XCPro40_Defs.PXCp_ReadDocumentW(m_iPDF, sFirstMergeFile, 0)

and merge other documents with following -

iRes = XCPro40_Defs.PXCp_Init(iPDFToMerge, XCPro40_Defs.g_RegKey, XCPro40_Defs.g_DevCode)
iRes = XCPro40_Defs.PXCp_ReadDocumentW(iPDFToMerge, sFileName, 0)

Dim iPagesRange() As XCPro40_Defs.PXCp_CopyPageRange
ReDim iPagesRange(1)
Dim iPagesCount As Integer
iRes = XCPro40_Defs.PXCp_GetPagesCount(iPDFToMerge, iPagesCount)

iPagesRange(0).StartPage = 0
iPagesRange(0).EndPage = iPagesCount - 1
iPagesRange(0).InsertBefore = -1
XCPro40_Defs.PXCp_InsertPagesTo(iPDFToMerge, m_iPDF, iPagesRange, 1, 0)

iRes = XCPro40_Defs.PXCp_WriteDocumentW(m_iPDF, m_sRootFileName, XCPro40_Defs.PXCp_CreationDisposition.PXCp_CreationDisposition_Overwrite, XCPro40_Defs.PXCp_WriteDocFlag.PXCp_Write_NoRelease)

at the end of the process, we release the document with following -

iRes = XCPro40_Defs.PXCp_OptimizeFonts(m_iPDF, 0)
iRes = XCPro40_Defs.PXCp_OptimizeRemoveNamedDests(m_iPDF)
iRes = XCPro40_Defs.PXCp_OptimizeStreamCompression(m_iPDF)
iRes = XCPro40_Defs.PXCp_WriteDocumentW(m_iPDF, m_sRootFileName, XCPro40_Defs.PXCp_CreationDisposition.PXCp_CreationDisposition_Overwrite, 0)
User avatar
John - Tracker Supp
Site Admin
Posts: 5219
Joined: Tue Jun 29, 2004 10:34 am
Location: United Kingdom
Contact:

Re: PDF merge

Post by John - Tracker Supp »

Hi,

We suspect the most time consuming operations occur when performing;
PXCp_OptimizeFonts and PXCp_OptimizeStreamCompression functions, and the processing time for these is very dependant on the documents being merged.

Also, the call to PXCp_WriteDocumentW before performing optimization is redundant and is not necessary.

So to move forward - sample doc's will be required - however, as a 'quick and dirty' test your end you could comment these out and test to see if this improves things ...

Finally - if you feel in anyway your code may be at fault in terms of processing time - you can always also try and use the evaluation version of our end user product PDF-Tools which performs a similar task...

Hope that helps
If posting files to this forum - you must archive the files to a ZIP, RAR or 7z file or they will not be uploaded - thank you.

Best regards
Tracker Support
http://www.tracker-software.com
Post Reply