'using cm (concatenate matrix) operator: defines how image must be placed
page.Contents.Add(NewOperator.cm(matrix))
Dim ximage As XImage = page.Resources.Images(page.Resources.Images.Count)
'using Do operator: this operator draws image
page.Contents.Add(NewOperator.Do(ximage.Name))
'using Q operator: this operator restores graphics state
page.Contents.Add(NewOperator.Q())
The above code is part of your example code for adding an image to an existing pdf document. When I attempt to use this code, the compiler give me an error because Operator.Q and Operator.q are ambiguous in vb.net (which is case insensitive). Am I missing something? How can I make this code work in vb.net?
I have tested the scenario using exact code Introduction to the PDF Operators and Their Usage but unable to notice any problem. Moreover Operator.Q and Operator.q are not ambiguous because these are two separate classes in Aspose.Pdf namespace, please visit the Operator Classes link for details.
Please feel free to contact support in case you need any further assistance.
I totally agree with you, VB.NET is case insensitive and there is no difference between Operator.q and Operator.Q. You can use either Operator.q or Operator.Q there is no difference in implementation, because of case insensitivity classes are available with both names in Aspose.Pdf namespace.
Please feel free to contact support in case you required any further assistance.
Hi James,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
I am able to see your mentioned issue in VB.NET. I have
created an issue in our issue tracking system with issue id: PDFNEWNET-32908 for
our development team to check. We will notify you regarding any feedback via
this forum thread.
Thanks for your patience. The names of operator classes have been updated according to CLS. Please find attached the document which shows the updates that have been made against classes names. More along, the following code should now work in VB.NET
[VB.NET]
'open document Dim pdfDocument AsNew Document(“input.pdf”) 'set coordinates Dim lowerLeftX AsInteger = 100 Dim lowerLeftY AsInteger = 100 Dim upperRightX AsInteger = 200 Dim upperRightY AsInteger = 200 'get the page where image needs to be added Dim page As Page = pdfDocument.Pages(1) 'load image into stream Dim imageStream AsNew FileStream(“aspose-logo.jpg”, FileMode.Open) 'add image to Images collection of Page Resources page.Resources.Images.Add(imageStream) 'using GSave operator: this operator saves current graphics state page.Contents.Add(New Aspose.Pdf.Operator.GSave()) 'create Rectangle and Matrix objects Dim rectangle AsNew Aspose.Pdf.Rectangle(lowerLeftX, lowerLeftY, upperRightX, upperRightY) Dim matrix AsNew DOM.Matrix(NewDouble() {rectangle.URX - rectangle.LLX, 0, 0, rectangle.URY - rectangle.LLY, rectangle.LLX, rectangle.LLY}) 'using ConcatenateMatrix (concatenate matrix) operator: defines how image must be placed page.Contents.Add(New Aspose.Pdf.Operator.ConcatenateMatrix(matrix)) Dim ximage As XImage = page.Resources.Images(page.Resources.Images.Count) 'using Do operator: this operator draws image page.Contents.Add(New Aspose.Pdf.Operator.Do(ximage.Name)) 'using GRestore operator: this operator restores graphics state page.Contents.Add(New Aspose.Pdf.Operator.GRestore()) 'save updated document pdfDocument.Save(“output.pdf”)
The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan