Print Page | Close Window

Removing Layer Based on Content Group

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1549
Printed Date: 27 Jan 26 at 7:01AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Removing Layer Based on Content Group
Posted By: Luke
Subject: Removing Layer Based on Content Group
Date Posted: 22 Aug 10 at 1:21AM
I am trying to be able to Add and Remove Watermarks.

Currently I can add a Watermark with the following code:

  Result := FPDF.NewLayer;
  FPDF.DrawText( 100, 400, AWaterMark );
  iContentGroup := FPDF.NewOptionalContentGroup( 'WaterMark' );
  FPDF.SetLayerOptional( iContentGroup );

Now I want to be able to remove all Layers associated with the ContentGroup 'WaterMark'. I see how to find that group with 
    for i := 1 to FPDF.GetOptionalContentConfigCount do begin
      if  FPDF.GetOptionalContentGroupName( FPDF.GetOptionalContentGroupID( i ) ) ) = 'WaterMark' then begin
         // Find Layers associated with this Content Group
      end;
    end;

How do I find all the layers linked to that Content Group? TIA.


-------------
Luke M. Miller

ResCorSoft, Inc.



Replies:
Posted By: Luke
Date Posted: 25 Aug 10 at 5:17AM
Any thoughts?

-------------
Luke M. Miller

ResCorSoft, Inc.


Posted By: Ingo
Date Posted: 25 Aug 10 at 6:38AM
Hi Luke!

Only in very general terms ...
1. NewOptionalContentGroup...
2. GetOptionalContentGroup...
3. You have to set a new layer.
4. You have to select this layer.
5. Make your drawings (perhaps with transparency... looks better)...
6. Save...
7. ...
The problem could be that later after new loading you don't know the contentgroup-id anymore.
My idea: With QuickPDF you can create own custom fields in the pdf. There you could save the contentgroup-id to be read out later.

Only thoughts...

Cheers, Ingo



Posted By: Luke
Date Posted: 25 Aug 10 at 4:53PM
Thanks though I'm not sure I understand. After new loading can't I figure out what the content group id by looping through the content groups checking for  the Group Name that matches. 

  if  FPDF.GetOptionalContentGroupName( FPDF.GetOptionalContentGroupID( i ) ) ) = 'WaterMark' then begin
    // Find Layers associated with this Content Group
  end;

To help me understand, what's the point of assigning a layer to a content group if you cannot then find the all the layers of a particular content group?


-------------
Luke M. Miller

ResCorSoft, Inc.


Posted By: Ingo
Date Posted: 26 Aug 10 at 6:36AM
Hi!

Do it this way and you have the id:
...
The problem could be that later after new loading you don't know the contentgroup-id anymore.
My idea: With QuickPDF you can create own custom fields in the pdf. There you could save the contentgroup-id to be read out later.
...
Cheers, Ingo



Posted By: Luke
Date Posted: 26 Aug 10 at 3:31PM
I'm sorry if I am not explaining myself well. This is my first time working with PDF's in code.Embarrassed 

Since I already know the name of the Content Group, I can find the Content Group ID.  I have enough control over the PDF's so don't really need to worry about someone else adding a content group with the same name.

My problem is after I get the contentgroup-id, either from a custom field or by searching all the Content Groups for a specific name. How do I find the layers that I associated with content group? When I originally added my watermark, I associated that layer with the code:
 iContentGroup := FPDF.NewOptionalContentGroup( 'WaterMark' );
 FPDF.SetLayerOptional( iContentGroup );
So, now I need to go backwords and find  Layer(s) that I associated with that group.

Hope I explained it better this time.Smile



-------------
Luke M. Miller

ResCorSoft, Inc.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk