This is a migrated thread and some comments may be shown as answers.
Understanding Size in PDFProcessing
3 Answers 33 Views
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 09 Mar 2021, 06:30 PM

Real beginner question here but need some pointers on sizing in a PDF document. 

Can anyone explain sizing in PdfProcessing?

First question - How is the page size defined for RadFixedDocument, does is default to A4 or is there some kind of measurement setting applied by default?  Does this same metric apply to the rest of the document (e.g. is it all mm/pixels or some other measurement)

RadFixedDocument document = new RadFixedDocument();

Second question

How is image size in pixels relative to the sizing on the page itself.  In the sample below, imageSource.Width is pixels taken from the actual image, how does that translate to a relative size on the page?

 

3 Answers, 1 is accepted

Sort by
0
Chris
Top achievements
Rank 1
answered on 09 Mar 2021, 06:32 PM

Code for the second question (sorry the code editor lost the OK button)

using (Stream companyLogoImage = ContentGenerator.GetCompanyLogo())
 {
     var imageSource = new Telerik.Windows.Documents.Fixed.Model.Resources.ImageSource(companyLogoImage);
     editor.InsertImageInline(imageSource,new Size(imageSource.Width, imageSource.Height));
 }

 

Any pointers appreciated, thanks.

0
Chris
Top achievements
Rank 1
answered on 09 Mar 2021, 07:58 PM

Ah just come across Telerik.Windows.Documents.Media.Unit for converting measurements to DIP (Device Independent Pixels).

Which answers the sizing questions - the following will specify A4 sizing:

new Size(Telerik.Windows.Documents.Media.Unit.MmToDip(210), Telerik.Windows.Documents.Media.Unit.MmToDip(297));

0
Martin
Telerik team
answered on 12 Mar 2021, 11:03 AM

Hello Chris,

Thank you for the feedback.

Indeed, the measurement unit in the PdfProcessing library is DIP (Device-independent pixel). We have an internal item to provide detailed information about the PdfProcessing measurement unit and about this helper class, so I am including your feedback on it.

If you need any further assistance, please, let us know.

Regards,
Martin
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Asked by
Chris
Top achievements
Rank 1
Answers by
Chris
Top achievements
Rank 1
Martin
Telerik team
Share this question
or