merging pdfs bookmarks 3.5 problem?

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.

Moderators: Tracker Support, TrackerSupp-Daniel, Chris - Tracker Supp, Vasyl-Tracker Dev Team, Sean - Tracker, Andrew - Tracker Support, Tracker - Clarion Support, John - Tracker Supp, Tracker Supp-Stefan, Ivan - Tracker Software, Support Staff, moderators

Post Reply
tarek_fcis
User
Posts: 3
Joined: Sun May 07, 2006 12:49 pm

merging pdfs bookmarks 3.5 problem?

Post by tarek_fcis » Mon May 08, 2006 11:11 am

hello forum technical support
i really thank you for your answer on my previous question
in pdf-tools sdk for 3.5 not 3.0
i have found that bookmarks of the merged pdf is lost

you will find pdfmerge.zip is attached you will find the code i have tried
using c# with your excellent evaluation libraries

when i used the function PDFXCp_Merge() with the version 3.0 all things are well but this function is now no longer available in version 3.5
we use now PXCp_InsertPagesTo() which adds pages only and ignores bookmarks i am sure there may be flags while passing parameters or i have to use another function to merge bookmarks
please support me with working example of merging two pdfs with
bookmarks using version 3.5 and i will be gratefull

a snippet of code follows
/////////////////////////////////////////////////////

try
{
if (lstView.Items.Count < 2)
{
MessageBox.Show("Must be at least two files to merge", "PDF Toolbox", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
int pdf;
int res = XCPro35_Defs.PXCp_Init(out pdf, XCPro35_Defs.g_RegKey, XCPro35_Defs.g_DevCode);
res = XCPro35_Defs.PXCp_ReadDocumentW(pdf, lstView.Items[0].Text, 0);
for (int i = 1; i < lstView.Items.Count; i++)
{
int pdf_to_merge;
res = XCPro35_Defs.PXCp_Init(out pdf_to_merge, XCPro35_Defs.g_RegKey, XCPro35_Defs.g_DevCode);
res = XCPro35_Defs.PXCp_ReadDocumentW(pdf_to_merge, lstView.Items.Text, 0);

int PagesCount;
XCPro35_Defs.PXCp_CopyPageRange[] pagesRange = new XCPro35Demo.XCPro35_Defs.PXCp_CopyPageRange[1];
pagesRange[0].StartPage = 0;
res = XCPro35_Defs.PXCp_GetPagesCount(pdf_to_merge, out PagesCount);
pagesRange[0].EndPage = PagesCount - 1;
pagesRange[0].InsertBefore = -1;


res = XCPro35_Defs.PXCp_InsertPagesTo(pdf_to_merge, pdf, pagesRange, 1, -1);
res = XCPro35_Defs.PXCp_Delete(pdf_to_merge);
}
res = XCPro35_Defs.PXCp_WriteDocumentW(pdf, m_strToOutput, XCPro35_Defs.PXCp_CreationDisposition.PXCp_CreationDisposition_Overwrite, 0);
}
catch(Exception ex)
{
MessageBox.Show(ex.Message, "PDF Toolbox", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
////////////////////////////////////////////////////
i am thankfully waiting for your reply
Attachments
pdf_merge.zip
(2.36 MiB) Downloaded 150 times

John - Tracker Supp
Site Admin
Posts: 8202
Joined: Tue Jun 29, 2004 10:34 am
Location: Vancouver Island - Canada
Contact:

Post by John - Tracker Supp » Mon May 08, 2006 11:54 am

Hi Tarek,

Thansk for your files - it looks like the issue is with your code.

Please see attached which converts just fine using our PDF-Tools utility we offer to end users - you may want to download and use the eval version of this to establish if any future issue is library or application code based.

I will have to ask our C# dev to look at your code - and it may be that I will need a complete project - not just the snippet supplied - it looks like the code supplied is all compiled binary rather than source, other than the little portion supplied here?

You can download PDF-Tools for end users evaluation here :
http://www.tracker-software.com/download/PDFT3.zip
Attachments
Merged2.zip
Merged file
(185.5 KiB) Downloaded 163 times
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

John - Tracker Supp
Site Admin
Posts: 8202
Joined: Tue Jun 29, 2004 10:34 am
Location: Vancouver Island - Canada
Contact:

Post by John - Tracker Supp » Thu May 11, 2006 12:10 pm

Post moved to append to original topic :
really thank you for answering the question
"merging pdfs bookmarks 3.5 problem?"
but your answer was insuffecient?
all what you have done is that you used a final version and sent me only the result.
and you promised me to consult you c# developer to answer my question
simply all what i need is to make a sample that concatenate two pdf
with bookmarks for both and i will be gratefull
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

John - Tracker Supp
Site Admin
Posts: 8202
Joined: Tue Jun 29, 2004 10:34 am
Location: Vancouver Island - Canada
Contact:

Post by John - Tracker Supp » Thu May 11, 2006 12:38 pm

Please see the attached example - the following logic being used :

If a PDF file with bookmarks is being merged with apdf which also has pages/bookmarks, the bookmarks will be added to the end of the existing bookmarks tree in the original document & should point to the page which calculates as:

[pages count of original doc] + [page number in bookmark information]

HTH
Attachments
XCPro35DemoC#.zip
Merge example C# preserving bookmarks
(102.61 KiB) Downloaded 159 times
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