We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Scale vector image


I want to insert a vector image in a pdf file but instead of using the original resolution I want to scale it down to a different size. I have this code based on the documentation.

PdfDocument doc = new PdfDocument();
PdfPage page = doc.Pages.Add();
PdfGraphics graphics = page.Graphics;

PdfMetafile metaChart = new PdfMetafile("BoxOk.emf");

PointF drawingCoordinates = new PointF(0, 0);

metaChart.Draw(page, new RectangleF(drawingCoordinates.X, drawingCoordinates.Y + 2, 12, 12));


The result however is a 51 page pdf with a small 12 by 12 part of the image on each page. What I need is the complete image scaled down to 12 by 12 only on the first page.

How can this be achieved?

Attachment: Pdf_and_vector_image_42004542.zip

1 Reply

PV Prakash Viswanathan Syncfusion Team October 25, 2019 09:11 AM UTC

Hi Bruno, 
Thank you for contacting Syncfusion support.  
We have prepared a sample to draw the vector image with the provided size, please find the sample from below mentioned link.  
Refer the below modified code snippet, 
// Create a PDF Document. 
PdfDocument doc = new PdfDocument(); 
//Add pages to the document 
PdfPage page = doc.Pages.Add(); 
//Create PDF graphics for the page 
PdfGraphics graphics = page.Graphics; 
//Create a Metafile instance 
PdfMetafile metaChart = new PdfMetafile(DataPathBase + "BoxOk.emf"); 
RectangleF rect = new RectangleF(0, 2, 12, 12); 
//Draw the Metafile in the page         
graphics.DrawImage(metaChart, rect); 
//Save and close the document 
Please let us know if you need any further assistance on this.  
Prakash V 

Live Chat Icon For mobile
Up arrow icon