Knowledge Base - How to create an image page using Xamarin? (Android)

This article shows, how to add an image, from the device storage, to a pdf. (A premium license is required)

private void createPDF()

      Document mDocument = new Document();
      mDocument.SetCache(Global.TmpPath + "/temp.dat");
      NewPage(mDocument, 0, 210, 297);


private void NewPage(Document document, int pageno, float w, float h)
       Page page = document.NewPage(pageno, w, h);//create A4 paper

       PageContent content = new PageContent();
       content.Create();//create content, do not forget.

       Bitmap bmp = BitmapFactory.DecodeFile("/sdcard/image.png");
       Document.DocImage dimg = document.NewImage(bmp, true);

       ResImage rimg = page.AddResImage(dimg);
       Com.Radaee.Pdf.Matrix mat = new Com.Radaee.Pdf.Matrix(w, h, 0, 0);


       //add content to page
       page.AddContent(content, true);
Applies To

RadaeePDF SDK for Xamarin


Created : 2017-03-17 14:11:36, Last Modified : 2022-03-21 17:51:58