Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Retaining OCG / Layers When Merging PDFs
  FAQ FAQ  Forum Search   Register Register  Login Login

Retaining OCG / Layers When Merging PDFs

 Post Reply Post Reply
Author
Message
fellafoo View Drop Down
Team Player
Team Player


Joined: 21 May 22
Location: Simsbury, CT
Status: Offline
Points: 21
Post Options Post Options   Thanks (0) Thanks(0)   Quote fellafoo Quote  Post ReplyReply Direct Link To This Post Topic: Retaining OCG / Layers When Merging PDFs
    Posted: 09 Feb 23 at 7:00PM
Dear Forum Members:

Do any of you know how to retain OCG / Layers while merging PDFs?

I can merge multiple PDFs with PDFLib.MergeFileList or PDFLib.MergeFileListFast but only the first page retains its layers. I've experimented with MergeDocument and MergeFiles and get the same results. I expect behind the scenes these routines do essentially the same thing.

The PDFs I'm merging are all one page each. Each one has layers and all are created using PDFLib.

Thanks,

MFM
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 12 Feb 23 at 5:14PM
perhaps you can do some experiments with MergeDocument or ExtractFilePages?
Perhaps with better results?

Cheers,
Ingo

Back to Top
fellafoo View Drop Down
Team Player
Team Player


Joined: 21 May 22
Location: Simsbury, CT
Status: Offline
Points: 21
Post Options Post Options   Thanks (0) Thanks(0)   Quote fellafoo Quote  Post ReplyReply Direct Link To This Post Posted: 12 Feb 23 at 8:04PM
I tried something like this, but the layers are gone.
if PDF_NewPDFLib(PDFLib, True) then begin
  i := 1;
  while (i <= Files2Merge.Count) do begin
    PDFLib.LoadFromFile(Files2Merge[i - 1], ''); { Load Existing File }
    PDFLib.SelectDocument(PDFLib.GetDocumentID(1)); { Select 'Blank' Document }
    PDFLib.CopyPageRanges(PDFLib.GetDocumentID(2), '1'); { Copy Page 1 from existing to 'blank' }
    PDFLib.RemoveDocument(PDFLib.GetDocumentID(2)); { Remove existing from list }
    Inc(i);
  end;
  PDFLib.DeletePages(1, 1); { Delete blank page }
  PDFLib.SaveToFile(MergeMaster);
end;
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 14 Feb 23 at 7:00PM
What you can do first is count the layers.
Second step: Copy your file as layercount times (5 layers means 6 copies cause it starts with 0 i think).
Third step: Remove from each file another layer.
Fourth step: Compare each file version after layer removed.
I don't know the value of this procedures but that's all (i think) what you can do with layers (contentstreams) using QuickPDF.

Cheers,
Ingo

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store