From a05085889b23324743bb1498a4bfc5f4a1eeb0a4 Mon Sep 17 00:00:00 2001 From: bruceh Date: Fri, 9 Sep 2022 17:59:07 -0500 Subject: [PATCH] Fix namespace issues for Path and Image classes in .NET Core. --- .../ContentCreation/AddElements/AddElements.cs | 10 +++++----- .../Sample_Source/ContentCreation/Clips/Clips.cs | 4 ++-- .../ContentCreation/GradientShade/GradientShade.cs | 2 +- .../WriteNChannelTiff/WriteNChannelTiff.cs | 4 ++-- .../Sample_Source/ContentModification/Action/Action.cs | 2 +- .../ImageEmbedICCProfile/ImageEmbedICCProfile.cs | 2 +- .../Sample_Source/Images/ImageExport/ImageExport.cs | 4 ++-- .../Images/ImageResampling/ImageResampling.cs | 6 +++--- .../Images/ImageSoftMask/ImageSoftMask.cs | 8 ++++---- .../InformationExtraction/ListPaths/ListPaths.cs | 6 +++--- .../InformationExtraction/Metadata/Metadata.cs | 2 +- .../AddTextToDocument/AddTextToDocument.cs | 4 ++-- .../AddTextToImage/AddTextToImage.cs | 4 ++-- 13 files changed, 29 insertions(+), 29 deletions(-) diff --git a/DotNETCore/Sample_Source/ContentCreation/AddElements/AddElements.cs b/DotNETCore/Sample_Source/ContentCreation/AddElements/AddElements.cs index 1316b2d6..9edabce6 100644 --- a/DotNETCore/Sample_Source/ContentCreation/AddElements/AddElements.cs +++ b/DotNETCore/Sample_Source/ContentCreation/AddElements/AddElements.cs @@ -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; @@ -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 PentDashPattern = new List(); @@ -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 starDashPattern = new List(); @@ -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 diamondDashPattern = new List(); gs.DashPattern = diamondDashPattern; gs.FillColor = new Color(1.0, 1.0, 0); // Yellow @@ -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; diff --git a/DotNETCore/Sample_Source/ContentCreation/Clips/Clips.cs b/DotNETCore/Sample_Source/ContentCreation/Clips/Clips.cs index a0465e97..1ae9432c 100644 --- a/DotNETCore/Sample_Source/ContentCreation/Clips/Clips.cs +++ b/DotNETCore/Sample_Source/ContentCreation/Clips/Clips.cs @@ -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; @@ -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."); diff --git a/DotNETCore/Sample_Source/ContentCreation/GradientShade/GradientShade.cs b/DotNETCore/Sample_Source/ContentCreation/GradientShade/GradientShade.cs index fdcc7309..8d5b7e5a 100644 --- a/DotNETCore/Sample_Source/ContentCreation/GradientShade/GradientShade.cs +++ b/DotNETCore/Sample_Source/ContentCreation/GradientShade/GradientShade.cs @@ -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, diff --git a/DotNETCore/Sample_Source/ContentCreation/WriteNChannelTiff/WriteNChannelTiff.cs b/DotNETCore/Sample_Source/ContentCreation/WriteNChannelTiff/WriteNChannelTiff.cs index 33eee820..1630ed8a 100644 --- a/DotNETCore/Sample_Source/ContentCreation/WriteNChannelTiff/WriteNChannelTiff.cs +++ b/DotNETCore/Sample_Source/ContentCreation/WriteNChannelTiff/WriteNChannelTiff.cs @@ -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); } } } diff --git a/DotNETCore/Sample_Source/ContentModification/Action/Action.cs b/DotNETCore/Sample_Source/ContentModification/Action/Action.cs index d9a00a23..384856eb 100644 --- a/DotNETCore/Sample_Source/ContentModification/Action/Action.cs +++ b/DotNETCore/Sample_Source/ContentModification/Action/Action.cs @@ -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); diff --git a/DotNETCore/Sample_Source/Images/ImageEmbedICCProfile/ImageEmbedICCProfile.cs b/DotNETCore/Sample_Source/Images/ImageEmbedICCProfile/ImageEmbedICCProfile.cs index b71f07e7..56060f26 100644 --- a/DotNETCore/Sample_Source/Images/ImageEmbedICCProfile/ImageEmbedICCProfile.cs +++ b/DotNETCore/Sample_Source/Images/ImageEmbedICCProfile/ImageEmbedICCProfile.cs @@ -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 = ""; diff --git a/DotNETCore/Sample_Source/Images/ImageExport/ImageExport.cs b/DotNETCore/Sample_Source/Images/ImageExport/ImageExport.cs index 329b75ae..4ee520eb 100644 --- a/DotNETCore/Sample_Source/Images/ImageExport/ImageExport.cs +++ b/DotNETCore/Sample_Source/Images/ImageExport/ImageExport.cs @@ -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) { diff --git a/DotNETCore/Sample_Source/Images/ImageResampling/ImageResampling.cs b/DotNETCore/Sample_Source/Images/ImageResampling/ImageResampling.cs index bdee02e2..115b1695 100644 --- a/DotNETCore/Sample_Source/Images/ImageResampling/ImageResampling.cs +++ b/DotNETCore/Sample_Source/Images/ImageResampling/ImageResampling.cs @@ -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); diff --git a/DotNETCore/Sample_Source/Images/ImageSoftMask/ImageSoftMask.cs b/DotNETCore/Sample_Source/Images/ImageSoftMask/ImageSoftMask.cs index d2636b29..c25a70b9 100644 --- a/DotNETCore/Sample_Source/Images/ImageSoftMask/ImageSoftMask.cs +++ b/DotNETCore/Sample_Source/Images/ImageSoftMask/ImageSoftMask.cs @@ -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; diff --git a/DotNETCore/Sample_Source/InformationExtraction/ListPaths/ListPaths.cs b/DotNETCore/Sample_Source/InformationExtraction/ListPaths/ListPaths.cs index 16347eef..699796fe 100644 --- a/DotNETCore/Sample_Source/InformationExtraction/ListPaths/ListPaths.cs +++ b/DotNETCore/Sample_Source/InformationExtraction/ListPaths/ListPaths.cs @@ -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) { @@ -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 segments = path.Segments; Console.WriteLine("Path on page {0}:", pgno); diff --git a/DotNETCore/Sample_Source/InformationExtraction/Metadata/Metadata.cs b/DotNETCore/Sample_Source/InformationExtraction/Metadata/Metadata.cs index 52a965f1..9024b4ac 100644 --- a/DotNETCore/Sample_Source/InformationExtraction/Metadata/Metadata.cs +++ b/DotNETCore/Sample_Source/InformationExtraction/Metadata/Metadata.cs @@ -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)); } diff --git a/DotNETCore/Sample_Source/OpticalCharacterRecognition/AddTextToDocument/AddTextToDocument.cs b/DotNETCore/Sample_Source/OpticalCharacterRecognition/AddTextToDocument/AddTextToDocument.cs index 9e99b86b..7a391303 100644 --- a/DotNETCore/Sample_Source/OpticalCharacterRecognition/AddTextToDocument/AddTextToDocument.cs +++ b/DotNETCore/Sample_Source/OpticalCharacterRecognition/AddTextToDocument/AddTextToDocument.cs @@ -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); } diff --git a/DotNETCore/Sample_Source/OpticalCharacterRecognition/AddTextToImage/AddTextToImage.cs b/DotNETCore/Sample_Source/OpticalCharacterRecognition/AddTextToImage/AddTextToImage.cs index 0fa69567..4b9a371e 100644 --- a/DotNETCore/Sample_Source/OpticalCharacterRecognition/AddTextToImage/AddTextToImage.cs +++ b/DotNETCore/Sample_Source/OpticalCharacterRecognition/AddTextToImage/AddTextToImage.cs @@ -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. @@ -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.