Skip to content

Commit

Permalink
Update DotNET Core Samples, num 5
Browse files Browse the repository at this point in the history
Used vendor review tool to find and remove unecessary and redundant code
from sample programs.
  • Loading branch information
datalogics-mdawson committed Aug 27, 2020
1 parent 5fe596e commit 9d29ebe
Show file tree
Hide file tree
Showing 72 changed files with 360 additions and 314 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using Datalogics.PDFL;

/*
Expand Down Expand Up @@ -29,6 +27,7 @@ static void Main(string[] args)
{
Console.WriteLine("AnnotationCopyPaste Sample:");

// ReSharper disable once UnusedVariable
using (Library lib = new Library())
{
Console.WriteLine("Initialized the library.");
Expand Down Expand Up @@ -81,6 +80,7 @@ static void Main(string[] args)
// copy/paste the annotation, in either case the message in
// the exception will specify which operation (copy or paste)
// that it could not complete.
// ReSharper disable once UnusedVariable
LinkAnnotation copiedLink = ((LinkAnnotation)ann).CopyTo(destinationPage, linkCenter);
}
catch (ApplicationException ae)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using Datalogics.PDFL;

/*
Expand All @@ -24,6 +22,7 @@ static void Main(string[] args)
{
Console.WriteLine("Annotations Sample:");

// ReSharper disable once UnusedVariable
using (Library lib = new Library())
{
Console.WriteLine("Initialized the library.");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using Datalogics.PDFL;

/*
Expand All @@ -25,6 +23,7 @@ static void Main(string[] args)
{
Console.WriteLine("FlashAnnotCreate Sample:");

// ReSharper disable once UnusedVariable
using (Library lib = new Library())
{
Console.WriteLine("Initialized the library.");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Text;
using Datalogics.PDFL;


Expand All @@ -23,9 +22,10 @@ namespace InkAnnotations
{
class InkAnnotations
{
static void Main(string[] args)
static void Main()
{
Console.WriteLine("InkAnnotations Sample:");
// ReSharper disable once UnusedVariable
using (Library lib = new Library())
{
Console.WriteLine("Initialized the library.");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using Datalogics.PDFL;

/*
Expand All @@ -17,6 +15,7 @@
* http://dev.datalogics.com/adobe-pdf-library/license-for-downloaded-pdf-samples/
*
*/
// ReSharper disable once CheckNamespace
namespace LinkAnnotations
{
class LinkAnnotations
Expand All @@ -25,6 +24,7 @@ static void Main(string[] args)
{
Console.WriteLine("LinkAnnotations Sample:");

// ReSharper disable once UnusedVariable
using (Library lib = new Library())
{
Console.WriteLine("Initialized the library.");
Expand All @@ -49,24 +49,24 @@ static void Main(string[] args)
// Test some link features
newLink.NormalAppearance = newLink.GenerateAppearance();

Console.WriteLine("Current Link Annotation version = " + newLink.AnnotationFeatureLevel.ToString());
Console.WriteLine("Current Link Annotation version = " + newLink.AnnotationFeatureLevel);
newLink.AnnotationFeatureLevel = 1.0;
Console.WriteLine("New Link Annotation version = " + newLink.AnnotationFeatureLevel.ToString());
Console.WriteLine("New Link Annotation version = " + newLink.AnnotationFeatureLevel);

// Test the destination setting
ViewDestination dest = new ViewDestination(doc, 0, "XYZ", doc.GetPage(0).MediaBox, 1.5);

dest.DestRect = new Rect(0.0, 0.0, 200.0, 200.0);
Console.WriteLine("The new destination rectangle: " + dest.DestRect.ToString());
Console.WriteLine("The new destination rectangle: " + dest.DestRect);

dest.FitType = "FitV";
Console.WriteLine("The new fit type: " + dest.FitType);

dest.Zoom = 2.5;
Console.WriteLine("The new zoom level: " + dest.Zoom.ToString());
Console.WriteLine("The new zoom level: " + dest.Zoom);

dest.PageNumber = 1;
Console.WriteLine("The new page number: " + dest.PageNumber.ToString());
Console.WriteLine("The new page number: " + dest.PageNumber);

newLink.Destination = dest;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Text;
using Datalogics.PDFL;


Expand All @@ -23,6 +22,7 @@ class PolyLineAnnotations
static void Main(string[] args)
{
Console.WriteLine("PolyLineAnnotation Sample:");
// ReSharper disable once UnusedVariable
using (Library lib = new Library())
{
Console.WriteLine("Initialized the library.");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Text;
using Datalogics.PDFL;


Expand All @@ -23,6 +22,7 @@ class PolygonAnnotations
static void Main(string[] args)
{
Console.WriteLine("PolygonAnnotation Sample:");
// ReSharper disable once UnusedVariable
using (Library lib = new Library())
{
Console.WriteLine("Initialized the library.");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System;
using System.Collections.Generic;
using System.Text;
using Datalogics.PDFL;

namespace AddElements
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using Datalogics.PDFL;

namespace AddElements
Expand All @@ -24,20 +22,20 @@ public override int GetDuration()
return duration;
}

public override void SetDuration(int duration)
public override void SetDuration(int newDuration)
{
this.duration = duration;
this.duration = newDuration;
}

public override int GetCurrentValue()
{
return currentValue;
}

public override void SetCurrentValue(int currentValue)
public override void SetCurrentValue(int newValue)
{
this.currentValue = currentValue;
Console.Write(currentValue * 100 / duration);
this.currentValue = newValue;
Console.Write(newValue * 100 / duration);
Console.Write("%...");
Console.Out.Flush();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using Datalogics.PDFL;

namespace AddElements
Expand All @@ -26,7 +24,7 @@ public override void Call(ReportType reportType, string message, string replacem
{
if (replacementText != null)
{
message.Replace("%s", replacementText);
message = message.Replace("%s", replacementText);
}
Console.WriteLine(message);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Text;
using Datalogics.PDFL;

/*
Expand All @@ -25,6 +24,7 @@ static void Main(string[] args)
{
Console.WriteLine("AddElements Sample:");

// ReSharper disable once UnusedVariable
using (Library lib = new Library())
{
Console.WriteLine("Initialized the library.");
Expand Down Expand Up @@ -157,7 +157,7 @@ static void Main(string[] args)
return;
}

throw ex;
throw;
}
gs = new GraphicState();
gs.FillColor = new Color(0, 0, 1.0);
Expand Down
3 changes: 1 addition & 2 deletions DotNETCore/Sample_Source/ContentCreation/Clips/Clips.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using Datalogics.PDFL;

/*
Expand All @@ -26,6 +24,7 @@ static void Main(string[] args)
{
Console.WriteLine("Clips Sample:");

// ReSharper disable once UnusedVariable
using (Library lib = new Library())
{
Console.WriteLine("Initialized the library.");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;

using Datalogics.PDFL;

/*
Expand Down Expand Up @@ -91,6 +88,7 @@ static void Main(string[] args)
{
Console.WriteLine("CreateBookmarks Sample:");

// ReSharper disable once UnusedVariable
using (Library lib = new Library())
{
Console.WriteLine("Initialized the library.");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using Datalogics.PDFL;

/*
Expand All @@ -25,6 +23,7 @@ static void Main(string[] args)
{
Console.WriteLine("GradientShade Sample:");

// ReSharper disable once UnusedVariable
using (Library lib = new Library())
{
Console.WriteLine("Initialized the library.");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using Datalogics.PDFL;

/*
Expand All @@ -22,6 +20,7 @@ class MakeDocWithCalGrayColorSpace
{
static void Main(string[] args)
{
// ReSharper disable once UnusedVariable
using (Library lib = new Library())
{
String sOutput = "CalGray-out.pdf";
Expand Down Expand Up @@ -49,7 +48,7 @@ static void Main(string[] args)
return;
}

throw ex;
throw;
}
// a space consisting of the Y dimension of the CIE 1931 XYZ
// space with the CCIR XA/11-recommended D65 white point and
Expand All @@ -61,7 +60,7 @@ static void Main(string[] args)

ColorSpace cs = new CalGrayColorSpace(whitePoint, blackPoint, gamma);
GraphicState gs = new GraphicState();
gs.FillColor = new Color(cs, new Double[] { 0.5 });
gs.FillColor = new Color(cs, new[] { 0.5 });


Matrix textMatrix = new Matrix(24, 0, 0, 24, // Set font width and height to 24 point size
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using Datalogics.PDFL;

/*
Expand All @@ -23,6 +21,7 @@ class MakeDocWithCalRGBColorSpace
{
static void Main(string[] args)
{
// ReSharper disable once UnusedVariable
using (Library lib = new Library())
{
String sOutput = "CalRGB-out.pdf";
Expand Down Expand Up @@ -50,7 +49,7 @@ static void Main(string[] args)
return;
}

throw ex;
throw;
}
// a CalRGB color space for the CCIR XA/11-recommended D65
// white point with 1.8 gammas and Sony Trinitron phosphor
Expand All @@ -66,7 +65,7 @@ static void Main(string[] args)


GraphicState gs = new GraphicState();
gs.FillColor = new Color(cs, new Double[] { 0.3, 0.7, 0.3 });
gs.FillColor = new Color(cs, new[] { 0.3, 0.7, 0.3 });


Matrix textMatrix = new Matrix(24, 0, 0, 24, // Set font width and height to 24 point size
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System;
using System.Collections.Generic;
using System.Text;
using Datalogics.PDFL;

/*
Expand All @@ -22,6 +20,7 @@ class MakeDocWithDeviceNColorSpace
{
static void Main(string[] args)
{
// ReSharper disable once UnusedVariable
using (Library lib = new Library())
{
String sOutput = "DeviceN-out.pdf";
Expand Down Expand Up @@ -49,7 +48,7 @@ static void Main(string[] args)
return;
}

throw ex;
throw;
}
ColorSpace alternate = ColorSpace.DeviceRGB;

Expand All @@ -58,9 +57,9 @@ static void Main(string[] args)
string code = "{ 0 exch }";
Function tintTransform = new PostScriptCalculatorFunction(domain, range, code);

ColorSpace cs = new DeviceNColorSpace(new string[] { "DLRed", "DLBlue" }, alternate, tintTransform);
ColorSpace cs = new DeviceNColorSpace(new[] { "DLRed", "DLBlue" }, alternate, tintTransform);
GraphicState gs = new GraphicState();
gs.FillColor = new Color(cs, new Double[] { 0.75, 0.75 });
gs.FillColor = new Color(cs, new[] { 0.75, 0.75 });


Matrix textMatrix = new Matrix(24, 0, 0, 24, // Set font width and height to 24 point size
Expand Down
Loading

0 comments on commit 9d29ebe

Please sign in to comment.