Can Adobe AIR display SVG? - air

I see that Adobe AIR uses WebKit as its render and I see that WebKit (at least the most current build) has some SVG support. Does this mean (and has anyone specifically tried) that an Adobe AIR application could render SVG on an HTML page?

On the offchance that it's helpful (and that you don't already know), Flex can embed SVG at runtime compile time, which effectively converts it to SWF format and embeds it as a resource.
[Embed(source="assets/frog.svg")]
[Bindable]
public var SvgAsset:Class;
More info at Adobe's embedding assets article.

If ActionScript 2: use the com.itechnica.svg (PathToArray) library to load SVGs at SWF runtime and display them (uses XML for SVG parsing):
Using SVG Path Data in Flash, Download button on the right pane.
If ActionScript 3: use the com.zavoo.svg (SvgPath) library to load SVGs at SWF runtime and display them (uses RegExp for SVG parsing):
Source code for SvgLoad and SvgDraw, Download button on the bottom-left.

No, according to the Adobe AIR Developer Center article What's new about HTML, HTML5, CSS, and JavaScript in AIR 2.5?.
SVG
Another feature that has received
a great deal of interest lately is
support for SVG. While present in
WebKit, the current version of Adobe
AIR does not support SVG.
The main reason for not including it
was runtime size concerns (adding it
would have increased the runtime size
by 15 to 20 percent). Initially, the
main pain-points regarding AIR were
the size of the runtime, integration
with the operating system and native
APIs, support for the tag and
new CSS properties, and JavaScript
performance. These priorities, coupled
with a trend toward reduced interest
in SVG graphics, led to SVG support
not being included in the current
version of Adobe AIR.
However, the renewed interest in rich
JavaScript applications powered by
HTML5 canvas and faster JavaScript
engines increased the number of
requests for scriptable vector
graphics via SVG. Thus, adding support
for SVG graphics may be considered for
the next version of AIR.

Adobe AIR can only support SVG once Adobe updates their version of WebKit (AIR's HTML rendering engine) and enables the SVG support within their version of WebKit. Might be a business decision not to (ie Flash).

Related

Creating React Native App with pdf annotation and sign on PDF Function

as I state on the title, I want to develop a project that having ability to open PDF file within the App (React Native), then later we can add annotation, notes, and sign on the PDF (put writing).
The pdf is from the server, so I assume we can call some kind of library that can open pdf and edit and have those features.
I tried browsing about it and found that PSPDFKit can be a solution, but the pricing is pretty much expensive. Is there any other library that can be use for this purpose?

Issue with sap.m.PDFViewer (1.48) on mobile devices

I am developing a Master-Detail application which should show an embedded PDF in its detail view. The project is based on UI5 version 1.48, so the new PDFViewer control can be used.
In desktop mode, everything works as expected:
But on a mobile screen, PDF is not showing properly:
The data source property binding at the PDFViewer is done by OData path.
<FlexBox id="fbPDFViewer"
direction="Column"
renderType="Div"
class="sapUiSmallMargin">
<PDFViewer id="idPDFViewer"
source="{myModel>/myPDFUrl}"
title=""
busy="true"
showDownloadButton="false"
height="700px"
width="95%"
loaded="onPDFLoaded"
errorMessage="{i18n>notFoundText}"
errorPlaceholderMessage="{i18n>notFoundText}">
</PDFViewer>
</FlexBox>
Even the SAP sample for embedded usage doesn't work on mobile devices.
According to the source code (1.48), the viewer renders its PDF document directly in the app / iframe only when ..:
The source is valid
It's coming from the same domain
It has a valid URI format
UI5 thinks the user is using a desktop computer (Device.system.desktop returns true) or the displayTypeapi, available since 1.58, is set to Embedded.
UI5 detects that the user agent (browser) has a certain type of PDF plugin enabled. Currently, there are no known mobile browsers which support displaying PDF documents directly in the page.
The steps 2 and 3 explain why the PDF is not rendered on a mobile device even if the source is valid. In such cases, I guess the only option is to provide a download option instead of trying to render the PDF forcefully in the mobile app.
You can use nabi.m.PDFViewer from the the nabi.m library. It works cross device, even on iOS (where you typically don't have the adobe PDF plugin). For details see https://github.com/nzamani/ui5-nabi-m
There you will find also how to try it out on localhost. I have also added some detailed instructions for deployment of the library to NW ABAP as well as SAP CP.
You can find live demos at http://ui5lab.io/browser/#/Samples/nabi.m/Sample/nabi.m.PDFViewer.PDFViewer and http://ui5lab.io/browser/#/Samples/nabi.m/Sample/nabi.m.PDFViewer.InPagePDFViewer
Open the two links on your iOS device or any other device to see how it looks like.
On mobile devices (smartphones and tablets), the PDF viewer control renders a toolbar with the title and a download icon, which behaves as a standard device/browser file link. We've made this note in Fiori Design Guidelines 1.48 and we'll add it to the SDK documentation.
(More in openui5 issue 1759 on GitHub)
Thank you for your responses and hints...
Installing an Adobe Acrobat viewer on the mobile devices was not an option here.
Source of the PDF had same domain like app itself and had a valid URI format too
Due to project timeline in meantime I decided to fall back to a solution that SAP provided with it's "Paystub" (Fiori 1.0). Therein they're using a 3rd-Party control for displaying PDF's which unfortunately has an overhead of code and implementations steps but it works (with minor issues only) perfect on desktop devices as well as on mobile devices.
So far, this is workaround solved my requirement.
Thanks.

Display PDF in browser (except pdf.js and Adobe Reader plugin)

I try to find solutions for display PDF in browser.
A couple of restrictions:
PDF should be downloaded to client as-is. Conversion like PDF -> HTML on server is not allowed.
Installation of additional software, like browser plugins is not allowed. But it is assumed, that user has widespread plugins, like Flash, Adobe reader ...
I know about next solutions:
Adobe Reader plugin.
PDF.js
FlexPaper (but not sure if it render pdf on on client side or convert PDF to series of Flash objects...)
What you can advice else?
== UPDATE
More possible solutions are:
Silverlight component
JavaApplet component

Add layer on top of existing SWF in Flash Pro

A project I'm involved in has a specific requirement where a layer must be added on top of an existing SWF. The SWF is created by converting a PDF using SWFTools pdf2swf. This layer will be used to add interactive elements like videos or sound on top of the existing text content in the SWF.
My problem is, when I try to import the SWF into Flash Pro, it sort of breaks up and it's not possible to see the SWF or its elements correctly.
I've tried making the SWF a MovieClip symbol after importing and called its play() and gotoAndPlay(i) methods to no avail. Using an external SWF with a loader works, but the SWF should be internal so the whole project can be compiled to iOS and Android in one go.
Are there any other methods I could use to interact with a SWF and make it work inside my FLA project?
Your problem is not in Flash but the way you're transforming the pdf to swf. The default parameters of pdf2swf will export the swf for a previous version of Flash, 6 to be exact. So you need to explicitly set the flash version when converting to a later version so that you can import it in your timeline (assuming u're using AS3).
Use this config option:
-T , --flashversion num Set Flash Version in the SWF header to num.
View this for more information:
http://wiki.swftools.org/index.php?title=Pdf2swf
http://wiki.swftools.org/index.php?title=Pdf2swf_-s_parameters

What do web browser engine use to render html?

I've always been wondering : What librairies/APIs are used by web browser engines (Gecko, WebKit ...) to render images, text, buttons & stuff ?
Think about it, webpages are rendered pixel by pixel identically across operating systems. Yet buttons, drop lists and text look native on most platforms.
The main are
Trident (IE and derivats)
Webkit (Safari, Chrome)
KHTML (KDE Konqueror) This was the base for webkit
Presto (Opera)
You can read more here: http://en.wikipedia.org/wiki/Web_browser_engine
These engines create an object structure of the HTML and then use Components to build the page, the browser engine does not render pixel by pixel but uses buttons, comboboxes, image elements all of which in them self render to a buffer and then those imagebuffers are collapsed to the screen.
Some engines use the plattforms own components (Trident) other use their own with different skins for different plattforms.
For actual rendering I know IE uses windows controlls and Gecko as you noted uses Cairo.
I assume webkit might use gtk or qt but I am not sure and for opera I have no idea but I assume they use some form of framework or toolkit.