This is a migrated thread and some comments may be shown as answers.

DIP to PX

1 Answer 82 Views
PdfProcessing
This is a migrated thread and some comments may be shown as answers.
Yurko
Top achievements
Rank 1
Yurko asked on 14 Jan 2020, 06:47 PM

I'm trying to resize/position an image on a PDF document but having issues converting from DIP to PX.

How does one do it since when i manipulate images its in PX but PDFProcessing needs it in DIPs

 

 

dim x as integer=100
 
dim y as integer=100
 
Dim doc1 As RadFixedDocument = provider.Import(page)  ' page containes blank pdf byte array created using document.Pages.AddPage()
 
Dim pg As RadFixedPage = doc1.Pages(0)
 
Dim ms As New IO.MemoryStream(img)
 
Dim Image As New Telerik.Windows.Documents.Fixed.Model.Resources.ImageSource(ms)
 
Dim t As Objects.Image = pg.Content.AddImage(Image)
 
t.Position.Clear()
t.Position.Translate(PX2DIP(x), PX2DIP(y))
Return provider.Export(doc1)

1 Answer, 1 is accepted

Sort by
0
Dimitar
Telerik team
answered on 16 Jan 2020, 11:00 AM

Hi Yurko,

You can use the static Unit class which contains several methods for conversion. Here is an example: 

 t.Position.Translate(Telerik.Windows.Documents.Media.Unit.DipToPoint(x), Telerik.Windows.Documents.Media.Unit.DipToPoint(y));

I hope this helps. Should you have any other questions do not hesitate to ask.

Regards,
Dimitar
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
PdfProcessing
Asked by
Yurko
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Share this question
or