How is Operator Q and Operator q supposed to work in vb.net which is case insensitive?

'using q operator: this operator saves current graphics state

page.Contents.Add(New Operator.q())

'create Rectangle and Matrix objects

Dim rectangle As New Aspose.Pdf.Rectangle(lowerLeftX, lowerLeftY, upperRightX, upperRightY)

Dim matrix As New Matrix(New Double() { rectangle.URX - rectangle.LLX, 0, 0, rectangle.URY - rectangle.LLY, rectangle.LLX, rectangle.LLY })

'using cm (concatenate matrix) operator: defines how image must be placed

page.Contents.Add(New Operator.cm(matrix))

Dim ximage As XImage = page.Resources.Images(page.Resources.Images.Count)

'using Do operator: this operator draws image

page.Contents.Add(New Operator.Do(ximage.Name))

'using Q operator: this operator restores graphics state

page.Contents.Add(New Operator.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?


This message was posted using Page2Forum from Add Image in an Existing PDF File - Aspose.Pdf for .NET

Hi Zucker,

Thanks for your interest in our products.

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.

Thanks & Regards,

In vb.net operator.q = = operator.Q because q == Q

Hi Zucker,

Sorry for your inconvenience.

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.

Thanks & Regards,

The question of how to make the example work in VB.NET is not answered. The code as presented will not compile. Error description:

"'Q' is ambiguous because multiple kinds of members with this name exist in class 'Aspose.Pdf.Operator'"

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.

Sorry for the inconvenience,

The issues you have found earlier (filed as PDFNEWNET-32908) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Hi James,


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 As New Document(“input.pdf”)
'set coordinates
Dim lowerLeftX As Integer = 100
Dim lowerLeftY As Integer = 100
Dim upperRightX As Integer = 200
Dim upperRightY As Integer = 200
'get the page where image needs to be added
Dim page As Page = pdfDocument.Pages(1)
'load image into stream
Dim imageStream As New 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 As New Aspose.Pdf.Rectangle(lowerLeftX, lowerLeftY, upperRightX, upperRightY)
Dim matrix As New DOM.Matrix(New Double() {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”)

Can you update the docs? They still refer to Q rather than GSave.

Thanks
Randy

Hi Randy,


Can you please share which page is still showing older operator names. We are sorry for this inconvenience.

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