Understanding Size in PDFProcessing

4 posts, 0 answers
  1. Chris
    Chris avatar
    8 posts
    Member since:
    Mar 2015

    Posted 09 Mar Link to this post

    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?

     

  2. Chris
    Chris avatar
    8 posts
    Member since:
    Mar 2015

    Posted 09 Mar in reply to Chris Link to this post

    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.

  3. Chris
    Chris avatar
    8 posts
    Member since:
    Mar 2015

    Posted 09 Mar Link to this post

    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));

  4. Martin
    Admin
    Martin avatar
    140 posts

    Posted 12 Mar Link to this post

    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/.

Back to Top