Autodesk forge - markup extension - create new EditMode tool - autodesk-forge

This is very similar to the question posted here but nothing useful was mentioned.
I'm trying to look for documentation on how to create a new EditMode tool for the markup extension. Documentation is very scarce and I can't find the source code for markup extensions. The only thing I can find is here.
I'm trying to decipher this file: https://developer.api.autodesk.com/modelderivative/v2/viewers/7.*/extensions/Markup/Markup.js but it has a lot of webpack references and is hard to read.
Has anyone managed to create a custom EditMode tool?
Edit
A member of my team has managed to find the source for the markup extension:
https://autodeskviewer.com/viewers/latest/docs/extensions_Markup_core_Markup.js.html

Unfortunately, implementing a custom markup type is not officially supported today. The documentation you found (https://autodeskviewer.com/viewers/latest/docs/tutorial-feature_markup.html#create-a-new-drawing-tool-a-new-editmode) is not production ready.
Edit:
While I still believe the markup code is not ready for custom markup implementation, here's a work-in-progress, custom markup tool drawing smiley faces:
https://github.com/petrbroz/forge-basic-app/blob/sample/custom-markup/public/smiley-markup.js
In the sample app it is activated with a button click:
https://github.com/petrbroz/forge-basic-app/blob/sample/custom-markup/public/main.js#L11-L20
And here it is in action: https://imgur.com/a/2SFrGIM

Related

Fixing a PDF Accessibility Issue (Alternative description missing for an annotation) when converting an HTML Page to PDF

Currently, I am working on a program that converts an html page into a PDF using the iText Library.
The Checker that I am using is PAC3 -->PDF Accessibility Checker 3 which is described by the following link (https://section508.gov/blog/check-pdf).
One of the issues is the “Alternate description missing for an Annotation”
An excerpt from the following link explains it:
http://www.uottawa.ca/respect/sites/www.uottawa.ca.respect/files/fss-fixing-accessibility-errors-in-pdfs.pdf
Alternative description missing for an annotation This usually happens when the link is not clear enough. To fix this error, add alternative text to the link tags. To add the alternative text, please do the following;
In the tag tree, select the tag for the link, and select Properties
from the options menu.
In the Touchup Properties dialog box, select
the Tag Tab.
Type alternate text for the link, and click close
I have been trying to use iText to fix this problem, but googling, looking at the source and reading the documentation does not help.
Does anybody have any suggestions on how to either write the HTML or use the itext problem to get rid of the “Alternate description missing for an Annotation”
Thank you for your help
You did not specify whether you using old code (XMLWorker, HTMLWorker) or new iText code (pdfHTML).
This of course impacts the proposed solution.
In my answer I am going to assume you are using pdfHTML
There are several options:
edit the incoming HTML using a library like JSoup
convert the incoming HTML to iText IElement objects, and edit those, setting properties where needed
write your own custom TagWorker that handles all instances of a specific tag, and write custom logic to deal with the missing annotations.
An example of a custom tag worker can be found here:
https://developers.itextpdf.com/content/itext-7-examples/converting-html-pdf/pdfhtml-custom-tagworker-example

What HTML Language Code should I use for Sranantongo?

I need to add support to my application for a new language.
My application shows HTML webpages in an internal CHtmlView browser control.
I have looked through the language codes here for:
Sranantongo
But it is not listed. What language code should I use?
With one google search, i've found that Sranantongo is the speaking language of Suriname. Then i found on the page you gave the link :
SURINAME SR
I have now stumbled over this web page.
It appears more comprehensive.
It states:
So it looks like the right code is srn.

How to activate Javascript(Angularjs) variable intellisense in html

I have a variable in js. I want to get it from html page by intellisense.
js Code :
var buyer ="Addidas"; in js file.
Now I want to get it in html body as intellisense.
{{buyer}}
try to read `Angular official document,
In your AngularJS controller:
$scope.buyer = "Adidas";
In your html:
{{buyer}}
WARNING: You won't just know Angular once you have intellisense enabled, you will actual have to spend some effort learning it!!!
To enable intellisense follow these steps:
1) Learn Angular by reading the documentation, blog posts, looking at angular projects in Github and following the questions in this site.
2) Learn about unit testing Angular and write some tests.
3) Practice what you learn by doing a few small sites with tests.
4) Once you have done the basics and put the effort in to learn the technology you will realise that just because you use angular it will not give you intellisense in notepad.
5) Once you have this epiphany you could start using an IDE like WebStorm which offers intellisense in most Angular apps if your project is structured correctly.
http://blog.jetbrains.com/webstorm/2014/03/angularjs-workflow-in-webstorm/
There is no intellisense for templates in Visual Studio. Yet. There is a lot of interest in this, especially within the context of Typescript and angular.
More interesting than just having intellisense for templates would be having a build fail if the variable isn't used isn't in the scope.
Unfortunately none of this exists yet.

Dojo build requesting already inlined Dijit templates

I am a developer on a large Dojo project and I am having some issues with the Google Closure compiler.
We have around a hundred templates for Dijit widgets so the plan was to make the Closure compiler inline the HTML in the JavaScript file rather than require them AMD style.
To achieve this I changed the "mini" parameter in /profiles/app.profile.js from true to false.
When compiling, everything seems to work fine, even when running the app i have no issues but something strange happens.
Even if the HTML templates are correctly inlined in the dojo.js file, dojo is still making HTTP requests to the corresponding template file to the server !
By inspecting a "beautified" version of what the Closure Compiler produced I can observe that each HTML template is present in two different places :
1) Inlined in the JavaScript in the following format :
"url:path/to/my/template.html":"<p>Some more HTML</p>"
2) As a required pseudo-module in the AMD require :
dojo/text!./path/to/my/template.html
I searched the bug reports on their website in the BuildSystem category : BuildSystem but ultimately couldn't find any relevant help.
Is this me just wrongly using the Google Closure Compiler or is this a open / unreported bug ?
How can I fix this issue ?
Thanks a lot in advance !
If you are referring to an issue that only exists in 1.9.0, then it is https://bugs.dojotoolkit.org/ticket/17141.

Converting d3.js SVG code to a standalone program — Example?

Either with a headless browser, google filesytem API, or some other way.
This question says you can, but not how.
Converting d3.js SVG code to a standalone program -- any suggestions?
google groups has more hints, but no examples.
I've spent a bunch of time playing with the node-canvas example, as well as the phantomJS svg example. I can't figure out how to make them play together. Apparently in Linux, the x-windows Javascript rendering engine isn't very good anyway.
My API reading list of JavaScript, d3.js, SVG, CSS, and other HTML stuff is already mountainous - all I want to do is save a .svg image that I generate with d3.js.
Help, please.
This will neither be easy nor overtly complicated. Main reason being is that a web browser alone cannot save an SVG file from a DOM rendering, unless it's Chrome version 12.
Thing is that an SVG image is just a plain text file with a bunch of rendering instructions. The solution you point to basically says you would have to do this server side. Though they suggest node.js, you can do this in any server-side language you'd like.
Trick is to take your JavaScript/HTML interface, make it either keep track of all objects you create, or otherwise be able to serialize all of them, and then send that data (ex: via ajax) to a server-side program which would reconstitute that to an SVG file and offer it to be downloaded.
The challenge is that both your programs (client-side, javascript and server-side: php/etc.) will more or less have to re-implement SVG specifications to make this work and have common understanding as to how you serialized it for the transmission. There are virtually no stock components that do this for you.
There are some examples of using node().parentNode.innerHTML with 64B encoding, but I couldn't figure out how to use it.
https://groups.google.com/forum/?fromgroups#!topic/d3-js/aQSWnEDFxIc
The easiest solution I've found so far is FileSaver.js demo here:
http://eligrey.com/demos/FileSaver.js/
It uses the HTML5 filesaver interface.
I came across this today, I've not tried it but perhaps someone will find it useful:
https://github.com/d3-node/d3-node
const D3Node = require('d3-node')
const d3n = new D3Node() // initializes D3 with container element
d3n.createSVG(10,20).append('g') // create SVG w/ 'g' tag and width/height
d3n.svgString() // output: <svg width=10 height=20 xmlns="http://www.w3.org/2000/svg"><g></g></svg>