Aspose.pdf v6.7.0.0 missing graphics operators


I use the sample code off of your site to insert images into pdf pages. When I switched from v to v of aspose the following Operators are not defined - they are highlighted as errors in VS and they operator names do not come up in intellisense.

Here is the code. To replicate this issue:

1. Copy the below code into a new console application
2. Reference aspose, notice no syntax errors, compile to confirm
3. Remove aspose reference and add, notice the errors for undefined operators

Undefined operator in this example are:

public static void CreateDoc(List<byte[]> CroppedImages, byte[] LicenseContent, string FileName)
Aspose.Pdf.License License = new Aspose.Pdf.License();
License.SetLicense(new MemoryStream(LicenseContent));

Document pdfDocument = new Document();

int lowerLeftX = 0;
int lowerLeftY = 0;
int upperRightX = 595;
int upperRightY = 840;

int PageNumber = 0;
foreach (byte[] i in CroppedImages)
Page page = pdfDocument.Pages.Insert(PageNumber);
page.Resources.Images.Add(new MemoryStream(i));
page.Contents.Add(new Operator.q()); //operator q not defined
Aspose.Pdf.Rectangle rectangle = new Aspose.Pdf.Rectangle(lowerLeftX, lowerLeftY, upperRightX, upperRightY);
Matrix matrix = new Matrix(new double[] { rectangle.URX - rectangle.LLX, 0, 0, rectangle.URY - rectangle.LLY, rectangle.LLX, rectangle.LLY });
page.Contents.Add(new; //operator cm not defined
XImage ximage = page.Resources.Images[page.Resources.Images.Count];
page.Contents.Add(new Operator.Do(ximage.Name));
page.Contents.Add(new Operator.Q()); //operator Q not defined

Any insight would be greatly appreciated.


Hi Gary,

Thank you for sharing the details.

Kindly use the latest version of Aspose.Pdf v6.7 and change the operator as mentioned below.

//using GSave operator: this operator saves current graphics state

Aspose.Pdf.Operator.GSave() instead of q Operator

//using GRestore operator: this operator restores graphics state

Aspose.Pdf.Operator.GRestore() instead of Q Operator

//using ConcatenateMatrix operator: defines how image must be placed

Aspose.Pdf.Operator.ConcatenateMatrix(matrix) instead of cm Operator

For more details, please visit: [Some changes in Operator class names](

Also, we will update our documentation with the latest update soon. Sorry for the inconvenience.

Please feel free to contact support in case you need any further assistance.

Thanks & Regards,

Hi Rashid,

These changes did the trick.