Adobe Sdk programmatically removing watermarks - adobe-pdf-library

I'm using Adobe PDF library (C++ Interface) and have been trying to remove the watermarks on an existing PDF for a while.
To add a watermark I have used the PDDocAddWatermarkFromText method, but I would need to remove the previously existing watermarks on the file.
I accomplished the task when the Watermark is added as an Annotation, but this will not cover all the possible cases, as it seems they can be added also as background Objects. Would need to know how these background objects can be removed from the file.
Thanks for help!

Well, it may prove difficult to clearly identify Watermarks that exist as purely text for removal instead of for example existing as a Watermark annotation. That being said if you can identify a pattern to how the watermarks are formatted it may be possible to devise a solution.
Have you attempted to contact the Support department for more assistance?

Watermarks will typically be the last element of the page's content stream, Backgrounds will the first element of the content stream. So I would check if the first or last element is a PDEForm. And if it is, I would then check if the PDEFormCosObj has a PieceInfo dictionary entry. The PieceInfo dictionary may indicate if it is a WaterMark or a Background.
Otherwise, you might need to analyze the content of that PDEForm for watermark-like properties (e.g. is it a Text Element with a single textRun? Does the Form|Text|TextRun's matrix indicate any rotation?)

Related

Get value within TV’s html attribute in Modx

I’m new to Modx so I don’t know if this is possible or not.
My TV, in this case [[*myTV]] outputs the following:
<data value='www.mylink.com'>Description</data>
Is there a way to only display the data value in the front-end? In this case I just want to display the url.
My recommendation would be to keep the data (in this case the URL) and the html separate, and that might help your situation. If the TV only includes the URL itself, then it makes it much easier to deal with the output of the TV using output modifiers. As an example, if [[*myTV]] contains www.mylink.com for a particular resource and you want the original output in your question, you could do something like:
[[*myTV:default=`<data value='[[*myTV]]'>Description</data>`]]
You can also nest TVs within output modifiers, so if for example you had a corresponding [[*description]] TV that describes the URL in [[*myTV]], you could use:
[[*myTV:default=`<data value='[[*myTV]]'>[[*description]]</data>`]]
TL;DR... The short version: Storing the entire output in the TV and extracting text from within that TV to output is much more difficult than storing individual components of that output in separate TVs and bringing them together for output when needed.
The longer version: In any situation where you're storing both data and HTML in a TV (which is not advisable in the vast majority of cases), you'll likely find duplication of your data across your project, and if by chance you decide to change the html at some point in the future, you then have to go into each and every TV field and change that HTML, which is the opposite effect from what a CMS is supposed to do - i.e. make Content Management easier!
If you do happen to find a use case for storing TVs along with their HTML formatting, that is a job best left for MODX Chunks, where you can code the implementation of your TVs within HTML in one spot within MODX and instead of duplicating that code everywhere, you reference the chunk like so: [[$chunk]].

setShared Causes Text to Layer and Look Terrible

We can have 4-5 people signing contracts at once, and are currently using the 'setShared' function to share text across all signing experiences for each client. However, when we use this, the text on the final contract comes out very blurry because the text layers get stacked on top of each other.
Sample text here:
I don't think setting Shared property is causing the problem. If you are setting the bold property on the tab then I suggest removing it. Also trying changing the font/fontSize properties to get the result you are expecting.

Load SVG files in Fabric.js without grouping

I am having an issue loading certain SVG files in Fabric.js without grouping its elements.
The screenshots on how the file is displayed on the canvas with and without grouping are shown. The used SVG file is part of the Fabric.js' SVG test collection used at http://fabricjs.com/test/svg_import:
With grouping:
Without grouping:
Both screenshots correspond to what it results when using the Fabric.js' kitchensink. However, I obtain the same results when writing my own program.
I have tried other files and they are shown with no problems whether the grouping is performed or not. Because of this, I suppose the distortions observed for this file on the non grouped version are due to some SVG elements (transformations or groups, perhaps?) that are not very well handled by the library's SVG parser.
Is it possible to avoid this issue under certain conditions? If so, what kind of SVG elements should be avoided to prevent files from presenting this problem?
This is a well known "missing feature" in fabric.js
https://github.com/kangax/fabric.js/issues/1520
The library is not handling very good the object with a "transformMatrix" property set.
the "transformMatrix" property comes from parsing the transform attribute of the elements and the parents elements.
Normally the objects are grouped in a pathGroup object that is capable of handling the transforMatrix and give a correct rendering with the downside effect the objects cannot be moved individually or rotated/scaled.
There is a work in progress about this feature (by me) to solve this but is not complete yet.
You can download and try my branch here:
https://github.com/asturur/fabric.js/tree/experimentalCBox
Is not perfect yet but is gonna be inserted in future fabric version to fix this issue.

Orchard Module Override a Field Driver

Hello fellow Orcharders!
I'm not sure if what I want to do is possible, but I want to override the Driver for a single Field in the Module I'm writing.
The Field I want more control over is the Content Picker field. Basically I want the Content Picker to load the shapes for their respective content items. I've looked at Sipke's Content Picker Widget for an example on how to load shapes, however I'm unsure of the best/recommended approach to implement something similar in my module.
I have the Content Picker Field attached to my Content Part, and the default Content Picker comma list of Content Item titles appears as expected. I have tried to define an Alternate in Placement.info, but I can't load the Content Item shapes from within the Alternate view.
Presumably, as per Sipke's example, these shapes need to be built in the Driver and passed along. If this is correct thing to do, how could I do this in the most Orchard-y way with minimal "hacks". Looking into the debugger, I could "hack" my way to the Field I need in my part's Driver; but the module I'm building will be reused in the future by people unfamiliar with it, and if they start adding/deleting Fields from the Content Part, I'd like everything to behave accordingly!
Of course, if I must take the "hacky" option, I'm willing to do so, but only after I've exhausted all other options. This is my first module, and I've learnt an incredible amount along the way, and I'm really trying to learn the "right" way to build an Orchard Module as best I can.
Thanks in advance!

Any way in Expression Engine to simulate Wordpress' shortcode functionality?

I'm relatively new to Expression Engine, and as I'm learning it I am seeing some stuff missing that WordPress has had for a while. A big one for me is shortcodes, since I will use these to allow CMS users to place more complex content in place with their other content.
I'm not seeing any real equivalent to this in EE, apart from a forthcoming plugin that's in private beta.
As an initial test I'm attempting to fake shortcodes by using delimited strings (e.g. #foo#) in the content field, then using a regex to pull those out and pass them to a function that can retrieve the content out of EE's database.
This brings me to a second question, which is that in looking at EE's API docs, there doesn't appear to be a simple means of retrieving the channel entries programmatically (thinking of something akin to WP's built-in get_posts function).
So my questions are:
a) Can this be done?
b) If so, is my method of approaching it reasonable? Or is there something stupidly obvious I'm missing in my approach?
To reiterate, my main objective here is to have some means of allowing people managing content to drop a code in place in their content that will be replaced with channel content.
Thanks for any advice or help you can give me.
Here's a simple example of the functionality you're looking for.
1) Start by installing Low Replace.
2) Create two Global Variables called gv_hello and gv_goodbye with the values "Hello" and "Goodbye" respectively.
3) Put this text into the body of an entry:
[say_hello]
Nice to see you.
[say_goodbye]
4) Put this into your template, wrapping the Low Replace tag around your body field.
{exp:low_replace
find="[say_hello]|[say_goodbye]"
replace="{gv_hello}|{gv_goodbye}"
multiple="yes"
}
{body}
{/exp:low_replace}
5) It should output this into your browser:
Hello
Nice to see you.
Goodbye
Obviously, this is a really simple example. You can put full blown HTML into your global variable. For example, we've used that to render a complex, interactive graphic that isn't editable but can be easily dropped into a page by any editor.
Unfortunately, due to parse order issues, EE tags won't work inside Global Variables. If you need EE tags in your short code output, you'll need to use Low Variables addon instead of Global Variables.
Continued from the comment:
Do you have examples of the kind of shortcodes you want to support/include? Because i have doubts if controlling the page-layout from a text-field or wysiwyg-field is the way to go.
If you want editors to be able to adjust layout or show/hide extra parts on the page, giving them access to some extra fields in the channel, is (imo) much more manageable and future-proof. For instance some selectfields, a relationship (or playa) field, or a matrix, to let them choose which parts to include/exclude on a page, or which entry from another channel to pull content from.
As said in the comment: i totally understand if you want to replace some #foo# tags with images or data from another field (see other answers: nsm-transplant, low_replace). But, giving an editor access to shortcodes and picking them out, is like writing a template-engine to generate ee-template code for the ee-template-engine.
Using some custom fields to let editors pick and choose parts to embed is, i think, much more manageable.
That being said, you could make a plugin to parse the shortcodes from a textareas content, and then program a lot, to fetch data from other modules you want to support. For channel entries you could build out of the channel data library by objectiveHTML. https://github.com/objectivehtml/Channel-Data
I hear you, I too miss shortcodes from WP -- though the reason they work so easily there is the ubiquity of the_content(). With the great flexibility of EE comes fewer blanket solutions.
I'd suggest looking at NSM Transplant. It should fit the bill for you.
There is also a plugin called Shortcode, which you can find here at
Devot-ee
A quote from the page:
Shortcode aims to allow for more dynamic use of content by authors and
editors, allowing for injection of reusable bits of content or even
whole pieces of functionality into any field in EE

Resources