best pdf viewer control for asp.net : View pdf thumbnails in software control dll windows web page .net web forms QC2_yf_reviewed49-part969

}
...
private function fill_onClick():void {
visitDataCollection.fill(username.text);
visitCollection.fill(username.text);
}
This code populates two collections (
visitCollection
and 
visitDataCollection
) by
bringing the salesman’s (username.text) data from the server. For example, after logon,
Liz Anthony will see only her schedule of visits.
The 
visitCollection
object will participate in data synchronization with a remote da-
tabase server, as it has to keep the table visits up to date.
The 
visitDataCollection
object brings the data from the 
visit_schedule
data plus the
comments field from the table 
visits
. This collection doesn’t need be synchronized,
as the 
visit_schedule
table is being taken care of by a dispatcher of the corporation
Acme Pharm.
You’ll get familiar with the code of the class 
OfflineDataCollection
later in this chapter,
but for now suffice it to say that its function 
fill()
will retrieve all the data from a Java
class that is configured in the remoting-config.xml file of BlazeDS (or LCDS).
For example, the following code creates an instance of 
OfflineDataCollection
that’s
ready to work with the server-side destination 
com.faratasystems.demo.pharmasales
.
Visit:
visitCollection = new
OfflineDataCollection("com.farata.demo.pharmasales.Visit",
"getVisitsBySalesman", VisitDTO)
In general, an application developer needs to decide which DTOs are to be saved in the
local  storage  and  specify  them  while  instantiating  one  or  more
OfflineDataCollection
objects.
The function 
initCollection()
assigns an event listener to the 
visitCollection
just to
display the current status of the data on the UI (e.g., the data is saved in the local
database).
The call of the method 
fill()
on 
OfflineDataCollection
gets converted by BlazeDS to
a server-side call to Java’s method 
getVisitBySalesman()
, which returns instances of
the 
VisitDTO
objects with the information about the visits of the salesperson. The first
argument of the 
OfflineDataCollection
constructor is the name of the remote desti-
nation, the second one is the name of the method to call, and the third one is the type
of the ActionScript DTOs arriving to the client.
When the user logs on to the PharmaSales application, his computer doesn’t have any
local databases. The local database is being created during the first call to the method
fill()
, described in the section on 
OfflineDataCollection
.
PharmaSales Application | 471
View pdf thumbnails in - Draw thumbnail images for PDF in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Support Thumbnail Generation with Various Options for Quick PDF Navigation
enable pdf thumbnails; how to show pdf thumbnails in
View pdf thumbnails in - VB.NET PDF Thumbnail Create SDK: Draw thumbnail images for PDF in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
Support Thumbnail Generation with Various Options for Quick PDF Navigation
pdf preview thumbnail; pdf files thumbnail preview
Open your application storage directory after running the application for the very first
time, and you’ll find there a file called local.db (in Windows, it’s C:\Documents and
Settings\Administrator\Application Data\PharmaSales\Local Store). This database is not
a copy of all the tables of the remote database—it stores only the data arrived in the
form of DTOs from the server.
As you continue using the application, you’ll find yet another file in the same directory.
The file local.db.bak is a backup copy of the local.db file created when you modified
the data in a disconnected mode.
You’ll better understand when, how, and why these databases are created after reading
the next section of this chapter, which describes the class 
OfflineDataCollection
. At
this point, just remember that after the method 
fill()
is complete, you have two da-
tabases that store application-specific DTOs on your local computer.
When the user starts working with the application, he needs to be able to save and sync
the data with the remote server, which is done in the PharmaSales application in the
function 
onSave()
:
visitCollection.sync();
visitDataCollection.updateLocalDB(); // update visit comments
visitDataCollection.backUp();
visitDataCollection.resetState();
You sync only the data from the 
visitCollection
here, as it represents the data from
the remote table 
visits
.
The 
visitDataCollection
object represents the remote table 
visit_schedule
, which is
not being changed by the salesman and hence doesn’t need to be synchronized. You
call  the  function 
backup()
here  just  to  make  the  database  tables  supporting
visitDataCollection
identical in the main and backup database.
Example 9-12 contains the complete code of the file PharmaSales.mxml. This applica-
tion was initially generated by Clear Data Builder, as explained in Chapter 1. In addition
to generating all the code for Flex and Java, it includes such functionality as master/
detail relationships.
When the user clicks on the visit row in the 
DataGrid
, the detail screen where the sales-
man  enters  visit  details  opens  up.  This  application  uses  the 
DataForm
and
DataFormItem
components described in Chapter 6.
The UI portion of the PharmaSales application contains a 
ViewStack
component that
wraps the following views:
• Logon
• Grid with visits
• Visit details
• Google Map
472 | Chapter 9: Working with Adobe AIR
C# HTML5 PDF Viewer SDK to view PDF document online in C#.NET
Ability to show PDF page thumbnails for quick navigation. Easy to search PDF text in whole PDF document. C# HTML5 PDF Viewer: View PDF Online.
pdf thumbnail html; enable pdf thumbnails in
VB.NET PDF- View PDF Online with VB.NET HTML5 PDF Viewer
Ability to show PDF page thumbnails for quick navigation. Easy to search PDF text in whole PDF document. VB.NET HTML5 PDF Viewer: View PDF Online.
pdf thumbnail generator; generate pdf thumbnails
Example 9-12. PharmaSales.mxml
<?xml version="1.0" encoding="UTF-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:fx="http://www.faratasystems.com/2008/components" width="800" height="600"
xmlns:controls="com.farata.controls.*" backgroundColor="white" xmlns:ns1="*">
<mx:ViewStack id="vs" height="100%" width="100%">
<!--   Logon view   -->
<mx:Canvas height="100%" width="100%">
<mx:Panel title="Pharma Sales - Salesman" width="100%"
verticalAlign="middle" horizontalAlign="center" height="100%"
backgroundImage="assets/PillHand.png">
<mx:Form>
<mx:FormItem label="Username:" required="true">
<mx:TextInput id="username" text="Liz Anthony" maxChars="16"/>
</mx:FormItem>
<mx:FormItem label="Password:" required="true">
<mx:TextInput id="password" text="p455w0rd" maxChars="16"
displayAsPassword="true"/>
</mx:FormItem>
</mx:Form>
<mx:ControlBar horizontalAlign="right">
<ns1:NetworkStatus/>
<mx:Button id="logon" label="Logon" click="onLogon()"/>
<mx:Button id="reset" label="Reset" click="onReset()"/>
</mx:ControlBar>
</mx:Panel>
</mx:Canvas>
<!--   Data grid view with visits  -->
<mx:Canvas height="100%" width="100%">
<mx:Panel title="Pharma Sales - Salesman" width="100%" height="100%">
<fx:DataGrid toolTip="Double click for details"
doubleClick="onDoubleClick()" doubleClickEnabled="true"
horizontalScrollPolicy="auto" width="100%" id="dg"
dataProvider="{visitDataCollection}" editable="true" height="100%">
<fx:columns>
<fx:DataGridColumn dataField="fullname" editable="false"
headerText="Salesman"/>
<fx:DataGridColumn dataField="fulladdress"
editable="false" headerText="Address" width="150"/>
<fx:DataGridColumn dataField="scheduled_date" editable="false"
headerText="Scheduled Date" itemEditor="mx.controls.DateField"
editorDataField="selectedDate" formatString="shortDate"/>
<fx:DataGridColumn dataField="comments" editable="false"
headerText="Comments"/>
</fx:columns>
</fx:DataGrid>
<mx:ControlBar horizontalAlign="right">
<ns1:NetworkStatus id="network"/>
<mx:Button enabled="{dg.selectedIndex != -1 &&
(network.googleMapsConnected || hasMapImage())}"
click="googleMap_onClick()" label="Google Map"/>
<mx:Button enabled="{!visitCollection.commitRequired &&
!visitCollection.syncRequired}"
PharmaSales Application | 473
VB.NET PDF - View PDF with WPF PDF Viewer for VB.NET
Easy to search PDF text in whole PDF document in VB.NET WPF program. PDF thumbnails for navigation in .NET project. VB.NET WPF PDF Viewer: View PDF Document.
view pdf thumbnails in; view pdf thumbnails
C# WPF PDF Viewer SDK to view PDF document in C#.NET
Users can view any page by using view page button. Easy to search PDF text in whole PDF document. PDF thumbnails for navigation in .NET WPF Console application.
view pdf image thumbnail; enable thumbnail preview for pdf files
click="fill_onClick()" label="Retrieve"/>
<mx:Button enabled="{ visitCollection.commitRequired ||
visitCollection.syncRequired}" click="onSave()"
label="{visitCollection.commitRequired?'Save':'Sync'}"/>
<mx:Button click="vs.selectedIndex=0;" label="Log out"/>
</mx:ControlBar>
</mx:Panel>
</mx:Canvas>
<!--   Visit detail view -- >
<mx:Canvas>
<mx:Panel width="100%" height="100%" title="Visit Details">
<fx:DataForm dataProvider="{dg.selectedItem}">
<fx:DataFormItem dataField="fullname" label="Salesman:"
enabled="false"/>
<fx:DataFormItem dataField="fulladdress" label="Address:"
enabled="false"/>
<fx:DataFormItem dataField="scheduled_date" label="Scheduled
Date:" formatString="shortDate" enabled="false"/>
</fx:DataForm>
<fx:DataForm dataProvider="{visit}" width="100%">
<fx:DataFormItem dataField="visit_date" label="Visit Date:"
formatString="shortDate"/>
<fx:DataFormItem dataField="contact_name"
label="Contact   Name:" width="100%"/>
<fx:DataFormItem dataField="comments" label="Comments:"
width="100%">
<mx:TextArea width="100%" height="100"/>
</fx:DataFormItem>
</fx:DataForm>
<mx:ControlBar horizontalAlign="right">
<ns1:NetworkStatus/>
<mx:Button label="Back" click=
"vs.selectedIndex=1;updateVisitSchedule(dg.selectedItem)"/>
</mx:ControlBar>
</mx:Panel>
</mx:Canvas>
<!--   Google Maps integration view-->
<mx:Canvas>
<mx:Panel width="100%" height="100%" title="Google Map">
<maps:Map xmlns:maps="com.google.maps.*" id="map"
mapevent_mapready="onMapReady(event)" width="100%" height="100%"
key="ABQIAAAAthGneZS6I6ekX8SgzwL2HxSVN_sXTad_Y..."
url="http://code.google.com/apis/maps/"/>
<mx:ControlBar horizontalAlign="right">
<ns1:NetworkStatus/>
<mx:Button click="saveMap()" label="Save"/>
<mx:Button click="vs.selectedIndex=1;" label="Back"/>
</mx:ControlBar>
</mx:Panel>
</mx:Canvas>
<!--   Saved Google map view-->
<mx:Canvas>
474 | Chapter 9: Working with Adobe AIR
C# PDF Convert to Jpeg SDK: Convert PDF to JPEG images in C#.net
Support of converting from any single one PDF page and multiple pages. Thumbnails can be created from PDF pages. Support for customizing image size.
pdf thumbnail fix; pdf file thumbnail preview
VB.NET PDF File Compress Library: Compress reduce PDF size in vb.
Reduce image resources: Since images are usually or large size, images size reducing can help to reduce PDF file size effectively. Embedded page thumbnails.
show pdf thumbnails in; print pdf thumbnails
<mx:Panel id="map_image" width="100%" height="100%"
title="Google Map">
<mx:Image id="saved_map" width="100%" height="100%"
creationComplete="openMapImage()"/>
<mx:ControlBar horizontalAlign="right">
<ns1:NetworkStatus/>
<mx:Button click="vs.selectedIndex=1;" label="Back"/>
</mx:ControlBar>
</mx:Panel>
</mx:Canvas>
</mx:ViewStack>
<mx:Script>
<![CDATA[
import com.google.maps.overlays.Marker;
import com.google.maps.InfoWindowOptions;
import com.google.maps.LatLng;
import com.google.maps.services.ClientGeocoder;
import mx.graphics.codec.PNGEncoder;
import com.google.maps.controls.ZoomControl;
import com.farata.demo.pharmasales.dto.VisitDataDTO;
import com.farata.demo.pharmasales.dto.VisitDTO;
import com.farata.collections.OfflineDataCollection;
import com.google.maps.services.GeocodingEvent;
import mx.events.PropertyChangeEvent;
[Bindable]
public var visitDataCollection:OfflineDataCollection;
[Bindable]
public var visitCollection:OfflineDataCollection;
[Bindable]
public var visit:VisitDTO;
private function onSave():void {
visitCollection.sync();
visitDataCollection.updateLocalDB();
visitDataCollection.backUp();
visitDataCollection.resetState();
}
private function onDoubleClick():void {
if (dg.selectedItem){
vs.selectedIndex=2;
calculateVisit(dg.selectedItem);
}
}
private function updateVisitSchedule(obj:Object):void {
var dto:VisitDataDTO=obj as VisitDataDTO;
dto.comments=visit.comments;
}
private function calculateVisit(obj:Object):void {
var dto:VisitDataDTO=obj as VisitDataDTO;
for(var i:int=0; i < visitCollection.length; i++){
PharmaSales Application | 475
C# PDF File Compress Library: Compress reduce PDF size in C#.net
by large enterprises and organizations to distribute and view documents. size, images size reducing can help to reduce PDF file size Embedded page thumbnails.
create pdf thumbnail; generate pdf thumbnail c#
C# PDF Convert to Images SDK: Convert PDF to png, gif images in C#
Converter control easy to create thumbnails from PDF pages. Selection for compressing to multiple image formats. Cut and paste any areas in PDF pages to images.
no pdf thumbnails in; generate thumbnail from pdf
var visitDto:VisitDTO=visitCollection[i]as VisitDTO;
if (dto.id == visitDto.visit_schedule_id) {
visit=visitDto;
return ;
}
}
visit=new VisitDTO();
visit.visit_schedule_id=dto.id;
visitCollection.addItem(visit);
}
private function initCollections():void {
visitCollection=new OfflineDataCollection(
"com.farata.demo.pharmasales.Visit",
"getVisitsBySalesman", VisitDTO);
visitCollection.addEventListener(
PropertyChangeEvent.PROPERTY_CHANGE, showStatus);
visitDataCollection=new OfflineDataCollection(
"com.farata.demo.pharmasales.VisitData",
"getVisitDataBySalesman", VisitDataDTO);
fill_onClick();
}
private function showStatus(evt:PropertyChangeEvent):void {
if (evt.property == "statusMessage"){
status=evt.newValue as String;
}
}
private function fill_onClick():void {
visitDataCollection.fill(username.text);
visitCollection.fill(username.text);
}
private function googleMap_onClick():void {
if (network.googleMapsConnected) {
cursorManager.setBusyCursor();
vs.selectedIndex=3;
showAddress();
}
else {
vs.selectedIndex=4;
openMapImage();
}
}
private function onLogon():void {
initCollections();
vs.selectedIndex=1;
}
private function onReset():void {
username.text="Liz Anthony";
}
476 | Chapter 9: Working with Adobe AIR
private function onMapReady(event:Event):void {
map.setZoom(20);
showAddress();
}
private function deleteMap():void {
var dto:VisitDataDTO=dg.selectedItem as VisitDataDTO;
var file:File= File.applicationStorageDirectory.resolvePath(
dto.fulladdress + ".png");
if (file.exists){
file.deleteFile();
}
}
private function saveMap():void {
deleteMap();
var bd:BitmapData=new BitmapData(map.width, map.height);
bd.draw(map);
var pngEncoder:PNGEncoder=new PNGEncoder();
var ba:ByteArray=pngEncoder.encode(bd);
var dto:VisitDataDTO=dg.selectedItem as VisitDataDTO;
var file:File=
File.applicationStorageDirectory.resolvePath(
dto.fulladdress + ".png");
var fileStream:FileStream=new FileStream();
fileStream.open(file, FileMode.WRITE);
fileStream.writeBytes(ba);
fileStream.close();
status="Google map image is saved to '" + file.nativePath + "'";
}
private function openMapImage():void {
if (saved_map && saved_map.initialized){
var dto:VisitDataDTO=dg.selectedItem as VisitDataDTO;
var file:File=
File.applicationStorageDirectory.resolvePath(
dto.fulladdress + ".png");
saved_map.source=file.nativePath;
map_image.title="Displaying '" + file.name + "'";
}
}
private function hasMapImage():Boolean
{
var dto:VisitDataDTO=dg.selectedItem as VisitDataDTO;
var file:File= File.applicationStorageDirectory.resolvePath(
dto.fulladdress + ".png");
return file.exists;
}
private function showAddress():void {
if (map && map.initialized){
var cg:ClientGeocoder=new ClientGeocoder();
cg.addEventListener(
GeocodingEvent.GEOCODING_SUCCESS, onGeocodeSuccess);
PharmaSales Application | 477
var dto:VisitDataDTO=dg.selectedItem as VisitDataDTO;
cg.geocode(dto.fulladdress);
}
}
private function onGeocodeSuccess(event:GeocodingEvent):void{
cursorManager.removeBusyCursor();
var point:LatLng=event.response.placemarks[0].point as LatLng;
var marker:Marker=new Marker(point);
map.addOverlay(marker);
map.setCenter(point);
var dto:VisitDataDTO=dg.selectedItem as VisitDataDTO;
var opt:InfoWindowOptions=new InfoWindowOptions();
opt.drawDefaultFrame=true;
opt.contentHTML=dto.fulladdress;
marker.openInfoWindow(opt);
}
]]>
</mx:Script>
</mx:WindowedApplication>
OfflineDataCollection
The 
Clear 
component 
library 
includes 
class
com.farata.collections.OfflineDataCollection
, which is a descendant of 
DataCollec
tion
, described in Chapter 6. The class 
OfflineDataCollection
is responsible for per-
forming data synchronization between the local and remote databases.
If the network connection is available, the method 
fill()
gets the data from the server
and the application creates the backup copy of the existing local database and creates
a fresh one:
public override function fill(... args):AsyncToken {
var changes:Array=getChangesFromLocalDB();
syncRequired=changes.length > 0;
if (!commitRequired && !syncRequired) {
var act:AsyncToken=invoke(method, args);
act.method="fill";
return act;
}else{
fillFromLocalDB();
}
return null;
}
This function starts with getting the data from the local database. If this is the very first
invocation, the array 
changes
will be empty and no other function calls will be made.
If no modifications were made in the data grid with visit information and no un-
synchronized changes exist in the local database, this function will just retrieve the data
from the remote destination using 
DataCollection
’s 
invoke()
method.
478 | Chapter 9: Working with Adobe AIR
How  does 
OfflineDataCollection
know  that  there  are  local  changes  to  be
synchronized? Each instance of 
OfflineDataCollection
persists its data in a database
table. When the application calls the function 
OfflineDataCollection.backup()
, it cop-
ies this table to a backup database.
Comparing the content of the corresponding tables in the main and backup databases
allows the application to find out whether the data is different, or in other words,
whether data synchronization is required.
If the network connection is not available, the method 
fill()
will get the visits data
from the local database.
The 
class 
OfflineDataCollection
uses 
helper 
class
com.farata.collections.LocalDBHelper
for all database operations. You can find the
source code of this class in the Clear Toolkit project com.farata.components at the
SourceForge code repository; see http://sourceforge.net/projects/cleartoolkit/.
When the connection is restored, the 
OfflineDataCollection
object can synchronize
the data in both directions: from the local storage to the server and back.
The property 
commitRequired
specifies whether the local data were modified and should
be synchronized with the server.
Example 9-13 contains the complete code of OfflineDataCollection.as. (Note that com-
ments and import statements were removed in the interest of space.)
Example 9-13. OfflineDataCollection.as
package com.farata.collections {
[Event(name="result", type="mx.rpc.events.ResultEvent")]
[Event(name="fault", type="mx.rpc.events.FaultEvent")]
[Event(name="propertyChange", type="mx.events.PropertyChangeEvent")]
[Bindable(event="propertyChange")]
public class OfflineDataCollection extends DataCollection
{
private var _dtoClass:Class;
private var _syncRequired:Boolean;
public function OfflineDataCollection(destination:String=null,
method:String=null, dtoClass:Class=null){
this.destination=destination;
this.method=method;
this.dtoClass=dtoClass;
}
public function get syncRequired():Boolean
{
return _syncRequired;
}
OfflineDataCollection | 479
public function set syncRequired(value:Boolean):void{
var oldValue:Boolean=_syncRequired;
if (oldValue != value){
_syncRequired=value;
dispatchEvent(PropertyChangeEvent.createUpdateEvent(this,
"syncRequired", oldValue, value));
}
}
public function get dtoClass():Class{
return _dtoClass;
}
public function set dtoClass(dtoClass:Class):void{
_dtoClass=dtoClass;
}
public function set doFill(bFill:Boolean):void{
if (bFill){
fill();
}
}
public override function fill(... args):AsyncToken{
var changes:Array=getChangesFromLocalDB();
syncRequired=changes.length > 0;
if (!commitRequired && !syncRequired){
var act:AsyncToken=invoke(method, args);
act.method="fill";
return act;
}
else {
fillFromLocalDB();
}
return null;
}
public override function sync():AsyncToken {
updateLocalDB();
commitRequired = false;
var act:AsyncToken=syncOfflineChanges();
return act;
}
public function updateLocalDB():void {
var conn:SQLConnection=LocalDBHelper.openDBConnection();
try {
for(var i:int=0; i < deletes.length; i++) {
LocalDBHelper.deleteDTO(conn, destination, method,
deletes[i].previousVersion);
}
for(i=0; i < inserts.length; i++){
LocalDBHelper.insertDTO(conn, destination, method,
inserts[i].newVersion);
480 | Chapter 9: Working with Adobe AIR
Documents you may be interested
Documents you may be interested