How to show one image on one page in PDF document

I have list of streams , every stream is an image , i got one image on one page, and its showing. This is my code
```
 PdfPage page = document.Pages.Add();

                PdfGraphics graphics = page.Graphics;

                Stream imageStream = Datoteki_novi_pom.ElementAt(i);
                PdfBitmap image = new PdfBitmap(imageStream);
               
                page.Graphics.DrawImage(image,0,0,600,600);

```
But my idea is to image fit on all the page, like one page one image? How to do that? wit this size 600 x 600 there is an empty white space i dont want to have that. Maybe compress the image, or something else?



1 Reply

SL Sowmiya Loganathan Syncfusion Team March 20, 2020 11:43 AM UTC

Hi Vasko,   
  
Thank you for contacting Syncfusion support.   
  
We have analyzed your requirement and we can able to fit the image in one page of PDF document. Please refer the below code snippet for your reference,   
  
//Create a new PDF document  
PdfDocument doc = new PdfDocument();  
  
//If you want to set no margin to PDF document   
doc.PageSettings.Margins.All = 0;  
  
//Add a page to the document  
PdfPage page = doc.Pages.Add();  
  
//Create PDF graphics for the page  
PdfGraphics graphics = page.Graphics;  
  
//Load the image as stream  
Stream imageStream =typeof(App).GetTypeInfo().Assembly.GetManifestResourceStream("Sample.Assets.Autumn Leaves.jpg");  
PdfBitmap image = new PdfBitmap(imageStream);  
  
//Draw the image  
graphics.DrawImage(image, new PointF(0,0), new SizeF(page.GetClientSize().Width, page.GetClientSize().Height));  
  
Please try the above solution in your end and let us know if you need any further assistance on this.   
  
Regards,  
Sowmiya Loganathan  
 


Loader.
Up arrow icon