Background Color:
 
Background Pattern:
Reset
Search

Forum

Please Log In

We want you to contribute! 

This forum is a moderated environment. 
We try to keep it neat and tidy. In order to access the forum content we would like you to either or register.

HomeHomeScryberScryberDevelopment Que...Development Que...Find Components by class instead of idFind Components by class instead of id
Previous
 
Next
New Post
4/21/2017 7:33 PM
 

Once I use the following code:

 

using (PDFDocument doc = Scryber.Components.PDFDocument.ParseDocument(XmlFileName))

{

((Scryber.Components.PDFComponent)doc.FindAComponentById("divContainerToHide")).Visible = false;

}

it only hides the very first occuring DIV with that mentioned ID while I got more of these in my XML.

Is there any way to hide it by telling my C# code that every DIV with a style class named "divContainerToHide" shall be hidden?

 
New Post
4/21/2017 9:27 PM
 

Hi Dougy

There is no 'jquery' type of selector in scryber, and the Visible property is not style based (I know - but we use it well before the styles are built).

However, one thing you can look at is setting the style definition that should be applied dynamically rather than the property.

 

If your div is assigned a class e.g.

<pdf:div style:class="existing-class  hide-me" > My content to hide </pdf:div>

 

Then in the code generation, when required, you can create a new PDFStyleDefinition for 'hide-me' and position the divs off the page content.

PDFStyleDefn hidden = new PDFStyleDefn();
hidden.AppliedClass="hide-me";
hidden.PositionMode = Scryber.Drawing.PositionMode.Absolute;
hidden.Overflow.Action = Scryber.Drawing.OverflowAction.Truncate;
hidden.Position.X = 5000; //Enough to move it off the page
doc.Styles.Add(hidden);

This should work

 

Richard

 
New Post
4/26/2017 2:50 PM
 

Thank you, Richard.

 
Previous
 
Next
HomeHomeScryberScryberDevelopment Que...Development Que...Find Components by class instead of idFind Components by class instead of id