Skip to content

Commit

Permalink
Fix namespace issues for Path and Image classes in .NET Core.
Browse files Browse the repository at this point in the history
  • Loading branch information
datalogics-bruceh committed Sep 9, 2022
1 parent 82e623b commit a050858
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ static void Main(string[] args)
Page docpage = doc.CreatePage(Document.BeforeFirstPage, pageRect);

// Draw a five pointed star.
Path starpath = new Path();
Datalogics.PDFL.Path starpath = new Datalogics.PDFL.Path();
GraphicState gs = starpath.GraphicState;

starpath.PaintOp = PathPaintOpFlags.Stroke;
Expand Down Expand Up @@ -79,7 +79,7 @@ static void Main(string[] args)
docpage.Content.AddElement(starpath); // Add the new element to the Content of the page.

// Draw a pentagon around the star
Path pentpath = new Path();
Datalogics.PDFL.Path pentpath = new Datalogics.PDFL.Path();
pentpath.PaintOp = PathPaintOpFlags.Stroke;
gs.Width = 2.0;
List<double> PentDashPattern = new List<double>();
Expand All @@ -99,7 +99,7 @@ static void Main(string[] args)
docpage.Content.AddElement(pentpath); // Add the new element to the Content of the page.

// Add a single line star in the middle of the big star
Path newstar = new Path();
Datalogics.PDFL.Path newstar = new Datalogics.PDFL.Path();
newstar.PaintOp = PathPaintOpFlags.EoFill;
gs.Width = 1.0;
List<double> starDashPattern = new List<double>();
Expand All @@ -124,7 +124,7 @@ static void Main(string[] args)
/* Second page: a diamond with text inside */
docpage = doc.CreatePage(0, pageRect);

Path diamond = new Path();
Datalogics.PDFL.Path diamond = new Datalogics.PDFL.Path();
List<double> diamondDashPattern = new List<double>();
gs.DashPattern = diamondDashPattern;
gs.FillColor = new Color(1.0, 1.0, 0); // Yellow
Expand Down Expand Up @@ -193,7 +193,7 @@ static void Main(string[] args)

/* Third page: a stroked path that uses all the segment types */
docpage = doc.CreatePage(1, pageRect);
Path path = new Path();
Datalogics.PDFL.Path path = new Datalogics.PDFL.Path();

path.PaintOp = PathPaintOpFlags.Stroke;
gs = path.GraphicState;
Expand Down
4 changes: 2 additions & 2 deletions DotNETCore/Sample_Source/ContentCreation/Clips/Clips.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static void Main(string[] args)
Console.WriteLine("Created new document and first page.");

// Create a new path, set up its graphic state and PaintOp
Path path = new Path();
Datalogics.PDFL.Path path = new Datalogics.PDFL.Path();
GraphicState gs = new GraphicState();
Color color = new Color(0.0, 0.0, 0.0);
gs.FillColor = color;
Expand All @@ -68,7 +68,7 @@ static void Main(string[] args)
Console.WriteLine("Added path to page in document.");

// Create a new path and add a rectangle to it
Path clipPath = new Path();
Datalogics.PDFL.Path clipPath = new Datalogics.PDFL.Path();
point = new Point(50, 300);
clipPath.AddRect(point, 300, 250);
Console.WriteLine("Created clipping path and added rectangle to it.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static void Main(string[] args)
Function[] functionList = {f};
AxialShadingPattern asp = new AxialShadingPattern(ColorSpace.DeviceRGB, coords, functionList);

Path path = new Path();
Datalogics.PDFL.Path path = new Datalogics.PDFL.Path();
GraphicState gs = path.GraphicState;

// Please note path does not create a default graphic state,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ static void Main(string[] args)
pip.HorizontalResolution = 300;
pip.VerticalResolution = 300;

Image images = pg.GetImage(pg.CropBox, pip, colorants);
Datalogics.PDFL.Image images = pg.GetImage(pg.CropBox, pip, colorants);
// Save images as multi-channeled tiff.
images.Save(sOutput, ImageType.TIFF);
images.Save(sOutput, Datalogics.PDFL.ImageType.TIFF);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static void Main()

Document doc = new Document();

using (new Path())
using (new Datalogics.PDFL.Path())
{
// Create a PDF page which is the same size of the image.
Rect pageRect = new Rect(0, 0, 100, 100);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public void Export_Image(Content content, ColorSpace csp, Page pg, int pNum)
PageImageParams pip = new PageImageParams();
pip.ImageColorSpace = csp;

Image outImage = pg.GetImage(pg.CropBox, pip);
Datalogics.PDFL.Image outImage = pg.GetImage(pg.CropBox, pip);

String filenamevar = "";

Expand Down
4 changes: 2 additions & 2 deletions DotNETCore/Sample_Source/Images/ImageExport/ImageExport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@ public void Export_Element_Images(Content content)
while (i < content.NumElements)
{
Element e = content.GetElement(i);
if (e is Image)
if (e is Datalogics.PDFL.Image)
{
Image img = (Image) e;
Datalogics.PDFL.Image img = (Datalogics.PDFL.Image) e;
// Weed out impossible on nonsensical combinations.
if (img.ColorSpace == ColorSpace.DeviceCMYK && exporttype != ImageType.JPEG)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ static void ResampleImages(Content content)
{
Element e = content.GetElement(i);
Console.WriteLine(i + " / " + content.NumElements + " = " + e.GetType());
if (e is Image)
if (e is Datalogics.PDFL.Image)
{
Image img = (Image) e;
Datalogics.PDFL.Image img = (Datalogics.PDFL.Image) e;
try
{
Image newimg = img.ChangeResolution(400);
Datalogics.PDFL.Image newimg = img.ChangeResolution(400);
Console.WriteLine("Replacing an image...");
content.AddElement(newimg, i);
content.RemoveElement(i);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ static void Main(string[] args)
Rect pageRect = new Rect(0, 0, 612, 792);
Page docpage = doc.CreatePage(Document.BeforeFirstPage, pageRect);

Image baseImage;
baseImage = new Image(sInput);
Datalogics.PDFL.Image baseImage;
baseImage = new Datalogics.PDFL.Image(sInput);
Console.WriteLine("Created the image to mask.");

Image maskImage;
maskImage = new Image(sMask);
Datalogics.PDFL.Image maskImage;
maskImage = new Datalogics.PDFL.Image(sMask);
Console.WriteLine("Created the image to use as mask.");

baseImage.SoftMask = maskImage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ private static void ListPathsInContent(Content content, int pgno)
{
Element e = content.GetElement(i);

if (e is Path)
if (e is Datalogics.PDFL.Path)
{
ListPath(e as Path, pgno);
ListPath(e as Datalogics.PDFL.Path, pgno);
}
else if (e is Container)
{
Expand All @@ -79,7 +79,7 @@ private static void ListPathsInContent(Content content, int pgno)
}
}

private static void ListPath(Path path, int pgno)
private static void ListPath(Datalogics.PDFL.Path path, int pgno)
{
IList<Segment> segments = path.Segments;
Console.WriteLine("Path on page {0}:", pgno);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private static void DisplayImageMetadata(String input)
// Demonstrate getting data from an image
Content content = doc.GetPage(0).Content;
Container container = (Container) content.GetElement(0);
Image image = (Image) container.Content.GetElement(0);
Datalogics.PDFL.Image image = (Datalogics.PDFL.Image) container.Content.GetElement(0);
String metadata = image.Stream.Dict.XMPMetadata;
Console.WriteLine("Ducky CreatorTool: {0}\n", GetCreatorToolAttribute(metadata));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ static void AddTextToImages(Document doc, Content content, OCREngine engine)
for (int index = 0; index < content.NumElements; index++)
{
Element e = content.GetElement(index);
if (e is Image)
if (e is Datalogics.PDFL.Image)
{
//PlaceTextUnder creates a form with the image and the generated text
//under the image. The original image in the page is then replaced by
//by the form.
Form form = engine.PlaceTextUnder((Image) e, doc);
Form form = engine.PlaceTextUnder((Datalogics.PDFL.Image) e, doc);
content.RemoveElement(index);
content.AddElement(form, index - 1);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static void Main(string[] args)
//Create a document object
using (Document doc = new Document())
{
using (Image newimage = new Image(sInput, doc))
using (Datalogics.PDFL.Image newimage = new Datalogics.PDFL.Image(sInput, doc))
{
// Create a PDF page which is the size of the image.
// Matrix.A and Matrix.D fields, respectively.
Expand All @@ -82,7 +82,7 @@ static void Main(string[] args)
{
Content content = page.Content;
Element elem = content.GetElement(0);
Image image = (Image) elem;
Datalogics.PDFL.Image image = (Datalogics.PDFL.Image) elem;
//PlaceTextUnder creates a form with the image and the generated text
//under the image. The original image in the page is then replaced by
//by the form.
Expand Down

0 comments on commit a050858

Please sign in to comment.